public class

FilterWriter

extends Object
java.lang.Object
   ↳ com.pdftron.filters.FilterWriter

Class Overview

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=new StdFile("file.dat"), StdFile.e_write_mode); FilterWriter fwriter=new FilterWriter(outfile); byte[] buf=... fwriter.writeBuffer(buf); fwriter.flush();

Summary

Public Constructors
FilterWriter()
Instantiates a new filter writer.
FilterWriter(Filter filter)
Instantiates a new filter writer for specified Filter
Public Methods
long __GetHandle()
void attachFilter(Filter filter)
Attaches a filter to the this FilterWriter.
long count()
Count number of bytes consumed since opening the filter or seek operation
void destroy()
Frees the native memory of the object.
void flush()
Forces any data remaining in the buffer to be written to input or output filter.
void flushAll()
Forces any data remaining in the filter chain to the source or destination.
Filter getAttachedFilter()
Get the attached filter.
void seek(long offset, int origin)
Set the position within the current stream.
long tell()
Reports the current read position in the stream relative to the stream origin.
long writeBuffer(byte[] buf)
Write buffer.
void writeFilter(FilterReader reader)
Write the entire input stream to the output stream (i.e.
void writeInt(int num)
Write an integer to the output stream.
void writeLine(String line)
Write out a null terminated 'line' followed by a end of line character default end of line character is carriage return.
void writeString(String str)
Write a string to the output stream.
void writeUChar(byte ch)
Write a single character to the output stream.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FilterWriter ()

Instantiates a new filter writer.

public FilterWriter (Filter filter)

Instantiates a new filter writer for specified Filter

Parameters
filter the filter

Public Methods

public long __GetHandle ()

public void attachFilter (Filter filter)

Attaches a filter to the this FilterWriter.

Parameters
filter the filter

public long count ()

Count number of bytes consumed since opening the filter or seek operation

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

public void destroy ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public void flush ()

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

public void flushAll ()

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

public Filter getAttachedFilter ()

Get the attached filter.

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

public void seek (long offset, int origin)

Set the position within the current stream.

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

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

public long tell ()

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

Returns
  • - The current position in the stream

public long writeBuffer (byte[] buf)

Write buffer.

Parameters
buf the buf
Returns
  • - returns the number of bytes actually written to a stream. This number may less than buf_size if the stream is corrupted.

public void writeFilter (FilterReader reader)

Write the entire input stream to the output stream (i.e. to this FilterWriter).

Parameters
reader A FilterReader attached to an input stream.

public void writeInt (int num)

Write an integer to the output stream.

Parameters
num An integer to write to the output stream.

public void writeLine (String line)

Write out a null terminated 'line' followed by a end of line character default end of line character is carriage return.

Parameters
line the line

public void writeString (String str)

Write a string to the output stream.

Parameters
str A string to write to the output stream.

public void writeUChar (byte ch)

Write a single character to the output stream.

Parameters
ch An unsigned character to write to the output stream.