shrink

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeflateStreamShrinker

type DeflateStreamShrinker struct {
}

DeflateStreamShrinker is a Shrinker compatible struct that uses deflate compression.

func (*DeflateStreamShrinker) Compress

func (b *DeflateStreamShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*DeflateStreamShrinker) Decompressor

func (b *DeflateStreamShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*DeflateStreamShrinker) Header

func (b *DeflateStreamShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*DeflateStreamShrinker) IsReaderWithError

func (b *DeflateStreamShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*DeflateStreamShrinker) IsStream

func (b *DeflateStreamShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*DeflateStreamShrinker) Name

func (b *DeflateStreamShrinker) Name() string

Name returns a simple name for this module.

func (*DeflateStreamShrinker) Reader

func (b *DeflateStreamShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*DeflateStreamShrinker) ReaderWithError

func (b *DeflateStreamShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

type GzipStreamShrinker

type GzipStreamShrinker struct {
}

GzipStreamShrinker is a Shrinker compatible struct that uses gzip compression.

func (*GzipStreamShrinker) Compress

func (b *GzipStreamShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*GzipStreamShrinker) Decompressor

func (b *GzipStreamShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*GzipStreamShrinker) Header

func (b *GzipStreamShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*GzipStreamShrinker) IsReaderWithError

func (b *GzipStreamShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*GzipStreamShrinker) IsStream

func (b *GzipStreamShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*GzipStreamShrinker) Name

func (b *GzipStreamShrinker) Name() string

Name returns a simple name for this module.

func (*GzipStreamShrinker) Reader

func (b *GzipStreamShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*GzipStreamShrinker) ReaderWithError

func (b *GzipStreamShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()`.

type LzwStreamShrinker

type LzwStreamShrinker struct {
}

LzwStreamShrinker is a Shrinker compatible struct that uses lzw compression.

func (*LzwStreamShrinker) Compress

func (b *LzwStreamShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*LzwStreamShrinker) Decompressor

func (b *LzwStreamShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*LzwStreamShrinker) Header

func (b *LzwStreamShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*LzwStreamShrinker) IsReaderWithError

func (b *LzwStreamShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*LzwStreamShrinker) IsStream

func (b *LzwStreamShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*LzwStreamShrinker) Name

func (b *LzwStreamShrinker) Name() string

Name returns a simple name for this module.

func (*LzwStreamShrinker) Reader

func (b *LzwStreamShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*LzwStreamShrinker) ReaderWithError

func (b *LzwStreamShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

type NoShrinker

type NoShrinker struct {
}

NoShrinker is a Shrinker compatible struct that uses no compression.

func (*NoShrinker) Compress

func (b *NoShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*NoShrinker) Decompressor

func (b *NoShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*NoShrinker) Header

func (b *NoShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*NoShrinker) IsReaderWithError

func (b *NoShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*NoShrinker) IsStream

func (b *NoShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*NoShrinker) Name

func (b *NoShrinker) Name() string

Name returns a simple name for this module.

func (*NoShrinker) Reader

func (b *NoShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*NoShrinker) ReaderWithError

func (b *NoShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

type Shrinker

type Shrinker interface {
	Name() string
	Compress(file goembed.File) ([]jen.Code, error)
	Header() []jen.Code
	Decompressor() []jen.Code
	IsStream() bool
	IsReaderWithError() bool
	Reader(params ...jen.Code) jen.Code
	ReaderWithError(params ...jen.Code) jen.Code
}

Shrinker is the interface that provides a compression method for the data.

func NewDeflateStreamShrinker

func NewDeflateStreamShrinker() Shrinker

NewDeflateStreamShrinker returns a Shrinker compatible class that uses deflate compression.

func NewGzipStreamShrinker

func NewGzipStreamShrinker() Shrinker

NewGzipStreamShrinker returns a Shrinker compatible class that uses gzip compression.

func NewLzwStreamShrinker

func NewLzwStreamShrinker() Shrinker

NewLzwStreamShrinker returns a Shrinker compatible class that uses lzw compression.

func NewNoShrinker

func NewNoShrinker() Shrinker

NewNoShrinker returns a Shrinker compatible class that uses no compression.

func NewSnappyShrinker

func NewSnappyShrinker() Shrinker

NewSnappyShrinker returns a Shrinker compatible class that uses snappy compression.

func NewSnappyStreamShrinker

func NewSnappyStreamShrinker() Shrinker

NewSnappyStreamShrinker returns a Shrinker compatible class that uses snappy compression.

func NewZlibStreamShrinker

func NewZlibStreamShrinker() Shrinker

NewZlibStreamShrinker returns a Shrinker compatible class that uses zlib compression.

type SnappyShrinker

type SnappyShrinker struct {
}

SnappyShrinker is a Shrinker compatible struct that uses snappy compression.

func (*SnappyShrinker) Compress

func (b *SnappyShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*SnappyShrinker) Decompressor

func (b *SnappyShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*SnappyShrinker) Header

func (b *SnappyShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*SnappyShrinker) IsReaderWithError

func (b *SnappyShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*SnappyShrinker) IsStream

func (b *SnappyShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*SnappyShrinker) Name

func (b *SnappyShrinker) Name() string

Name returns a simple name for this module.

func (*SnappyShrinker) Reader

func (b *SnappyShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*SnappyShrinker) ReaderWithError

func (b *SnappyShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

type SnappyStreamShrinker

type SnappyStreamShrinker struct {
}

SnappyStreamShrinker is a Shrinker compatible struct that uses snappy compression.

func (*SnappyStreamShrinker) Compress

func (b *SnappyStreamShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*SnappyStreamShrinker) Decompressor

func (b *SnappyStreamShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*SnappyStreamShrinker) Header

func (b *SnappyStreamShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*SnappyStreamShrinker) IsReaderWithError

func (b *SnappyStreamShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*SnappyStreamShrinker) IsStream

func (b *SnappyStreamShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*SnappyStreamShrinker) Name

func (b *SnappyStreamShrinker) Name() string

Name returns a simple name for this module.

func (*SnappyStreamShrinker) Reader

func (b *SnappyStreamShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*SnappyStreamShrinker) ReaderWithError

func (b *SnappyStreamShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

type ZlibStreamShrinker

type ZlibStreamShrinker struct {
}

ZlibStreamShrinker is a Shrinker compatible struct that uses zlib compression.

func (*ZlibStreamShrinker) Compress

func (b *ZlibStreamShrinker) Compress(file goembed.File) ([]jen.Code, error)

Compress returns a byte array of compressed file data.

func (*ZlibStreamShrinker) Decompressor

func (b *ZlibStreamShrinker) Decompressor() []jen.Code

Decompressor returns the body code for the `decode(input)` function.

func (*ZlibStreamShrinker) Header

func (b *ZlibStreamShrinker) Header() []jen.Code

Header returns additional code that is inserted in the body.

func (*ZlibStreamShrinker) IsReaderWithError

func (b *ZlibStreamShrinker) IsReaderWithError() bool

IsReaderWithError returns true if the shrinker uses a reader that also can error.

func (*ZlibStreamShrinker) IsStream

func (b *ZlibStreamShrinker) IsStream() bool

IsStream returns true if the shrinker works on streams instead of byte slices.

func (*ZlibStreamShrinker) Name

func (b *ZlibStreamShrinker) Name() string

Name returns a simple name for this module.

func (*ZlibStreamShrinker) Reader

func (b *ZlibStreamShrinker) Reader(params ...jen.Code) jen.Code

Reader returns the stream handler for the byte stream used when returning `Open()`.

func (*ZlibStreamShrinker) ReaderWithError

func (b *ZlibStreamShrinker) ReaderWithError(params ...jen.Code) jen.Code

ReaderWithError returns the stream handler for the byte stream used when returning `Open()` but also returns an error.

Jump to

Keyboard shortcuts

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