Class: FilterReader

PDFNet. FilterReader


new FilterReader()

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(...)) ...

Extends

Methods


<static> create(filter)

Parameters:
Name Type Description
filter PDFNet.Filter
Returns:
A promise that resolves to an object of type: "PDFNet.FilterReader"
Type
Promise.<PDFNet.FilterReader>

attachFilter(filter)

Attaches a filter to the this FilterReader.
Parameters:
Name Type Description
filter PDFNet.Filter filter object to attach
Returns:
Type
Promise.<void>

count()

Returns:
A promise that resolves to the number of bytes consumed since opening the filter or since the last Seek operation.
Type
Promise.<number>

destroy()

Destructor
Inherited From:
Returns:
Type
Promise.<void>

flush()

Forces any data remaining in the buffer to be written to input or output filter.
Returns:
Type
Promise.<void>

flushAll()

Forces any data remaining in the filter chain to the source or destination.
Returns:
Type
Promise.<void>

get()

Returns:
A promise that resolves to the next character from the stream or EOF (-1) if the end of file is reached.
Type
Promise.<number>

getAttachedFilter()

Returns:
A promise that resolves to The attached Filter or a NULL filter if no filter is attached.
Type
Promise.<PDFNet.Filter>

peek()

Returns:
A promise that resolves to the next character without extracting it from the stream or or EOF (-1) if the end of file is reached.
Type
Promise.<number>

read(buf_size)

Read data from the attached filter
Parameters:
Name Type Description
buf_size number The maximum amount to read
Returns:
A promise that resolves to a Uint8Array containing the data that was read. the promise will resolve to null if no data was remaining.
Type
Promise.<Uint8Array>

readAllIntoBuffer()

Read all the remaining data to a buffer from the attached filter
Returns:
A promise that resolves to a Uint8Array containing the data that was read. the promise will resolve to null if no data was remaining.
Type
Promise.<Uint8Array>

seek(offset, origin)

Sets the position within the current stream.
Parameters:
Name Type Description
offset number 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 number
PDFNet.Filter.ReferencePos = {
	e_begin : 0
	e_end : 2
	e_cur : 1
}
A value of type ReferencePos indicating the reference point used to obtain the new position
Returns:
Type
Promise.<void>

takeOwnership()

Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
Inherited From:
Returns:
Type
void

tell()

Reports the current read position in the stream relative to the stream origin.
Returns:
A promise that resolves to The current position in the stream
Type
Promise.<number>