transformfile

package module
v0.0.0-...-f65242f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	/* ErrInvalidSeek marks invalid seek operations	*/
	ErrInvalidSeek = fmt.Errorf("invalid argument")
)

Functions

func NewReadWriteSeeker

func NewReadWriteSeeker(
	blockSize int64,
	blockOverhead int,
	seeker io.Seeker,
	reader io.Reader,
	writer io.Writer,
) io.ReadWriteSeeker

NewReadWriteSeeker takes transforming readers and writers and wraps around a seeker

blockSize 			The size of a block of data
blockOverhead 		The amount of overhead in a block.
					blockSize + blockOverhead is the actual space used

Types

type File

type File interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
	io.Writer
	io.WriterAt
	Name() string
	Readdir(count int) ([]os.FileInfo, error)
	Readdirnames(n int) ([]string, error)
	Stat() (os.FileInfo, error)
	Sync() error
	Truncate(size int64) error
	WriteString(s string) (int, error)
}

File interface, compatible with normal files

func New

func New(
	blockSize int64,
	blockOverhead int,
	backing File,
	readOnly bool,
	reader io.Reader,
	writer io.Writer,
) File

New creates a file wrapper around a backing file, using a transforming reader and writer. The readers and writers used must write through directly to the backing file, applying transformations. They cannot buffer data internally as the writers/readers generated by the text.transform package. See NewFromTransformer() for a workaround.

func NewFromTransformer

func NewFromTransformer(
	blockSize int64,
	blockOverhead int,
	backing File,
	readOnly bool,
	readTransformer transform.Transformer,
	writeTransformer transform.Transformer,
) File

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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