zwrap

package
v0.0.0-...-160f2ba Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FpGzip

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

func Wrap

func Wrap(fp io.ReadCloser) (*FpGzip, error)

Wrap takes a source like a file pointer or http stream and wraps it so the correct Close and Read will be called. Although we use the name fp, it should be happy if it is fed an http stream.

func WrapMaybe

func WrapMaybe(fpIn ReadSeekCloser) (*FpGzip, error)

WrapMaybe will decide if the underlying stream is compressed and wrap the file pointer if necessary. You do lose something. If you pass in something which can seek, you get back a ReadCloser which cannot seek. This is the price one pays for reading from a compressed reader.

func (*FpGzip) Close

func (fc *FpGzip) Close() error

Close closes the compressor, then the underlying backing readCloser. It should work if the source is a file or an http stream.

func (*FpGzip) Read

func (fc *FpGzip) Read(p []byte) (int, error)

Read makes sure we read from the compressed stream and not the underlying file stream.

type ReadSeekCloser

type ReadSeekCloser interface {
	io.Reader
	io.Seeker
	io.Closer
}

ReadSeekCloser does not seem to be in the standard library

Jump to

Keyboard shortcuts

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