bzip2

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

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

Go to latest
Published: Apr 5, 2016 License: MIT Imports: 13 Imported by: 2

README

bzip2

GoDoc

Package bzip2 implements reading and writing of bzip2 format compressed files.

Currently this focuses on the writer since compress/bzip2 doesn't include one.

Hopefully this will be eventually merged into the standard library without any changes on the users part.

Notes

References used to write the writer since there's no specification:

Install

go get github.com/larzconwell/bzip2

License

MIT licensed, see here

Documentation

Overview

Package bzip2 implements reading and writing of bzip2 format compressed files.

Index

Constants

View Source
const (
	BestSpeed       = flate.BestSpeed
	BestCompression = flate.BestCompression
)

These constants are copied from the flate package, so that code does not also have to import "compress/flate".

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer is an io.WriteCloser. Writes to a Writer are compressed and written to an underlying io.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer. Writes to the returned writer are compressed and written to w.

It is the caller's responsibility to call Close on the Writer when done. Writes may be buffered and not flushed until Close.

func NewWriterLevel

func NewWriterLevel(w io.Writer, level int) (*Writer, error)

NewWriterLevel is like NewWriter but specifies the compression level.

The levels range from 1 (BestSpeed) to 9 (BestCompression); higher levels typically run slower but compress more.

If level is in the range [1, 9] then the error returned will be nil. Otherwise the error returned will be non-nil.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the Writer, flushing any unwritten data to the underlying io.Writer, but does not close the underlying io.Writer.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush flushes any pending compressed data to the underlying writer.

func (*Writer) Reset

func (w *Writer) Reset(dst io.Writer)

Reset discards the state of Writer and makes it equivalent to the result of NewWriter or NewWriterLevel, but writing to dst instead.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Write writes a compressed form of p to the underlying io.Writer. The compressed bytes are not necessarily flushed until the Writer is closed.

Directories

Path Synopsis
internal
bits
Package bits provides access to read and write values bit-by-bit.
Package bits provides access to read and write values bit-by-bit.
bwt
Package bwt implements the Burrows-Wheeler Transform.
Package bwt implements the Burrows-Wheeler Transform.
crc32
Package crc32 implements the IEEE CRC-32 checksum.
Package crc32 implements the IEEE CRC-32 checksum.
huffman
Package huffman implements Huffman prefix coding.
Package huffman implements Huffman prefix coding.
mtf
Package mtf implements the move-to-front transform.
Package mtf implements the move-to-front transform.
rle
Package rle implements a form of run-length encoding.
Package rle implements a form of run-length encoding.
rle2
Package rle2 implements a form of run-length encoding.
Package rle2 implements a form of run-length encoding.
symbols
Package symbols contains routines to manage symbols for contents.
Package symbols contains routines to manage symbols for contents.
testhelpers
Package testhelpers provides helpers used in all the tests.
Package testhelpers provides helpers used in all the tests.

Jump to

Keyboard shortcuts

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