snappy

package
v0.0.0-...-6b0313b Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package snappy implements the snappy compressed data format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

func NewReader

func NewReader(r io.Reader) Reader

func (Reader) Read

func (s Reader) Read(p []byte) (n int, err error)

Read implements io.Reader, reading uncompressed bytes from its underlying Reader.

func (Reader) ReadByte

func (s Reader) ReadByte() (byte, error)

func (Reader) Reset

func (s Reader) Reset(r io.Reader)

Reset discards the Reader s's state and makes it equivalent to the result of its original state from NewReader, but reading from r instead. This permits reusing a Reader rather than allocating a new one.

type Writer

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

func NewWriter

func NewWriter(w io.Writer) Writer

func (Writer) Close

func (s Writer) Close() error

Close closes the Writer by flushing any unwritten data to the underlying io.Writer. It does not close the underlying io.Writer.

func (Writer) Flush

func (s Writer) Flush() error

Flush flushes any pending compressed data to the underlying writer.

It is useful mainly in compressed network protocols, to ensure that a remote reader has enough data to reconstruct a packet. Flush does not return until the data has been written. If the underlying writer returns an error, Flush returns that error.

func (Writer) Reset

func (s Writer) Reset(w io.Writer)

Reset discards the Writer s's state and makes it equivalent to the result of its original state from NewWriter, but writing to w instead. This permits reusing a Writer rather than allocating a new one.

func (Writer) Write

func (s 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.

Jump to

Keyboard shortcuts

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