data

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2017 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TmpDir = ""

TmpDir is the location for temporary files

Functions

This section is empty.

Types

type Stream

type Stream interface {
	Mimetype() string
	NewReader() (io.ReadCloser, error)
}

Stream is an object which produces readers from which to obtain data

func FromByteArray

func FromByteArray(data []byte, mimetype string) Stream

FromByteArray return a new stream from a byte object

func FromURL

func FromURL(url string) (s Stream, err error)

FromURL return a new stream from a http resource

type StreamBuffer

type StreamBuffer struct {
	*sync.Cond
	// contains filtered or unexported fields
}

StreamBuffer is a buffer with a file as its underlying buffer

func NewStreamBuffer

func NewStreamBuffer(prefix string) (s *StreamBuffer, err error)

NewStreamBuffer returns a new stream buffer

func (*StreamBuffer) Cleanup

func (mb *StreamBuffer) Cleanup() error

Cleanup removes the temporary file

func (*StreamBuffer) Close

func (mb *StreamBuffer) Close() (err error)

Close closes the stream. No new readers allowed

func (*StreamBuffer) File

func (mb *StreamBuffer) File() *os.File

File returns the underlying data file

func (*StreamBuffer) Lock

func (mb *StreamBuffer) Lock()

Lock locks the data stream for manipulation

func (*StreamBuffer) NewReader

func (mb *StreamBuffer) NewReader() (io.ReadCloser, error)

NewReader returns a new reader to the buffer

func (*StreamBuffer) Terminate

func (mb *StreamBuffer) Terminate() (err error)

Terminate ends the stream and allows no more readers

func (*StreamBuffer) Unlock

func (mb *StreamBuffer) Unlock()

Unlock unlocks the data stream

func (*StreamBuffer) Write

func (mb *StreamBuffer) Write(b []byte) (n int, err error)

Write write data to the buffer

type StreamEndError

type StreamEndError struct{}

StreamEndError is returned when the stream has ended

func (*StreamEndError) Error

func (*StreamEndError) Error() string

type StreamReader

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

StreamReader is a thread safe reader which reads from a stream buffer

func (*StreamReader) Close

func (sr *StreamReader) Close() error

Close closes the underlying file

func (*StreamReader) Read

func (sr *StreamReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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