ampcodec

package
v4.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEncoderClosed = errors.New("encoder is already closed")
)

Functions

func NewDecoder

func NewDecoder(r io.Reader) (io.ReadCloser, error)

NewDecoder extracts payload from an AMP page body r.

func NopCloser

func NopCloser(w io.Writer) io.WriteCloser

Types

type Encoder

type Encoder struct {

	// UseOldBoilerplate sets Encoder to write
	// deprecated AMP boilerplate. As it's much shorter
	// than the new one, one may benefit from using it
	// to save some bandwidth.
	// Note that it may stop working in future.
	UseOldBoilerplate bool
	// contains filtered or unexported fields
}

Encoder is an instance of AMP HTML encoder.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Close

func (enc *Encoder) Close() (err error)

Close signals Encoder that there will be no data so it may write trailer.

func (*Encoder) Write

func (enc *Encoder) Write(p []byte) (n int, err error)

type PaddingWriter

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

PaddingWriter in an io.WriteCloser wrapper which inserts pads each step.

func NewPaddingWriter

func NewPaddingWriter(w io.WriteCloser, pad string, step int) *PaddingWriter

NewPaddingWriter creates a PaddingWriter which writes pad each step bytes.

func (*PaddingWriter) Close

func (pw *PaddingWriter) Close() error

Close closes underlying io.WriteCloser. It's an error to Write after Close.

func (*PaddingWriter) Write

func (pw *PaddingWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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