PTMappedFile

@interface PTMappedFile : PTFilter

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.
  • Create a new instance of MappedFile class with the specified path

    Declaration

    Objective-C

    - (instancetype)initWithFilename:(NSString *)filename;

    Swift

    init!(filename: String!)
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isEqualTo: (PTMappedFile*)f;

    Swift

    func isEqual(to f: PTMappedFile!) -> Bool
  • Check is the two file paths are equivalent (i.e. they refer to the same file on disc.

    Declaration

    Objective-C

    + (BOOL)Equivalent:(NSString *)ph1 ph2:(NSString *)ph2;

    Swift

    class func equivalent(_ ph1: String!, ph2: String!) -> Bool

    Return Value

    true if the two files share the same filename, false otherwise.

  • Declaration

    Objective-C

    - (unsigned long)FileSize;

    Swift

    func fileSize() -> UInt

    Return Value

    the size of the current file.