Documentation ¶
Overview ¶
Package decoder provides several decoders for differently encoded trice streams.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Verbose gives mor information on output if set. The value is injected from main packages. Verbose bool // Encoding describes the way the byte stream is coded. Encoding string // TestTableMode is a special option for easy decoder test table generation. TestTableMode bool // UnsignedHex if true, forces hex and in values printed as unsigned values. UnsignedHex bool )
Functions ¶
func Translate ¶
func Translate(sw *emitter.TriceLineComposer, lut id.TriceIDLookUp, m *sync.RWMutex, rc io.ReadCloser)
Translate performs the trice log task. Bytes are read with rc. Then according decoder.Encoding they are translated into strings. Each read returns the amount of bytes for one trice. rc is called on every Translate returns true on io.EOF or false on hard read error or sigterm.
Types ¶
type Decoder ¶
Decoder is providing a byte reader returning decoded trice's. setInput allows switching the input stream to a different source.
func NewEscDecoder ¶ added in v0.18.4
NewEscDecoder provides an EscDecoder instance. l is the trice id list in slice of struct format. in is the usable reader for the input bytes.
func NewFlexDecoder ¶ added in v0.21.0
NewFlexDecoder provides an decoder instance. l is the trice id list in slice of struct format. in is the usable reader for the input bytes. littleEndian is false on normal network order.
type Esc ¶
type Esc struct {
// contains filtered or unexported fields
}
Esc is the Decoding instance for esc encoded trices.
func (*Esc) Read ¶ added in v0.18.4
Read is the provided read method for esc decoding of next string as byte slice. It uses inner reader p.in and internal id look-up table to fill b with a string. b is a slice of bytes with a len for the max expected string size. n is the count of read bytes inside b. Read returns one trice string or nothing.
type Flex ¶ added in v0.21.0
type Flex struct {
// contains filtered or unexported fields
}
Flex is the Decoding instance for bare encoded trices.
func (*Flex) Read ¶ added in v0.21.0
Read is the provided read method for flex decoding of next string as byte slice. It uses inner reader p.in and internal id look-up table to fill b with a string. b is a slice of bytes with a len for the max expected string size. n is the count of read bytes inside b. Read returns one trice string (optionally starting wth a channel specifier). A line can contain several trice strings.