io

package
v2.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pipe

func Pipe(reader Reader, writer Writer) error

func PipeUntilEOF

func PipeUntilEOF(reader Reader, writer Writer) error

Types

type AdaptiveReader

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

AdaptiveReader is a Reader that adjusts its reading speed automatically.

func NewAdaptiveReader

func NewAdaptiveReader(reader io.Reader) *AdaptiveReader

NewAdaptiveReader creates a new AdaptiveReader. The AdaptiveReader instance doesn't take the ownership of reader.

func (*AdaptiveReader) Read

func (v *AdaptiveReader) Read() (*alloc.Buffer, error)

Read implements Reader.Read().

func (*AdaptiveReader) Release

func (v *AdaptiveReader) Release()

type AdaptiveWriter

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

AdaptiveWriter is a Writer that writes alloc.Buffer into underlying writer.

func NewAdaptiveWriter

func NewAdaptiveWriter(writer io.Writer) *AdaptiveWriter

NewAdaptiveWriter creates a new AdaptiveWriter.

func (*AdaptiveWriter) Release

func (v *AdaptiveWriter) Release()

func (*AdaptiveWriter) Write

func (v *AdaptiveWriter) Write(buffer *alloc.Buffer) error

Write implements Writer.Write(). Write() takes ownership of the given buffer.

type BufferedReader

type BufferedReader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBufferedReader

func NewBufferedReader(rawReader io.Reader) *BufferedReader

func (*BufferedReader) Cached

func (v *BufferedReader) Cached() bool

func (*BufferedReader) Read

func (v *BufferedReader) Read(b []byte) (int, error)

func (*BufferedReader) Release

func (v *BufferedReader) Release()

func (*BufferedReader) SetCached

func (v *BufferedReader) SetCached(cached bool)

type BufferedWriter

type BufferedWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBufferedWriter

func NewBufferedWriter(rawWriter io.Writer) *BufferedWriter

func (*BufferedWriter) Cached

func (v *BufferedWriter) Cached() bool

func (*BufferedWriter) Flush

func (v *BufferedWriter) Flush() error

func (*BufferedWriter) FlushWithoutLock

func (v *BufferedWriter) FlushWithoutLock() error

func (*BufferedWriter) ReadFrom

func (v *BufferedWriter) ReadFrom(reader io.Reader) (int64, error)

func (*BufferedWriter) Release

func (v *BufferedWriter) Release()

func (*BufferedWriter) SetCached

func (v *BufferedWriter) SetCached(cached bool)

func (*BufferedWriter) Write

func (v *BufferedWriter) Write(b []byte) (int, error)

type ChainWriter

type ChainWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewChainWriter

func NewChainWriter(writer Writer) *ChainWriter

func (*ChainWriter) Release

func (v *ChainWriter) Release()

func (*ChainWriter) Write

func (v *ChainWriter) Write(payload []byte) (int, error)

type ChanReader

type ChanReader struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewChanReader

func NewChanReader(stream Reader) *ChanReader

func (*ChanReader) Fill

func (v *ChanReader) Fill()

Private: Visible for testing.

func (*ChanReader) Read

func (v *ChanReader) Read(b []byte) (int, error)

func (*ChanReader) Release

func (v *ChanReader) Release()

type Reader

type Reader interface {
	common.Releasable
	// Read reads content from underlying reader, and put it into an alloc.Buffer.
	Read() (*alloc.Buffer, error)
}

Reader extends io.Reader with alloc.Buffer.

type Writer

type Writer interface {
	common.Releasable
	// Write writes an alloc.Buffer into underlying writer.
	Write(*alloc.Buffer) error
}

Writer extends io.Writer with alloc.Buffer.

Jump to

Keyboard shortcuts

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