lz

package
v0.0.0-...-5787e7a Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Opening   = "<"
	Closing   = ">"
	Separator = ","
)
View Source
const DefaultWindowSize = 4096
View Source
const EncodedOpening = 0xff
View Source
const EscapeByte = 0x5c
View Source
const MinimumSizeOfReference int = -1 // Use -1 to represent dynamic "smart" reference inclusion

Variables

This section is empty.

Functions

func Compress

func Compress(fileContents []byte, useProgressBar bool, maxSearchBufferLength int) []byte

Compress is the original LZSS compress function which takes a slice of bytes and some options and returns the compressed representation. This function is the most performant of the three implementations, I suspect because of the iterative nature, however the code is not very clean so be weary.

func CompressAsync

func CompressAsync(fileContents []byte, useProgressBar bool, maxSearchBufferLength int) []byte

CompressAsync is similar to Compress except that it uses goroutines to run as multi-threaded as possible

func CompressRecursive

func CompressRecursive(fileContents []byte, _ bool, maxSearchBufferLength int) []byte

CompressRecursive exists to substitute the Compress function with better performance and simplicity from recursion. However, this implementation yields slower results than the base Compress function so should generally be unused. This remains purely as a reference for understanding the algorithm. This should not be used as there are issues with data loss with large content streams.

func DecodeOpeningSymbols

func DecodeOpeningSymbols(bytes []byte) []byte

func Decompress

func Decompress(fileContents []byte, useProgressBar bool) []byte

Decompress decompressed the file contents and returns the decompressed contents as a slice of bytes

func EncodeOpeningSymbols

func EncodeOpeningSymbols(bytes []byte) []byte

func FindReverse

func FindReverse(slice []byte, val byte) (int, bool)

func FindReverseSlice

func FindReverseSlice(input []byte, val []byte) (int, bool)

func FindSequential

func FindSequential(slice []byte, val byte) (int, bool)

func NewReader

func NewReader(r io.Reader) io.Reader

func NewWriter

func NewWriter(w io.Writer) io.WriteCloser

func SortByteArray

func SortByteArray(src []byte)

Types

type Reader

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

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Read

func (r *Reader) Read(content []byte) (n int, err error)

type Reference

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

type Writer

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

func NewWriterLevel

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

func (*Writer) Close

func (writer *Writer) Close() error

func (*Writer) Write

func (writer *Writer) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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