dio

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 int32

CompressionType is the type of the compression.

const (
	// NoCompression is the CompressionType value used to indicate not to use
	// any compression.
	NoCompression CompressionType = iota
	// Snappy is the CompressionType value used to indicate that google snappy
	// is used for data compression.
	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.

func (*Compressor) Close

func (c *Compressor) Close() error

Close closes the compressor.

func (*Compressor) Write

func (c *Compressor) Write(data []byte) (int, error)

Write compresses the input data and writes to the underlying 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.

func (*CountedWriter) Write

func (cw *CountedWriter) Write(data []byte) (int, error)

Write writes the specified content to 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.

func (*Decompressor) Close

func (dc *Decompressor) Close() error

Close closes the decompressor.

func (*Decompressor) Read

func (dc *Decompressor) Read(data []byte) (int, error)

Read reads from the underlying reader.

Jump to

Keyboard shortcuts

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