BufferReader
Module: strata.io • Kind: struct
Source: strata/io/serializer.mojo
struct BufferReaderfrom strata.io import BufferReaderByte buffer reader with bounds checking and scalar/matrix deserialization.
Constructors
Section titled “Constructors”def __init__(out self, buffer: List[UInt8])| Argument | Type | Description |
|---|---|---|
buffer |
List[UInt8] |
— |
Methods Overview
Section titled “Methods Overview”| Method | Description |
|---|---|
BufferReader.from_file() |
Read binary contents from disk into a BufferReader. |
BufferReader.read_byte() |
Read a single byte from the buffer. |
BufferReader.read_bool() |
Read a boolean value from the buffer. |
BufferReader.read_int() |
Read an integer from the buffer. |
BufferReader.read_float64() |
Read a 64-bit float from the buffer. |
BufferReader.read_float32() |
Read a 32-bit float from the buffer. |
BufferReader.read_string() |
Read a length-prefixed UTF-8 string from the buffer. |
BufferReader.read_int_list() |
Read a list of integers from the buffer. |
BufferReader.read_float64_list() |
Read a list of 64-bit floats from the buffer. |
BufferReader.read_float_list() |
Read a list of floating-point scalars from the buffer. |
BufferReader.read_matrix() |
Read a dense Matrix from the buffer. |
Method Details
Section titled “Method Details”BufferReader.from_file()
Section titled “BufferReader.from_file()”def from_file(path: String) -> SelfRead binary contents from disk into a BufferReader.
| Parameter | Type | Description |
|---|---|---|
path |
String |
— |
Returns: Self
BufferReader.read_byte()
Section titled “BufferReader.read_byte()”def read_byte(mut self) -> UInt8Read a single byte from the buffer.
Returns: UInt8
BufferReader.read_bool()
Section titled “BufferReader.read_bool()”def read_bool(mut self) -> BoolRead a boolean value from the buffer.
Returns: Bool
BufferReader.read_int()
Section titled “BufferReader.read_int()”def read_int(mut self) -> IntRead an integer from the buffer.
Returns: Int
BufferReader.read_float64()
Section titled “BufferReader.read_float64()”def read_float64(mut self) -> Float64Read a 64-bit float from the buffer.
Returns: Float64
BufferReader.read_float32()
Section titled “BufferReader.read_float32()”def read_float32(mut self) -> Float32Read a 32-bit float from the buffer.
Returns: Float32
BufferReader.read_string()
Section titled “BufferReader.read_string()”def read_string(mut self) -> StringRead a length-prefixed UTF-8 string from the buffer.
Returns: String
BufferReader.read_int_list()
Section titled “BufferReader.read_int_list()”def read_int_list(mut self) -> List[Int]Read a list of integers from the buffer.
Returns: List[Int]
BufferReader.read_float64_list()
Section titled “BufferReader.read_float64_list()”def read_float64_list(mut self) -> List[Float64]Read a list of 64-bit floats from the buffer.
Returns: List[Float64]
BufferReader.read_float_list()
Section titled “BufferReader.read_float_list()”def read_float_list[dtype: DType](mut self) -> List[Scalar[dtype]]Read a list of floating-point scalars from the buffer.
Returns: List[Scalar[dtype]]
BufferReader.read_matrix()
Section titled “BufferReader.read_matrix()”def read_matrix[dtype: DType](mut self) -> Matrix[dtype]Read a dense Matrix from the buffer.
Returns: Matrix[dtype]