Table of Contents

Class RandomAccessSourceFactory

Namespace
iText.IO.Source
Assembly
itext.io.dll

Factory to create objects based on various types of sources

public sealed class RandomAccessSourceFactory
Inheritance
RandomAccessSourceFactory
Inherited Members

Constructors

RandomAccessSourceFactory()

Creates a factory that will give preference to accessing the underling data source using memory mapped files

public RandomAccessSourceFactory()

Methods

CreateBestSource(string)

Creates a based on a filename string. If the filename describes a URL, a URL based source is created If the filename describes a file on disk, the contents may be read into memory (if forceRead is true), opened using memory mapped file channel (if usePlainRandomAccess is false), or opened using FileStream access (if usePlainRandomAccess is true) This call will automatically fail over to using FileStream if the memory map operation fails

public IRandomAccessSource CreateBestSource(string filename)

Parameters

filename string

the name of the file or resource to create the for

Returns

IRandomAccessSource

the newly created

CreateRanged(IRandomAccessSource, long[])

public IRandomAccessSource CreateRanged(IRandomAccessSource source, long[] ranges)

Parameters

source IRandomAccessSource
ranges long[]

Returns

IRandomAccessSource

CreateSource(byte[])

Creates a based on a byte array

public IRandomAccessSource CreateSource(byte[] data)

Parameters

data byte[]

the byte array

Returns

IRandomAccessSource

the newly created

CreateSource(FileStream)

public IRandomAccessSource CreateSource(FileStream raf)

Parameters

raf FileStream

Returns

IRandomAccessSource

CreateSource(Stream)

Creates a based on an Stream

The full content of the InputStream is read into memory and used as the source for the
public IRandomAccessSource CreateSource(Stream inputStream)

Parameters

inputStream Stream

the stream to read from

Returns

IRandomAccessSource

the newly created

CreateSource(Uri)

Creates a based on a URL. The data available at the URL is read into memory and used as the source for the

public IRandomAccessSource CreateSource(Uri url)

Parameters

url Uri

the url to read from

Returns

IRandomAccessSource

the newly created

ExtractOrCreateSource(Stream)

Creates or extracts a based on a Stream

If the InputStream is an instance of RASInputStream then extracts the source from it. Otherwise The full content of the InputStream is read into memory and used as the source for the
public IRandomAccessSource ExtractOrCreateSource(Stream inputStream)

Parameters

inputStream Stream

the stream to read from

Returns

IRandomAccessSource

the newly created or extracted

SetExclusivelyLockFile(bool)

public RandomAccessSourceFactory SetExclusivelyLockFile(bool exclusivelyLockFile)

Parameters

exclusivelyLockFile bool

Returns

RandomAccessSourceFactory

SetForceRead(bool)

Determines whether the full content of the source will be read into memory

public RandomAccessSourceFactory SetForceRead(bool forceRead)

Parameters

forceRead bool

true if the full content will be read, false otherwise

Returns

RandomAccessSourceFactory

this object (this allows chaining of method calls)

SetForceReadDefaultValue(bool)

Determines the default value for the forceRead flag

public static void SetForceReadDefaultValue(bool forceRead)

Parameters

forceRead bool

true if by default the full content will be read, false otherwise

SetUsePlainRandomAccess(bool)

Determines whether FileStream should be used as the primary data access mechanism

public RandomAccessSourceFactory SetUsePlainRandomAccess(bool usePlainRandomAccess)

Parameters

usePlainRandomAccess bool

whether FileStream should be used as the primary data access mechanism

Returns

RandomAccessSourceFactory

this object (this allows chaining of method calls)