Documentation ¶
Index ¶
- func CompressSnappyBlock(src []byte, dst []byte) int
- func DecompressSnappyBlock(src []byte, dst []byte) error
- func MaxBlockLen(ct CompressionType) uint64
- func MaxEncodedLen(ct CompressionType, srcLen uint64) (uint64, bool)
- func NewCompressor(ct CompressionType, wc io.WriteCloser) io.WriteCloser
- func NewDecompressor(ct CompressionType, r io.ReadCloser) io.ReadCloser
- type CompressionType
- type Compressor
- type CountedWriter
- type Decompressor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressSnappyBlock ¶
CompressSnappyBlock compresses the src block using snappy and store the compressed block into dst. The length of the compressed block is returned.
func DecompressSnappyBlock ¶
DecompressSnappyBlock decompresses the snappy compressed data in src to the dst slice. The dst slice must be of the exact length of the uncompressed data.
func MaxBlockLen ¶
func MaxBlockLen(ct CompressionType) uint64
MaxBlockLen returns the maximum length allowed for specified compression type.
func MaxEncodedLen ¶
func MaxEncodedLen(ct CompressionType, srcLen uint64) (uint64, bool)
MaxEncodedLen returns the maximum length of the encoded block given the specified compression type and src length.
func NewCompressor ¶
func NewCompressor(ct CompressionType, wc io.WriteCloser) io.WriteCloser
NewCompressor returns a Compressor instance.
func NewDecompressor ¶
func NewDecompressor(ct CompressionType, r io.ReadCloser) io.ReadCloser
NewDecompressor return a decompressor instance.
Types ¶
type CompressionType ¶
type CompressionType = pb.CompressionType
CompressionType is the type of the compression.
const ( // NoCompression is the CompressionType value used to indicate not to use // any compression. NoCompression CompressionType = pb.NoCompression // Snappy is the CompressionType value used to indicate that google snappy // is used for data compression. Snappy CompressionType = pb.Snappy )
type Compressor ¶
type Compressor struct {
// contains filtered or unexported fields
}
Compressor is a io.WriteCloser that compresses its input data to its underlying io.Writer.
type CountedWriter ¶
type CountedWriter struct {
// contains filtered or unexported fields
}
CountedWriter is a io.WriteCloser wrapper that keeps the total number of bytes written to the underlying writer.
func NewCountedWriter ¶
func NewCountedWriter(w io.WriteCloser) *CountedWriter
NewCountedWriter creates a new CountedWriter.
func (*CountedWriter) BytesWritten ¶
func (cw *CountedWriter) BytesWritten() uint64
BytesWritten returns the total number of bytes written.
func (*CountedWriter) Close ¶
func (cw *CountedWriter) Close() error
Close closes the underlying writer.
type Decompressor ¶
type Decompressor struct {
// contains filtered or unexported fields
}
Decompressor is a io.WriteCloser that decompresses data read from its underlying reader.