StreamEncoding¶
- class dsviper.StreamEncoding¶
Bases:
objectWrites typed values into a blob.
One of the three a codec instantiates, with StreamDecoding to read them back and StreamSizing to predict the size of its fixed-width values.
Note: Not directly instantiable.
- is_ended() bool¶
Return True if the stream is ended.
- stream_writing() StreamWriting¶
Return a StreamWriting interface.
- write_blob_id(value: ValueBlobId) None¶
Write value as a blob_id.
A str is accepted and parsed; raise if it is neither.
- write_bool(value: bool) None¶
Write value as a bool.
Raise if value is not a bool - an int is not accepted.
- write_commit_id(value: ValueCommitId) None¶
Write value as a commit_id.
A str is accepted and parsed; raise if it is neither.
- write_double(value: float) None¶
Write value as a double.
An int is accepted and converted.
- write_doubles(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size double.
An int element is accepted and converted.
- write_float(value: float) None¶
Write value as a float.
An int is accepted; raise if the value does not fit in 32 bits.
- write_floats(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size float.
An int element is accepted; raise if a value does not fit in 32 bits.
- write_int16(value: int) None¶
Write value as an int16.
Raise if value is not an int, or is out of range for an int16.
- write_int16s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size int16.
Raise if an element is not an int, or is out of range for an int16.
- write_int32(value: int) None¶
Write value as an int32.
Raise if value is not an int, or is out of range for an int32.
- write_int32s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size int32.
Raise if an element is not an int, or is out of range for an int32.
- write_int64(value: int) None¶
Write value as an int64.
Raise if value is not an int, or is out of range for an int64.
- write_int64s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size int64.
Raise if an element is not an int, or is out of range for an int64.
- write_int8(value: int) None¶
Write value as an int8.
Raise if value is not an int, or is out of range for an int8.
- write_int8s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size int8.
Raise if an element is not an int, or is out of range for an int8.
- write_string(value: str) None¶
Write value as a string.
Raise if value is not a str.
- write_uint16(value: int) None¶
Write value as a uint16.
Raise if value is not an int, or is out of range for a uint16.
- write_uint16s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size uint16.
Raise if an element is not an int, or is out of range for a uint16.
- write_uint32(value: int) None¶
Write value as a uint32.
Raise if value is not an int, or is out of range for a uint32.
- write_uint32s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size uint32.
Raise if an element is not an int, or is out of range for a uint32.
- write_uint64(value: int) None¶
Write value as a uint64.
Raise if value is not an int, or is out of range for a uint64.
- write_uint64s(value: Sequence | ValueVec, size: int) None¶
Write value, a sequence of size uint64.
Raise if an element is not an int, or is out of range for a uint64.
- write_uint8(value: int) None¶
Write value as a uint8.
Raise if value is not an int, or is out of range for a uint8.