Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodedLen ¶
func NewEncoder ¶
func NewEncoder(w io.Writer, codec Codec) io.WriteCloser
func NewEncoderBuffer ¶
func Register ¶
func Register(c Codec)
Register new codec.
NOTE: update FindCodecByName description, after adding new codecs.
func RegisterAlias ¶
Types ¶
type Codec ¶
type Codec interface { ID() CodecID Name() string DecodedLen(in []byte) (int, error) Encode(dst, src []byte) ([]byte, error) Decode(dst, src []byte) ([]byte, error) }
func FindCodecByName ¶
FindCodecByName returns codec by name.
Possible names:
null snappy zstd08_{level} - level is integer 1, 3 or 7. zstd_{level} - level is integer 1, 3 or 7.
func ListCodecs ¶
func ListCodecs() []Codec
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
NewDecoder creates decoder that supports input in any of registered codecs.
func NewDecoderCodec ¶
NewDecoderCodec creates decode that tries to decode input using provided codec.
func (*Decoder) SetCheckUnderlyingEOF ¶
SetCheckUnderlyingEOF changes EOF handling.
Blockcodecs format contains end of stream separator. By default Decoder will stop right after that separator, without trying to read following bytes from underlying reader.
That allows reading sequence of blockcodecs streams from one underlying stream of bytes, but messes up HTTP keep-alive, when using blockcodecs together with net/http connection pool.
Setting CheckUnderlyingEOF to true, changes that. After encoutering end of stream block, Decoder will perform one more Read from underlying reader and check for io.EOF.