DZ

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Header offsets
	HeaderIDOffset        = 0
	HeaderReservedOffset  = 4
	HeaderLengthOffset    = 8
	HeaderLinkCountOffset = 16

	// Data section offsets
	DataOrgBlockTypeOffset  = 24
	DataZipTypeOffset       = 26
	DataReservedOffset      = 27
	DataZipParameterOffset  = 28
	DataOrgDataLengthOffset = 32
	DataLengthOffset        = 40
	DataOffset              = 48
)
View Source
const (
	// Sizes of fields in bytes
	HeaderIDSize        = 4
	HeaderReservedSize  = 4
	HeaderLengthSize    = 8
	HeaderLinkCountSize = 8

	DataOrgBlockTypeSize  = 2
	DataZipTypeSize       = 1
	DataReservedSize      = 1
	DataZipParameterSize  = 4
	DataOrgDataLengthSize = 8
	DataLengthSize        = 8
)

Variables

This section is empty.

Functions

func Deflate added in v1.1.3

func Deflate(data []byte) ([]byte, error)

Types

type Block

type Block struct {
	Header blocks.Header
	Data   Data
}

func New

func New(file *os.File, startAddress int64) (*Block, error)

func (*Block) BlankBlock

func (b *Block) BlankBlock() *Block

func (*Block) BlockType

func (b *Block) BlockType() string

ID original block ("DT", "SD", "RD" or "DV", "DI", "RV", "RI")

func (*Block) BlockTypeModified

func (b *Block) BlockTypeModified() string

ID modified block with `#` ("##DT", "##SD", "##RD" or "#D#V", "##DI", "##RV", "##RI")

func (*Block) NewCompressType

func (b *Block) NewCompressType() (ZipBlock, error)

func (*Block) Read

func (b *Block) Read() ([]byte, error)

Read returns the value inside of the block

type Data

type Data struct {
	//ID original block ("DT", "SD", "RD" or "DV", "DI", "RV", "RI")
	OrgBlockTyṕe [2]byte

	//Zip algorithm (Deflate or Transposition + Deflate)
	ZipType uint8

	Reserved [1]byte

	//Parameter for zip algorithm
	ZipParameter uint32

	//Data section's length
	OrgDataLenght uint64

	//Lenght stored in dz_data (bytes)
	DataLenght uint64

	//Stored value
	Data []byte
}

type Flate

type Flate struct {
	//Decompressed ID
	DecompressedID string

	//Zip algorithm (Deflate==0 or Transposition + Deflate==1)
	CompressType uint8

	//Decompressed size
	DecompressedLength uint64

	//Compressed size
	CompressedLength uint64

	//DataBlock
	Datablock *[]byte
}

func (*Flate) Decompress

func (f *Flate) Decompress() ([]byte, error)

type Transposition

type Transposition struct {
	//Decompressed ID
	DecompressedID string

	//Zip algorithm (Deflate or Transposition + Deflate)
	CompressType uint8

	//Decompressed size
	DecompressedLength uint64

	//Compressed size
	CompressedLength uint64

	//Parameter for transposition type (CompressType==1)
	Parameter uint32

	//DataBlock
	Datablock *[]byte
}

func (*Transposition) Decompress

func (t *Transposition) Decompress() ([]byte, error)

func (*Transposition) Transpose added in v1.1.3

func (t *Transposition) Transpose(rows uint64, cols uint64, data *[]byte)

Transpose applies traposition in the data block

type ZipBlock

type ZipBlock interface {
	Decompress() ([]byte, error)
}

Jump to

Keyboard shortcuts

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