xio

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockWriter

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

BlockWriter writes data in fixed-size blocks to block-oriented devices such as tape drives.

func NewBlockWriter

func NewBlockWriter(writer io.Writer, blockSize int) *BlockWriter

NewBlockWriter creates a new BlockWriter with writer as the underlying write target. Parameter blockSize specifies the size of each data block to be written, must be > 0.

func (*BlockWriter) Finalize

func (r *BlockWriter) Finalize() (n int, err error)

func (*BlockWriter) Write

func (r *BlockWriter) Write(p []byte) (n int, err error)

Appends p to BlockWriter's internal buffer buf, then writes len(buf)/blocksize blocks of data to the wrapped Writer. The remaining data will be kept in the internal buffer until a new Write call appends enough data to write a block or Finalize() is called.

Parameter n returns the amount of bytes written to the internal buffer. If an error occurs while writing a block, Write() will return a non-nil err. Write will panic if called again after an error occured.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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