compress

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ZstdReader

type ZstdReader struct {
	// contains filtered or unexported fields
}

zstdReader is an optimized wrapper of zstd.Decoder with sync.Pool support.

func NewZstdReader

func NewZstdReader(r io.Reader) *ZstdReader

NewZstdReader returns a new zstd Reader with the given io.Reader.

func (*ZstdReader) Close

func (zr *ZstdReader) Close() error

Close will reset the decoder the supplied stream after the current has finished processing, and close the underlying io.Reader if it implemented io.Closer. The Reader can not be reused after Close.

func (*ZstdReader) Read

func (zr *ZstdReader) Read(p []byte) (n int, err error)

Read reads data from the underlying io.Reader and decompresses it.

func (*ZstdReader) Reset

func (zr *ZstdReader) Reset()

Reset will reset the decoder the supplied stream after the current has finished processing, it does not close the underlying io.Writer.

type ZstdWriter

type ZstdWriter struct {
	// contains filtered or unexported fields
}

ZstdWriter is an optimized wrapper of zstd.Encoder with sync.Pool support.

func NewZstdWriter

func NewZstdWriter(w io.Writer) *ZstdWriter

NewZstdWriter returns a new zstd Writer with the given io.Writer.

func (*ZstdWriter) Close

func (zw *ZstdWriter) Close() error

Close closes the Writer, flushing any unwritten data to the underlying io.Writer. and close the underlying io.Writer if it implemented io.Closer. The Writer can not be reused after Close.

func (*ZstdWriter) Reset

func (zw *ZstdWriter) Reset()

Reset closes the Writer, flushing any unwritten data to the underlying io.Writer. but does not close the underlying io.Writer. The Writer can not be reused after Reset.

func (*ZstdWriter) Write

func (zw *ZstdWriter) Write(p []byte) (n int, err error)

Write compresses data and writes it to the underlying io.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL