Loading...
Searching...
No Matches
pdftron::Filters::FilterReader Class Reference

`#include <FilterReader.h>`

## Public Member Functions
| FilterReader ()
| FilterReader (Filter &filter)
| ~FilterReader ()
int | Get ()
int | Peek ()
std::vector< unsigned char > | Read (size_t buf_size)
size_t | Read (UChar *buf, size_t buf_size)
void | AttachFilter (Filter &filter)
Filter | GetAttachedFilter ()
void | Seek (ptrdiff_t offset, Filter::ReferencePos origin)
ptrdiff_t | Tell ()
size_t | Count ()
void | Flush ()
void | FlushAll ()

## Detailed Description

FilterReader is a utility class providing a convenient way to read data from an input filter (using Filter directly is not very intuitive).

For example:

StdFile file("my_stream.txt", StdFile::e_read_mode);
FilterReader reader(file);
while (reader.Read(...)) ...
pdftron::Filters::FilterReader::FilterReader
FilterReader()

Definition at line 29 of file FilterReader.h.

## Constructor & Destructor Documentation

## ◆ FilterReader() [1/2]

pdftron::Filters::FilterReader::FilterReader | ( |  | ) |

## ◆ FilterReader() [2/2]

pdftron::Filters::FilterReader::FilterReader | ( | Filter & | filter | ) |

## ◆ ~FilterReader()

pdftron::Filters::FilterReader::~FilterReader | ( |  | ) |

## Member Function Documentation

## ◆ AttachFilter()

void pdftron::Filters::FilterReader::AttachFilter | ( | Filter & | filter | ) |

Attaches a filter to the this FilterReader.

Parameters

  filter | filter object to attach

## ◆ Count()

size_t pdftron::Filters::FilterReader::Count | ( |  | ) |

Returns
  - the number of bytes consumed since opening the filter or since the last Seek operation.

## ◆ Flush()

void pdftron::Filters::FilterReader::Flush | ( |  | ) |

Forces any data remaining in the buffer to be written to input or output filter.

## ◆ FlushAll()

void pdftron::Filters::FilterReader::FlushAll | ( |  | ) |

Forces any data remaining in the filter chain to the source or destination.

## ◆ Get()

int pdftron::Filters::FilterReader::Get | ( |  | ) |

Returns
  - the next character from the stream or EOF (-1) if the end of file is reached.

## ◆ GetAttachedFilter()

Filter pdftron::Filters::FilterReader::GetAttachedFilter | ( |  | ) |

Returns
  - The attached Filter or a NULL filter if no filter is attached.

## ◆ Peek()

int pdftron::Filters::FilterReader::Peek | ( |  | ) |

Returns
  - the next character without extracting it from the stream or or EOF (-1) if the end of file is reached.

## ◆ Read() [1/2]

std::vector< unsigned char > pdftron::Filters::FilterReader::Read | ( | size_t | buf_size | ) |

Returns
  - returns the number of bytes actually read and stored in buffer (buf), which may be less than buf_size if the end of the stream is encountered before reaching count.

## ◆ Read() [2/2]

size_t pdftron::Filters::FilterReader::Read | ( | UChar * | buf,
|  | size_t | buf_size )

## ◆ Seek()

void pdftron::Filters::FilterReader::Seek | ( | ptrdiff_t | offset,
|  | Filter::ReferencePos | origin )

Sets the position within the current stream.

Parameters

  offset | - A byte offset relative to origin. If offset is negative, the new position will precede the position specified by origin by the number of bytes specified by offset. If offset is zero, the new position will be the position specified by origin. If offset is positive, the new position will follow the position specified by origin by the number of bytes specified by offset.
  origin | - A value of type ReferencePos indicating the reference point used to obtain the new position

Note
  - After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0.

Exceptions

  - | throws an exception if the method is not implemented in the associated filter.

## ◆ Tell()

ptrdiff_t pdftron::Filters::FilterReader::Tell | ( |  | ) |

Reports the current read position in the stream relative to the stream origin.

Returns
  - The current position in the stream

Exceptions

  - | throws an exception if the method is not implemented in the associated filter.

The documentation for this class was generated from the following file:

- Filters/FilterReader.h