Documentation ¶
Index ¶
- func Write(target io.WriteSeeker, source chunk.Provider) error
- type BlockWriter
- type FragmentedChunkWriter
- type Reader
- type Writer
- func (writer *Writer) CreateChunk(id chunk.Identifier, contentType chunk.ContentType, compressed bool) (*BlockWriter, error)
- func (writer *Writer) CreateFragmentedChunk(id chunk.Identifier, contentType chunk.ContentType, compressed bool) (*FragmentedChunkWriter, error)
- func (writer *Writer) Finish() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockWriter ¶
type BlockWriter struct {
// contains filtered or unexported fields
}
BlockWriter is for writing data of a single block in a chunk.
type FragmentedChunkWriter ¶
type FragmentedChunkWriter struct {
// contains filtered or unexported fields
}
FragmentedChunkWriter writes a chunk with zero, one, or more blocks. Multiple blocks can be created and then written concurrently. Only when the chunk is finished, the blocks are finalized.
func (*FragmentedChunkWriter) CreateBlock ¶
func (writer *FragmentedChunkWriter) CreateBlock() *BlockWriter
CreateBlock provides a new, dedicated writer for a new block.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader provides methods to extract resource data from a serialized form. Chunks may be accessed out of sequence due to the nature of the underlying io.ReaderAt.
func ReaderFrom ¶
ReaderFrom accesses the provided source and creates a new Reader instance from it. Should the provided decoder not follow the resource file format, an error is returned.
func (*Reader) Chunk ¶
Chunk returns a reader for the specified chunk. An error is returned if either the ID is not known, or the chunk could not be prepared.
func (*Reader) IDs ¶
func (reader *Reader) IDs() []chunk.Identifier
IDs returns the chunk identifier available via this reader. The order in the slice is the same as in the underlying serialized form.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer provides methods to write a new resource file from scratch. Chunks have to be created sequentially. The writer does not support concurrent creation and modification of chunks.
func NewWriter ¶
func NewWriter(target io.WriteSeeker) (*Writer, error)
NewWriter returns a new Writer instance prepared to add chunks. To finalize the created file, call Finish().
This function will write initial information to the target and will return an error if the writer did. In such a case, the returned writer instance will produce invalid results and the state of the target is undefined.
func (*Writer) CreateChunk ¶
func (writer *Writer) CreateChunk(id chunk.Identifier, contentType chunk.ContentType, compressed bool) (*BlockWriter, error)
CreateChunk adds a new single-block chunk to the current resource file. This chunk is closed by creating another chunk, or by finishing the writer.
func (*Writer) CreateFragmentedChunk ¶
func (writer *Writer) CreateFragmentedChunk(id chunk.Identifier, contentType chunk.ContentType, compressed bool) (*FragmentedChunkWriter, error)
CreateFragmentedChunk adds a new fragmented chunk to the current resource file. This chunk is closed by creating another chunk, or by finishing the writer.