libsqsh v1.5.2
Loading...
Searching...
No Matches
SqshFileReader Struct Reference

A reader over the contents of a file. More...

#include <sqsh_file_private.h>

Public Member Functions

struct SqshFileReadersqsh_file_reader_new (const struct SqshFile *file, int *err)
 Initializes a SqshFileReader struct.
 
int sqsh_file_reader_advance (struct SqshFileReader *reader, sqsh_index_t offset, size_t size)
 Advances the file reader by a certain amount of data and presents size bytes of data to the user.
 
int sqsh_file_reader_advance2 (struct SqshFileReader *reader, uint64_t offset, size_t size)
 Advances the file reader by a certain amount of data and presents size bytes of data to the user.
 
const uint8_t * sqsh_file_reader_data (const struct SqshFileReader *reader)
 Gets a pointer to the current data in the file reader.
 
size_t sqsh_file_reader_size (const struct SqshFileReader *reader)
 Gets the size of the current data in the file reader.
 
int sqsh_file_reader_free (struct SqshFileReader *reader)
 Cleans up resources used by a SqshFileReader struct.
 

Detailed Description

A reader over the contents of a file.

Definition at line 174 of file sqsh_file_private.h.

Member Function Documentation

◆ sqsh_file_reader_advance()

int sqsh_file_reader_advance ( struct SqshFileReader * reader,
sqsh_index_t offset,
size_t size )

Advances the file reader by a certain amount of data and presents size bytes of data to the user.

Deprecated
Since 1.5.0. Use sqsh_file_reader_advance2() instead.
Parameters
[in,out]readerThe file reader to skip data in.
[in]offsetThe offset to skip.
[in]sizeThe size of the data to skip.
Returns
0 on success, less than 0 on error.

◆ sqsh_file_reader_advance2()

int sqsh_file_reader_advance2 ( struct SqshFileReader * reader,
uint64_t offset,
size_t size )

Advances the file reader by a certain amount of data and presents size bytes of data to the user.

Parameters
[in,out]readerThe file reader to skip data in.
[in]offsetThe offset to skip.
[in]sizeThe size of the data to skip.
Returns
0 on success, less than 0 on error.

◆ sqsh_file_reader_data()

const uint8_t * sqsh_file_reader_data ( const struct SqshFileReader * reader)

Gets a pointer to the current data in the file reader.

Parameters
[in]readerThe file reader to get data from.
Returns
A pointer to the current data in the file reader.

◆ sqsh_file_reader_free()

int sqsh_file_reader_free ( struct SqshFileReader * reader)

Cleans up resources used by a SqshFileReader struct.

Parameters
[in,out]readerThe file reader struct to clean up.
Returns
0 on success, less than 0 on error.

◆ sqsh_file_reader_new()

struct SqshFileReader * sqsh_file_reader_new ( const struct SqshFile * file,
int * err )

Initializes a SqshFileReader struct.

Parameters
[in]fileThe file context to retrieve the file contents from.
[out]errPointer to an int where the error code will be stored.
Returns
a new file reader.

◆ sqsh_file_reader_size()

size_t sqsh_file_reader_size ( const struct SqshFileReader * reader)

Gets the size of the current data in the file reader.

Parameters
[in]readerThe file reader to get data from.
Returns
The size of the current data in the file reader.

The documentation for this struct was generated from the following files: