Documentation ¶
Overview ¶
Package io provides the implementations of a Writer and a Reader used to respectively losslessly compress and decompress data.
Index ¶
- type IOError
- type NullOutputStream
- type Reader
- func NewHeaderlessReader(is io.ReadCloser, jobs uint, transform, entropy string, blockSize uint, ...) (*Reader, error)
- func NewReader(is io.ReadCloser, jobs uint) (*Reader, error)
- func NewReaderWithCtx(is io.ReadCloser, ctx map[string]any) (*Reader, error)
- func NewReaderWithCtx2(ibs kanzi.InputBitStream, ctx map[string]any) (*Reader, error)
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IOError ¶
type IOError struct {
// contains filtered or unexported fields
}
IOError an extended error containing a message and a code value
type NullOutputStream ¶
type NullOutputStream struct {
// contains filtered or unexported fields
}
NullOutputStream similar to io.Discard but implements io.WriteCloser
func NewNullOutputStream ¶
func NewNullOutputStream() (*NullOutputStream, error)
NewNullOutputStream creates an instance of NullOutputStream
func (*NullOutputStream) Close ¶
func (this *NullOutputStream) Close() error
Close makes the stream unavailable for future writes
type Reader ¶ added in v2.3.0
type Reader struct {
// contains filtered or unexported fields
}
Reader a Reader that reads compressed data from an InputBitStream.
func NewHeaderlessReader ¶ added in v2.3.0
func NewHeaderlessReader(is io.ReadCloser, jobs uint, transform, entropy string, blockSize uint, checksum bool, originalSize int64, bsVersion uint) (*Reader, error)
NewHeaderlessReader creates a new instance of Reader to decompress a headerless bitstream. The reader reads compressed data blocks from the provided is. Use 0 if the original file size is not known. The default value for the bitstream version is _BITSTREAM_FORMAT_VERSION. If the provided compression parameters do not match those used during compression, the decompression is likely to fail.
func NewReader ¶ added in v2.3.0
func NewReader(is io.ReadCloser, jobs uint) (*Reader, error)
NewReader creates a new instance of Reader. The reader reads compressed data blocks from the provided is.
func NewReaderWithCtx ¶ added in v2.3.0
NewReaderWithCtx creates a new instance of Reader using a map of parameters. The reader reads compressed data blocks from the provided is using a default input bitstream.
func NewReaderWithCtx2 ¶ added in v2.3.0
NewReaderWithCtx2 creates a new instance of Reader. using a map of parameters and a custom input bitstream. The reader reads compressed data blocks from the provided input bitstream.
func (*Reader) AddListener ¶ added in v2.3.0
AddListener adds an event listener to this reader. Returns true if the listener has been added.
func (*Reader) Close ¶ added in v2.3.0
Close reads the buffered data from the reader and releases resources. Close makes the bitstream unavailable for further reads. Idempotent
type Writer ¶ added in v2.3.0
type Writer struct {
// contains filtered or unexported fields
}
Writer a Writer that writes compressed data to an OutputBitStream.
func NewWriter ¶ added in v2.3.0
func NewWriter(os io.WriteCloser, transform, entropy string, blockSize, jobs uint, checksum bool, fileSize int64, headerless bool) (*Writer, error)
NewWriter creates a new instance of Writer. The writer writes compressed data blocks to the provided os. Use 0 if the file size is not available Use headerless == false to create a bitstream without a header. The decompressor must know all the compression parameters to be able to decompress the bitstream. The headerless mode is only useful in very specific scenarios.
func NewWriterWithCtx ¶ added in v2.3.0
NewWriterWithCtx creates a new instance of Writer using a map of parameters and a writer. The writer writes compressed data blocks to the provided os using a default output bitstream.
func NewWriterWithCtx2 ¶ added in v2.3.0
NewWriterWithCtx2 creates a new instance of Writer using a map of parameters and a custom output bitstream. The writer writes compressed data blocks to the provided output bitstream.
func (*Writer) AddListener ¶ added in v2.3.0
AddListener adds an event listener to this writer. Returns true if the listener has been added.
func (*Writer) Close ¶ added in v2.3.0
Close writes the buffered data to the writer then writes a final empty block and releases resources. Close makes the bitstream unavailable for further writes. Idempotent.
func (*Writer) GetWritten ¶ added in v2.3.0
GetWritten returns the number of bytes written so far
func (*Writer) RemoveListener ¶ added in v2.3.0
RemoveListener removes an event listener from this writer. Returns true if the listener has been removed.