Summary: Ctors | Methods | Inherited Methods | [Expand All]
public class

# MemoryFilter

extends Filter

java.lang.Object
↳ | com.pdftron.filters.Filter
| ↳ | com.pdftron.filters.MemoryFilter

## Class Overview

MemoryFilter is a memory buffer that can be used as a source or a sink Filter in the Filter pipeline. When a MemoryFilter is the source, other filters can read data stored in memory; When MemoryFilter is a sink, other filters generate data which is then pushed in a memory buffer owned by MemoryFilter (MemoryFilter makes sure that there is enough space to accomodate all data).

## Summary

Public Constructors
| MemoryFilter(long buf_sz, boolean is_input) Instantiates a new memory filter with specified buffer size.

Public Methods
byte[] | getBuffer() Get the memory buffer Note: MemoryFilter specific function.
void | setAsInputFilter() Set the MemoryBuffer as input filter Note: MemoryFilter-specific function used to change filter mode from output to input.

[Expand] Inherited Methods
From class com.pdftron.filters.Filter
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.
From class java.lang.Object
boolean | equals(Object arg0)
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface java.lang.AutoCloseable
abstract void | close()

## Public Constructors

#### public MemoryFilter (long buf_sz, boolean is_input)

Instantiates a new memory filter with specified buffer size.

##### Parameters

buf_sz | the buffer size
is_input | When true, this MemoryFilter acts as a source that other filters can read. When false, it acts as a sink that other filters can write to.

##### Throws

PDFNetException |

## Public Methods

#### public byte[] getBuffer ()

Get the memory buffer

Note: MemoryFilter specific function.

##### Returns

- entire memory buffer.

##### Throws

PDFNetException |

#### public void setAsInputFilter ()

Set the MemoryBuffer as input filter

Note: MemoryFilter-specific function used to change filter mode from output to input. The utility function is useful in cases when an output data buffer should be converted to an input stream.

Note: The function has no effect on an input MemoryFilter.

##### Throws

PDFNetException |