compress

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Default alias GzipInstance
	Default    = GzipInstance
	Compress   = Default().Compress
	Decompress = Default().Decompress
)

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	Compress(dst io.Writer, src []byte) (err error)
	Decompress(dst io.Writer, src []byte) (err error)
}

Compressor represents compress interface

type CompressorProvider

type CompressorProvider interface {
	// AcquireGzipWriter Returns a *gzip.Writer which needs to be released later.
	// Before using it, call Reset().
	AcquireGzipWriter() *gzip.Writer

	// ReleaseGzipWriter Releases an acquired *gzip.Writer.
	ReleaseGzipWriter(w *gzip.Writer)

	// AcquireGzipReader Returns a *gzip.Reader which needs to be released later.
	AcquireGzipReader() *gzip.Reader

	// ReleaseGzipReader Releases an acquired *gzip.Reader.
	ReleaseGzipReader(r *gzip.Reader)
}

CompressorProvider describes a component that can provider compressors for the std methods.

func CurrentCompressorProvider

func CurrentCompressorProvider() CompressorProvider

CurrentCompressorProvider returns the current CompressorProvider. It is initialized using a SyncPoolCompressors.

type GzipCompressor

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

func GzipInstance

func GzipInstance() *GzipCompressor

func (*GzipCompressor) Compress

func (c *GzipCompressor) Compress(dst io.Writer, src []byte) (err error)

func (*GzipCompressor) Decompress

func (c *GzipCompressor) Decompress(dst io.Writer, src []byte) (err error)

type SyncPoolCompressors

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

func NewSyncPoolCompressors

func NewSyncPoolCompressors() *SyncPoolCompressors

func (*SyncPoolCompressors) AcquireGzipReader

func (s *SyncPoolCompressors) AcquireGzipReader() *gzip.Reader

func (*SyncPoolCompressors) AcquireGzipWriter

func (s *SyncPoolCompressors) AcquireGzipWriter() *gzip.Writer

func (*SyncPoolCompressors) ReleaseGzipReader

func (s *SyncPoolCompressors) ReleaseGzipReader(r *gzip.Reader)

func (*SyncPoolCompressors) ReleaseGzipWriter

func (s *SyncPoolCompressors) ReleaseGzipWriter(w *gzip.Writer)

Jump to

Keyboard shortcuts

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