compresser

package
v0.0.0-...-e48e1df Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicByte = 0x4742434d
	ChunkSize = 8
)

Variables

View Source
var (
	BitMaskLUT = []uint8{
		0b00000001,
		0b00000010,
		0b00000100,
		0b00001000,
		0b00010000,
		0b00100000,
		0b01000000,
		0b10000000,
	}
)

Functions

func IsAllBytesZero

func IsAllBytesZero(data []byte) bool

Types

type CompressedFile

type CompressedFile interface {
	io.ReadWriteSeeker
	io.Closer
}

func Create

func Create(name string, blockSize uint32, fileSize uint64) (CompressedFile, error)

type Core

type Core struct {
	Magic     uint32 // Magic byte
	BlockSize uint32 // Block Size
	FSSize    uint64 // DeCompressedFile Size
	MapSize   uint64 // CompressedMap Size
	Size      uint64 // CompressedFile Size ignore Header
}

type File

type File struct {
	Header Header

	os.File
	// contains filtered or unexported fields
}

func NewCompressedFile

func NewCompressedFile(f *os.File) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) Read

func (f *File) Read(buf []byte) (int, error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Write

func (f *File) Write(buf []byte) (int, error)
type Header struct {
	Core            Core
	CompressedTable []Node // All zero block is 1, other 0
}

type Node

type Node struct {
	PrePopCount   uint64
	CompressedMap uint8
}

Jump to

Keyboard shortcuts

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