decoder

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupported = errors.New("not supported")
View Source
var Registrations []Registration

Functions

This section is empty.

Types

type Bzip2Decoder

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

func (*Bzip2Decoder) Next

func (d *Bzip2Decoder) Next() (*Entry, error)

func (*Bzip2Decoder) Read

func (d *Bzip2Decoder) Read(p []byte) (int, error)

type Decoder

type Decoder interface {
	// Next will advance the container to the next entry and return its metadata
	Next() (*Entry, error)
	// Read is an io.Reader implementation on the current entry
	Read(p []byte) (int, error)
}

Decoder is an interface for decoding archive containers

func GetBzip2Decoder

func GetBzip2Decoder(filename string, reader *bufio.Reader) (Decoder, error)

func GetDecoder

func GetDecoder(filename string, reader *bufio.Reader) (Decoder, error)

GetDecoder will return the proper container decoder for a given reader

func GetGzDecoder

func GetGzDecoder(filename string, reader *bufio.Reader) (Decoder, error)

func GetTarDecoder

func GetTarDecoder(_ string, reader *bufio.Reader) (Decoder, error)

func GetZipDecoder

func GetZipDecoder(_ string, reader *bufio.Reader) (Decoder, error)

type Entry

type Entry struct {
	Type     string
	Filename string
}

func (Entry) IsDir

func (e Entry) IsDir() bool

func (Entry) IsFile

func (e Entry) IsFile() bool

type Getter

type Getter func(filename string, reader *bufio.Reader) (Decoder, error)

type GzDecoder

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

func (*GzDecoder) Next

func (d *GzDecoder) Next() (*Entry, error)

func (*GzDecoder) Read

func (d *GzDecoder) Read(p []byte) (int, error)

type Registration

type Registration struct {
	MatchFileHeader func(string, []byte) bool
	GetDecoder      Getter
}

type TarDecoder

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

func (*TarDecoder) Next

func (d *TarDecoder) Next() (*Entry, error)

func (*TarDecoder) Read

func (d *TarDecoder) Read(p []byte) (int, error)

type ZipDecoder

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

func (*ZipDecoder) Next

func (d *ZipDecoder) Next() (_ *Entry, err error)

func (*ZipDecoder) Read

func (d *ZipDecoder) Read(p []byte) (_ int, err error)

Jump to

Keyboard shortcuts

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