compression

package
v0.0.0-...-e692288 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2013 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	AcceptEncoding() string
	ContentEncoding() string
	NewReader(io.Reader) (io.ReadCloser, error)
	NewWriter(io.Writer) (io.WriteCloser, error)
}

type DeflateCompressor

type DeflateCompressor struct {
	Level int
}

func NewDeflateCompressor

func NewDeflateCompressor(level int) *DeflateCompressor

func (*DeflateCompressor) AcceptEncoding

func (c *DeflateCompressor) AcceptEncoding() string

func (*DeflateCompressor) ContentEncoding

func (c *DeflateCompressor) ContentEncoding() string

func (*DeflateCompressor) NewReader

func (c *DeflateCompressor) NewReader(r io.Reader) (io.ReadCloser, error)

func (*DeflateCompressor) NewWriter

func (c *DeflateCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)

type GzipCompressor

type GzipCompressor struct{}

func NewGzipCompressor

func NewGzipCompressor() *GzipCompressor

func (*GzipCompressor) AcceptEncoding

func (c *GzipCompressor) AcceptEncoding() string

func (*GzipCompressor) ContentEncoding

func (c *GzipCompressor) ContentEncoding() string

func (*GzipCompressor) NewReader

func (c *GzipCompressor) NewReader(r io.Reader) (io.ReadCloser, error)

func (*GzipCompressor) NewWriter

func (c *GzipCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)

type Handler

type Handler struct {
	Compressors   map[string]Compressor
	Decompressors map[string]RequestDecompressor
	Compress      func(string, int) bool
}

func NewHandler

func NewHandler(compressors ...Compressor) *Handler

func (*Handler) Process

func (h *Handler) Process(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type RequestDecompressor

type RequestDecompressor interface {
	Compressor
	Decompress() bool
}

type SnappyCompressor

type SnappyCompressor struct{}

func NewSnappyCompressor

func NewSnappyCompressor() *SnappyCompressor

func (*SnappyCompressor) AcceptEncoding

func (c *SnappyCompressor) AcceptEncoding() string

func (*SnappyCompressor) ContentEncoding

func (c *SnappyCompressor) ContentEncoding() string

func (*SnappyCompressor) Decompress

func (c *SnappyCompressor) Decompress() bool

func (*SnappyCompressor) NewReader

func (c *SnappyCompressor) NewReader(r io.Reader) (io.ReadCloser, error)

func (*SnappyCompressor) NewWriter

func (c *SnappyCompressor) NewWriter(w io.Writer) (io.WriteCloser, error)

Jump to

Keyboard shortcuts

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