Show / Hide Table of Contents

# Class MappedFile

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.

##### Inheritance

object
Filter
MappedFile

##### Implements

IDisposable

##### Inherited Members

Filter.GetName()
Filter.GetDecodeName()
Filter.Begin()
Filter.Size()
Filter.Consume(int)
Filter.Count()
Filter.SetCount(int)
Filter.SetStreamLength(int)
Filter.AttachFilter(Filter)
Filter.ReleaseAttachedFilter()
Filter.GetAttachedFilter()
Filter.GetSourceFilter()
Filter.Flush()
Filter.FlushAll()
Filter.IsInputFilter()
Filter.CanSeek()
Filter.Seek(int, Filter.ReferencePos)
Filter.Tell()
Filter.CreateInputIterator()
Filter.WriteToFile(string, bool)
Filter.Dispose()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

###### Namespace: pdftron.Filters

###### Assembly: PDFNet.dll

##### Syntax

    public class MappedFile : Filter, IDisposable

##### Remarks

.NET or Java applications should explicitly Close() files when they are not needed.

### Constructors

#### MappedFile(string)

Create a new instance of MappedFile class with the specified path.

##### Declaration

    public MappedFile(string filename)

##### Parameters

Type | Name | Description
--- | --- | ---
string | filename | filename

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

### Methods

#### Close()

close filter and release relevant resources

##### Declaration

    public void Close()

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected override void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

##### Overrides

Filter.Dispose(bool)

#### FileSize()

Gets File size.

##### Declaration

    public int FileSize()

##### Returns

Type | Description
--- | ---
int | the size of the current file.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetFilePath()

Gets file path

##### Declaration

    public override string GetFilePath()

##### Returns

Type | Description
--- | ---
string | file path

##### Overrides

Filter.GetFilePath()

### Implements

IDisposable