---
name: "zipios_BackBuffer"
section: "3"
platform: "linux"
package: "libzipios++-dev"
version: "0.1.5.9+cvs.2007.04.28-6"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/zipios_BackBuffer"
---

# zipios\_BackBuffer(3)

A BackBuffer instance is useful for reading the last part of a file in an efficient manner, when it is not known exactly how far back (towards the front!) to go, to find the start of the desired data block.

## NAME

zipios::BackBuffer - A **BackBuffer** instance is useful for reading the last part of a file in an efficient manner, when it is not known exactly how far back (towards the front!) to go, to find the start of the desired data block.

## SYNOPSIS

`#include <backbuffer.h>`

Inherits vector\< unsigned char \>.

### Public Member Functions

**BackBuffer** (istream &is, **VirtualSeeker** vs=**VirtualSeeker**(), int chunk\_size=1024)\
 **BackBuffer** *constructor.*  int **readChunk** (int &read\_pointer)\
 *Reads another chunk and returns the size of the chunk that has been read.*

## Detailed Description

A **BackBuffer** instance is useful for reading the last part of a file in an efficient manner, when it is not known exactly how far back (towards the front!) to go, to find the start of the desired data block.

**BackBuffer** is a vector\< unsigned char \> that fills itself with data from a file by reading chunks from the end of the file progressing towards the start. Upon construction the **BackBuffer** instance is associated with a file and a chunksize can be specified. To read a chunk of the file into the **BackBuffer** call **readChunk()**.

Definition at line 32 of file backbuffer.h.

## Constructor & Destructor Documentation

### zipios::BackBuffer::BackBuffer (istream & is, VirtualSeeker vs = VirtualSeeker`()`, int chunk\_size = `1024`)` [inline]`, ` [explicit]`

**BackBuffer** constructor.

**Parameters:**

*is* The istream to read the data from. The stream must be seekable, as **BackBuffer** will reposition the file position to read chunks from the back of the file. \
 *chunk\_size* specifies the size of the chunks to read the file into the **BackBuffer** in.

**Exceptions:**

**FCollException Thrown if the VirtualSeeker vs that has been specified is invalid for the istream is.**

**Definition at line 61 of file backbuffer.h.**

## Member Function Documentation

### int zipios::BackBuffer::readChunk (int & read\_pointer)` [inline]`

**Reads another chunk and returns the size of the chunk that has been read. Returns 0 on I/O failure.**

**Parameters:**

*read\_pointer* **When a new chunk is read in the already stored bytes change position in the BackBuffer. read\_pointer is assumed by readChunk() to be a pointer into a position in the BackBuffer, and is updated to point to the same position in the file as it pointed to before the new chunk was read.**

**Definition at line 75 of file backbuffer.h.**

## Author

**Generated automatically by Doxygen for Zipios++ from the source code.**
