java.lang.Object | |
↳ | com.pdftron.filters.Filter |
Known Direct Subclasses |
Known Indirect Subclasses |
Provides a generic view of a sequence of bytes. A Filter is the abstract base class of all filters. A filter is an abstraction of a sequence of bytes, such as a file, an input/output device, an inter-process communication pipe, or a TCP/IP socket. The Filter class and its derived classes provide a generic view of these different types of input and output, isolating the programmer from the specific details of the operating system and the underlying devices. Besides providing access to input/output sources Filters can be also to transform the data (e.g. to compress the data stream, to normalize the image data, to encrypt data, etc). Filters can also be attached to each other to form pipelines. For example, a filter used to open an image data file can be attached to a filter that decompresses the data, which is attached to another filter that will normalize the image data. Depending on the underlying data source or repository, filters might support only some of these capabilities. An application can query a stream for its capabilities by using the IsInputFilter() and CanSeek() properties.
Note: To read or write data to a filter, a user will tipically use FilterReader/FilterWriter class instead of using Filter methods. For example:
MappedFile file = new MappedFile("my_stream.txt");
FilterReader reader = new FilterReader(file);
while (reader.read(...)) ...
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static Filter | __Create(long impl, Filter attached) | ||||||||||
long | __GetHandle() | ||||||||||
void | __SetRefHandle(Object ref) | ||||||||||
void |
attachFilter(Filter attach_filter)
Attaches a filter to the this filter.
| ||||||||||
boolean |
canSeek()
determine whether the stream supports seeking
| ||||||||||
void |
close()
Frees the native memory of the object.
| ||||||||||
Filter |
createInputIterator()
Create Filter iterator.
| ||||||||||
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.
| ||||||||||
String |
getDecodeName()
Get the decode name.
| ||||||||||
String |
getFilePath()
Get the file path.
| ||||||||||
String |
getName()
Get the name.
| ||||||||||
Filter |
getSourceFilter()
Get the source filter.
| ||||||||||
boolean |
isInputFilter()
Checks if is input filter.
| ||||||||||
Filter |
releaseAttachedFilter()
Release the ownership of the attached filter.
| ||||||||||
void |
seek(long offset, int origin)
When overridden in a derived class, sets the position within the current stream.
| ||||||||||
void |
setStreamLength(long bytes)
The functions specifies the length of the data stream.
| ||||||||||
long |
size()
Returns the size of buffer returned by Begin().
| ||||||||||
long |
tell()
Reports the current read position in the stream relative to the stream origin.
| ||||||||||
void |
writeToFile(String path, boolean append)
Writes the entire filter, starting at current position, to
specified filepath.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.AutoCloseable
|
Attaches a filter to the this filter. If this filter owns another filter it will be deleted. This filter then becomes the owner of the attached filter.
attach_filter | the attach_filter |
---|
PDFNetException |
---|
determine whether the stream supports seeking
PDFNetException |
---|
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.
PDFNetException |
---|
Create Filter iterator. Filter iterator similar to a regular filter. However, there can be only one owner of the attached filter.
Note: - Derived classes should make sure that there is only one owner of the attached stream. Otherwise the attached stream may be deleted several times.
PDFNetException |
---|
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.
PDFNetException |
---|
Forces any data remaining in the buffer to be written to input or output filter.
PDFNetException |
---|
Forces any data remaining in the filter chain to the source or destination.
PDFNetException |
---|
Get the attached filter.
PDFNetException |
---|
Get the decode name.
PDFNetException |
---|
Get the file path.
PDFNetException |
---|
Get the source filter.
PDFNetException |
---|
Checks if is input filter.
PDFNetException |
---|
Release the ownership of the attached filter. After the attached filter is released this filter points to NULL filter.
PDFNetException |
---|
When overridden in a derived class, sets the position within the current stream.
Note: - After each Seek() operation the number of consumed bytes (i.e. Count()) is set to 0.
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 |
PDFNetException |
---|
The functions specifies the length of the data stream. The default implementation does not do anything. For some derived filters such as file segment filter it may be useful to override this function in order to limit the stream.
bytes | the new stream length |
---|
PDFNetException |
---|
Returns the size of buffer returned by Begin(). If the Size() returns 0 end of data has been reached.
PDFNetException |
---|
Reports the current read position in the stream relative to the stream origin.
PDFNetException |
---|
Writes the entire filter, starting at current position, to specified filepath. Should only be called on an input filter.
path | the output filepath. |
---|---|
append | 'true' to append to existing file contents, 'false' to overwrite. |