Class: FilterWriter

PDFNet. FilterWriter


new FilterWriter()

FilterWriter is a utility class providing a convenient way to write data to an output filter (using Filter directly is not very intuitive). For example:
StdFile outfile("file.dat", StdFile::e_write_mode);
FilterWriter fwriter(outfile);
fwriter.WriteBuffer(buf, buf_sz);
fwriter.Flush();

Extends

Methods


<static> create(filter)

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

attachFilter(filter)

Attaches a filter to the this FilterWriter.
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>

getAttachedFilter()

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

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 Note: After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0.
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>

writeBuffer(buf)

Parameters:
Name Type Description
buf ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray buffer object to write out.
Returns:
A promise that resolves to returns the number of bytes actually written to a stream. This number may less than buf_size if the stream is corrupted.
Type
Promise.<number>

writeFilter(reader)

Write the entire input stream to the output stream (i.e. to this FilterWriter).
Parameters:
Name Type Description
reader PDFNet.FilterReader A FilterReader attached to an input stream.
Returns:
Type
Promise.<void>

writeInt16(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>

writeInt32(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>

writeInt64(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>

writeLine(line [, eol])

Write out a null terminated 'line' followed by a end of line character default end of line character is carriage return.
Parameters:
Name Type Argument Description
line string string to write out.
eol number <optional>
end of line character. Defaults to carriage return (0x0D).
Returns:
Type
Promise.<void>

writeString(str)

Write a string to the output stream.
Parameters:
Name Type Description
str string A string to write to the output stream.
Returns:
Type
Promise.<void>

writeUChar(ch)

Write a single character to the output stream.
Parameters:
Name Type Description
ch number An unsigned character to write to the output stream.
Returns:
Type
Promise.<void>

writeUInt16(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>

writeUInt32(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>

writeUInt64(num)

Write an integer to the output stream.
Parameters:
Name Type Description
num number An integer to write to the output stream.
Returns:
Type
Promise.<void>