public abstract class CustomFilter extends Filter
CustomFilter allows for customizing the reading and writing process. It is useful, for example, for users to write their own encryption and decryption methods.
Note that this is an abstract class.
Modifier and Type | Field and Description |
---|---|
static int |
APPEND_MODE
Filter is in append mode.
|
static int |
READ_MODE
Filter is in read mode.
|
static int |
SEEK_CUR
The offset is relative to the current position of the filter.
|
static int |
SEEK_END
The offset is relative to the end of the filter.
|
static int |
SEEK_SET
The offset is relative to the beginning of the filter.
|
static java.lang.String |
TAG |
static int |
WRITE_MODE
Filter is in write mode.
|
Constructor and Description |
---|
CustomFilter(int mode,
java.lang.Object user_object)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close() |
void |
destroy()
Frees the native memory of the object.
|
java.lang.String |
getName()
Gets the name of the filter.
|
java.lang.Object |
getUserObject()
Gets the user data from
CustomFilter(int, Object) . |
abstract long |
onCreateInputIterator(java.lang.Object user_object) |
abstract void |
onDestroy(java.lang.Object user_object) |
abstract long |
onFlush(java.lang.Object user_object)
The abstract function in which the output data is flushed.
|
abstract long |
onRead(byte[] buf,
java.lang.Object user_object)
The abstract function in which the input data are read.
|
abstract long |
onSeek(long offset,
int origin,
java.lang.Object user_object)
The abstract function in which the position indicator of the filter is
set.
|
abstract long |
onTell(java.lang.Object user_object)
The abstract function in which the position indicator of the filter is
queried.
|
long |
onTruncate(long new_size,
java.lang.Object user_object)
The abstract function the size of the filter is set
|
abstract long |
onWrite(byte[] buf,
java.lang.Object user_object)
The abstract function in which the data are output.
|
__Create, __GetHandle, __SetRefHandle, attachFilter, canSeek, createInputIterator, flush, flushAll, getAttachedFilter, getDecodeName, getFilePath, getSourceFilter, isInputFilter, releaseAttachedFilter, seek, setStreamLength, tell, writeToFile
public static final java.lang.String TAG
public static final int READ_MODE
public static final int WRITE_MODE
public static final int APPEND_MODE
public static final int SEEK_SET
public static final int SEEK_CUR
public static final int SEEK_END
public CustomFilter(int mode, java.lang.Object user_object) throws PDFNetException
mode
- The mode of the filter. Possible values are READ_MODE
, WRITE_MODE
, and APPEND_MODE
.user_object
- The user data that can will be passed back in the abstract
functions.PDFNetException
public abstract long onRead(byte[] buf, java.lang.Object user_object)
buf
- The buffer to contain the data to read, which has already
been allocated.user_object
- The user data from passed in via CustomFilter(int, Object)
.public abstract long onSeek(long offset, int origin, java.lang.Object user_object)
offset
- Number of bytes to offset from origin. A positive value
implies the indicator is moved forward, and a negative value
implies the indicator is moved backward.origin
- Position from where offset is added. It is specified by one of
the following: SEEK_SET
,
SEEK_CUR
, SEEK_END
.user_object
- The user data from passed in via
CustomFilter(int, Object)
.public abstract long onTell(java.lang.Object user_object)
user_object
- The user data from passed in via
CustomFilter(int, Object)
.public long onTruncate(long new_size, java.lang.Object user_object)
new_size
- number of bytes to resize the filter to.user_object
- The user data from passed in via
CustomFilter(int, Object)
.public abstract long onFlush(java.lang.Object user_object)
user_object
- The user data from passed in via
CustomFilter(int, Object)
.public abstract long onWrite(byte[] buf, java.lang.Object user_object)
buf
- The buffer to contain the data to write out.user_object
- The user data from passed in via
CustomFilter(int, Object)
.public abstract long onCreateInputIterator(java.lang.Object user_object)
public abstract void onDestroy(java.lang.Object user_object)
public abstract void close()
public java.lang.Object getUserObject()
CustomFilter(int, Object)
.public java.lang.String getName() throws PDFNetException
getName
in class Filter
PDFNetException
public void destroy() throws PDFNetException
destroy
in class Filter
PDFNetException