Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TFRecord ¶
type TFRecord struct { Data []byte // contains filtered or unexported fields }
A TFRecord is an in-memory representation of a completely read TFRecord. Its Data contains the decoded buffer contents. The record internally has a stored CRC, which is as originally read from the file or given at construction time. It may or may not match the Data.
func NewTFRecord ¶
NewTFRecord creates a TFRecord from an in-memory buffer, computing its checksum.
func NewTFRecordChecksum ¶
NewTFRecordChecksum creates a TFRecord from an in-memory buffer and pre-computed checksum. The checksum is not validated, so calling Checksum() on the resulting record may fail.
func ReadRecord ¶
func ReadRecord(statePtr **TFRecordState, r io.Reader) (*TFRecord, error)
ReadRecord attempts to read a TFRecord, behaving nicely in the face of truncations. If the record is truncated, the first return value is nil and the second is io.EOF, and the state buffer will be updated to contain the prefix of the raw record that was read. The same state buffer should be passed to a subsequent call to ReadRecord that it may continue where it left off. The state buffer must not be nil, but may point to nil, and indeed must point to nil on the first invocation for each record.
The record's length field is always validated against its checksum, but the full data is only validated if you call Checksum() on the result.
func (*TFRecord) ByteSize ¶
ByteSize returns the size of the serialized form of the record: i.e., the number of bytes that would be written by Write. This is the length of its Data plus the overhead of the TFRecord format.
type TFRecordState ¶
type TFRecordState struct {
// contains filtered or unexported fields
}
TFRecordState is the reentrance structure for ReadRecord.