Show / Hide Table of Contents

# Class FilterReader

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

##### Inheritance

object
FilterReader

##### Implements

IDisposable

##### Inherited Members

object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

###### Namespace: pdftron.Filters

###### Assembly: PDFNet.dll

##### Syntax

    public class FilterReader : IDisposable

##### Examples

    MappedFile file=new MappedFile("my_stream.txt"));
    FilterReader reader=new FilterReader(file);
    while (reader.Read(...)) ...

### Constructors

#### FilterReader()

Instantiates a new filter reader.

##### Declaration

    public FilterReader()

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### FilterReader(Filter)

Instantiates a new filter reader.

##### Declaration

    public FilterReader(Filter input_filter)

##### Parameters

Type | Name | Description
--- | --- | ---
Filter | input_filter | input filter

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Methods

#### AttachFilter(Filter)

Attaches a filter to the this FilterReader.

##### Declaration

    public void AttachFilter(Filter filter)

##### Parameters

Type | Name | Description
--- | --- | ---
Filter | filter | the filter to attach

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Count()

Count.

##### Declaration

    public int Count()

##### Returns

Type | Description
--- | ---
int | the number of bytes consumed since opening the filter or since the last Seek operation.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Dispose()

Releases all resources used by the FilterReader

##### Declaration

    public override sealed void Dispose()

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected virtual void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

#### ~FilterReader()

Allows an FilterReader to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

##### Declaration

    protected ~FilterReader()

#### Flush()

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

##### Declaration

    public void Flush()

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### FlushAll()

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

##### Declaration

    public void FlushAll()

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Get()

Gets the next character

##### Declaration

    public int Get()

##### Returns

Type | Description
--- | ---
int | the next character from the stream or EOF (-1) if the end of file is reached.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetAttachedFilter()

Gets the attached filter.

##### Declaration

    public Filter GetAttachedFilter()

##### Returns

Type | Description
--- | ---
Filter | The attached Filter or a NULL filter if no filter is attached.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Peek()

Peek.

##### Declaration

    public int Peek()

##### Returns

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Read(byte[])

Read.

##### Declaration

    public int Read(byte[] buf)

##### Parameters

Type | Name | Description
--- | --- | ---
byte[] | buf | the buf_size

##### Returns

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Seek(int, ReferencePos)

Sets the position within the current stream.

##### Declaration

    public void Seek(int offset, Filter.ReferencePos origin)

##### Parameters

Type | Name | Description
--- | --- | ---
int | 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.
Filter.ReferencePos | origin | A value of type ReferencePos indicating the reference point used to obtain the new position

##### Remarks

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

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Tell()

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

##### Declaration

    public int Tell()

##### Returns

Type | Description
--- | ---
int | The current position in the stream

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Implements

IDisposable