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

# MappedFile

extends Filter

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

## Class Overview

MappedFile is a utility class to read files on a file system. Because MappedFile file is derived from pdftron.Filters.Filter you can directly chain MappedFile objects to other 'pdftron.Filters'. MappedFile objects support random access to files using the Seek method. Seek allows the read/write position to be moved to any position within the file. This is done through a shared memory mapped chunk manager. The byte offset is relative to the seek reference point, which can be the beginning, the current position, or the end of the underlying file, as represented by the three properties of the Filter.ReferencePos class. MappedFile objects are thread-safe, meaning separate copies of a MappedFile can Seek to different locations in the file, without conflicting with one another. Disk files always support random access. At the time of construction, the CanSeek() property value is set to true or false depending on the underlying file type.

Note: .NET or Java applications should explicitly Close() files when they are not needed. If the files are not closed or disposed this may lead to the resource exhaustion.

## Summary

Constants
int | e_append_mode | The Constant e_append_mode.
int | e_read_mode | The Constant e_read_mode.
int | e_write_mode | The Constant e_write_mode.

Public Constructors
| MappedFile(String filename) Create a new instance of MappedFile class with the specified path

Public Methods
long | fileSize() Get file size.

[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()

## Constants

#### public static final int e_append_mode

The Constant e_append_mode.

Constant Value: 2 (0x00000002)

#### public static final int e_read_mode

The Constant e_read_mode.

Constant Value: 0 (0x00000000)

#### public static final int e_write_mode

The Constant e_write_mode.

Constant Value: 1 (0x00000001)

## Public Constructors

#### public MappedFile (String filename)

Create a new instance of MappedFile class with the specified path

##### Throws

PDFNetException |

## Public Methods

#### public long fileSize ()

Get file size.

##### Returns

- the size of the current file.

##### Throws

PDFNetException |