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.