Class RandomAccessSourceFactory
Factory to create
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
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
stringthe 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
IRandomAccessSourceranges
long[]
Returns
CreateSource(byte[])
Creates a
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
CreateSource(Stream)
Creates a
public IRandomAccessSource CreateSource(Stream inputStream)
Parameters
inputStream
Streamthe stream to read from
Returns
- IRandomAccessSource
the newly created
CreateSource(Uri)
Creates a
public IRandomAccessSource CreateSource(Uri url)
Parameters
url
Urithe url to read from
Returns
- IRandomAccessSource
the newly created
ExtractOrCreateSource(Stream)
Creates or extracts a
public IRandomAccessSource ExtractOrCreateSource(Stream inputStream)
Parameters
inputStream
Streamthe stream to read from
Returns
- IRandomAccessSource
the newly created or extracted
SetExclusivelyLockFile(bool)
public RandomAccessSourceFactory SetExclusivelyLockFile(bool exclusivelyLockFile)
Parameters
exclusivelyLockFile
bool
Returns
SetForceRead(bool)
Determines whether the full content of the source will be read into memory
public RandomAccessSourceFactory SetForceRead(bool forceRead)
Parameters
forceRead
booltrue 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
booltrue 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
boolwhether FileStream should be used as the primary data access mechanism
Returns
- RandomAccessSourceFactory
this object (this allows chaining of method calls)