All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::Filters::MappedFile Class Reference

#include <MappedFile.h>

+ Inheritance diagram for pdftron::Filters::MappedFile:

Public Member Functions

 MappedFile (const UString &filename)
 
bool operator== (const MappedFile &f) const
 
size_t FileSize ()
 
- Public Member Functions inherited from pdftron::Filters::Filter
 Filter ()
 
 ~Filter ()
 
 Filter (const Filter &copy)
 
Filteroperator= (const Filter &other)
 
 operator bool ()
 
void AttachFilter (Filter attach_filter)
 
Filter ReleaseAttachedFilter ()
 
Filter GetAttachedFilter ()
 
Filter GetSourceFilter ()
 
const char * GetName () const
 
const char * GetDecodeName () const
 
UCharBegin ()
 
size_t Size ()
 
void Consume (size_t num_bytes)
 
size_t Count ()
 
size_t SetCount (size_t new_count)
 
void SetStreamLength (size_t bytes)
 
void Flush ()
 
void FlushAll ()
 
bool IsInputFilter ()
 
bool CanSeek ()
 
void Seek (ptrdiff_t offset, ReferencePos origin)
 
ptrdiff_t Tell ()
 
size_t Truncate (size_t new_size)
 
Filter CreateInputIterator ()
 
const UString GetFilePath () const
 
void Destroy ()
 
void WriteToFile (const UString &path, bool append)
 

Static Public Member Functions

static bool Equivalent (const UString &ph1, const UString &ph2)
 

Additional Inherited Members

- Public Types inherited from pdftron::Filters::Filter
enum  ReferencePos { e_begin = SEEK_SET, e_end = SEEK_END, e_cur = SEEK_CUR }
 

Detailed Description

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.

Definition at line 37 of file MappedFile.h.

Constructor & Destructor Documentation

pdftron::Filters::MappedFile::MappedFile ( const UString filename)

Create a new instance of MappedFile class with the specified path

Member Function Documentation

static bool pdftron::Filters::MappedFile::Equivalent ( const UString ph1,
const UString ph2 
)
static

Check is the two file paths are equivalent (i.e. they refer to the same file on disc.

Returns
true if the two files share the same filename, false otherwise.
size_t pdftron::Filters::MappedFile::FileSize ( )
Returns
the size of the current file.
bool pdftron::Filters::MappedFile::operator== ( const MappedFile f) const

Check is the two MappedFile-s refer to the same file on disc.

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

The documentation for this class was generated from the following file: