Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteStore ¶
type ByteStore struct {
// contains filtered or unexported fields
}
ByteStore is implementing a ReadWriteSeeker storing data in memory.
func NewByteStoreFromData ¶
NewByteStoreFromData returns a new ByteStore instance wrapping the provided data.
type Codable ¶
type Codable interface { // Code requests to serialize the Codable via the provided Coder. Code(coder Coder) }
Codable is something than can be serialized with a Coder.
type Coder ¶
type Coder interface { // FirstError returns the first error this coder encountered. FirstError() error // Code serializes the given value. // Any error state will be provided via FirstError(). Code will do nothing // if the coder is already in error state. Code(value interface{}) }
Coder represents an Encoder/Decoder for binary data.
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder is for decoding from a reader.
func NewDecoder ¶
NewDecoder creates a new Decoder from given source.
func (*Decoder) Code ¶
func (coder *Decoder) Code(value interface{})
Code serializes the given value in little endian format using binary.Read().
func (*Decoder) FirstError ¶
FirstError returns the error this Decoder encountered the first time.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder implements the Coder interface to write to a writer. It also implements the Writer interface.
func NewEncoder ¶
NewEncoder creates and returns a fresh Encoder.
func (*Encoder) Code ¶
func (coder *Encoder) Code(value interface{})
Code serializes the given value in little endian format using binary.Write().
func (*Encoder) FirstError ¶
FirstError returns the error this Encoder encountered the first time.
type Positioner ¶
type Positioner interface { // CurPos gets the current position in the data. CurPos() uint32 // SetCurPos sets the current position in the data. SetCurPos(offset uint32) }
Positioner specifies a type that knows about a position which can be modified.
type PositioningCoder ¶
type PositioningCoder interface { Positioner Coder }
PositioningCoder is a coder that also knows about positioning. Any error state regarding repositioning will be provided via FirstError(). SetCurPos will do nothing if the coder is already in error state.
type PositioningDecoder ¶
type PositioningDecoder struct { Decoder // contains filtered or unexported fields }
PositioningDecoder is a Decoder with positioning capabilities.
func NewPositioningDecoder ¶
func NewPositioningDecoder(source io.ReadSeeker) *PositioningDecoder
NewPositioningDecoder creates a new PositiongingDecoder from given reader.
func (*PositioningDecoder) CurPos ¶
func (coder *PositioningDecoder) CurPos() uint32
CurPos returns the current decoding position, in bytes.
func (*PositioningDecoder) SetCurPos ¶
func (coder *PositioningDecoder) SetCurPos(offset uint32)
SetCurPos changes the encoding position to the specified absolute offset.
type PositioningEncoder ¶
type PositioningEncoder struct { Encoder // contains filtered or unexported fields }
PositioningEncoder is an Encoder with positioning capabilities.
func NewPositioningEncoder ¶
func NewPositioningEncoder(target io.WriteSeeker) *PositioningEncoder
NewPositioningEncoder returns an Encoder that also implements the Positioner interface. The new Encoder starts with its zero position at the current position in the writer.
func (*PositioningEncoder) CurPos ¶
func (coder *PositioningEncoder) CurPos() uint32
CurPos returns the current encoding position, in bytes.
func (*PositioningEncoder) Seek ¶
func (coder *PositioningEncoder) Seek(offset int64, whence int) (int64, error)
Seek repositions the current encoding offset. This implementation does not support a whence value of io.SeekEnd.
func (*PositioningEncoder) SetCurPos ¶
func (coder *PositioningEncoder) SetCurPos(offset uint32)
SetCurPos changes the encoding position to the specified absolute offset.
type SeekingReadCloser ¶
SeekingReadCloser combines the interfaces of a Reader, a Seeker and a Closer.