TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class File_Memory in Tinman.Core.IO.Files

sealed class File_Memory extends FileBase

Public / Attributes

CanRead

Does this object support read access?

public virtual property CanRead { get }
type bool
value true if this object supports reading, false if not.
inherited FileBase.CanRead

CanWrite

Does this binary object support write access?

public override property CanWrite { get }
type bool
value true if this object supports writing, false if not.
overrides FileBase.CanWrite

IsTemporary

Is this a temporary file?

public override property IsTemporary { get }
type bool
value true if this file is a temporary one, false if it is a regular one.
overrides FileBase.IsTemporary

Remarks:

The contents of a temporary file are no longer used when it is disposed.

LifecycleState

Returns the lifecycle state of this object.

public virtual property LifecycleState { get }
type LifecycleState
value The lifecycle state.
inherited Disposable.LifecycleState

PathInfo

Returns a Path object that represents the file path this object is associated with.

public override property PathInfo { get }
type Path
value [not-null] The path info.
overrides FileBase.PathInfo

Remarks:

Objects that do not have a meaningful file path association simply return Unknown.

Public / Methods

AcquireTry

Acquires a strong reference to this disposable object.

[OwnerReturn, ThreadSafe]
public method AcquireTry ()
type IDisposable
returns this if a new strong reference has been acquired, null if this object is already being disposed.
inherited Disposable.AcquireTry

Remarks:

The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.

This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.

Cache

Returns a IFile that accesses this file through the given in-memory file cache.

[OwnerReturn, OwnerThis]
public override method Cache (FileCache cache)
type IFile
params cache [not-null] The cache to use.
returns [not-null] The resulting IFile object.
overrides FileBase.Cache

Dispose

Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.

[Dispose, OwnerThis, ThreadSafe]
public method Dispose ()
inherited Disposable.Dispose

Remarks:

The Dispose method silently returns if the object has already been disposed.

Flush

Flushes all cached data.

public override method Flush ()
implements FileBase.Flush

Remarks:

Performing a flush may result in I/O work. Depending on the semantics of the implementing class, this work may need to be wrapped in special Begin / End method calls. See the documentation of the implementing classes for details.

In case this object represents a read-only resource, calling the Flush method has no effect.

GetLength

Returns the current length of this binary object.

[ThreadSafe]
public override method GetLength ()
type int64
returns [>=0] The current length, in bytes.
implements FileBase.GetLength

GetTimestamp

Returns the timestamp of the last file modification.

public override method GetTimestamp ()
type int64
returns The timestamp value (see SystemTime).
implements FileBase.GetTimestamp

Offset

Returns a IFile that accesses the data in this file using the given byte offset.

[OwnerReturn, OwnerThis]
public virtual method Offset (int64 offset)
type IFile
params offset [>=0] Absolute offset in this file that will be mapped to offset 0 in the returned file.
returns [not-null] The resulting IFile object.
inherited FileBase.Offset

Read

Reads a chunk of bytes from the binary object.

[ThreadSafe]
public override method Read (int64 offset, ByteBuffer buffer, int32 bufferOffset = -1, int32 count = -1)
type int32
params offset [>=0] Offset of first byte to read from file.
  buffer [not-null] The output buffer. The ByteBuffer object will not be modified by this method. The current buffer position (see Position) will be queried iff bufferOffset is -1. The current buffer limit will be queried iff count is -1.
  bufferOffset [>=-1] Offset into output buffer. If set to -1, the current buffer position (see Position) will be used.
  count [>=-1] Total number of bytes to read. If set to -1, the remaining buffer bytes (see Remaining) will be used.
returns [>=0] The actual number of read bytes.
implements FileBase.Read

Remarks:

The actual number of read bytes may be lower than count when reading over the end of the binary object. The maximum number of bytes that can be read with a single call is 2^31-1.

ReadAll

Reads a chunk of bytes from the binary object.

[ThreadSafe]
public virtual method ReadAll (int64 offset, ByteBuffer buffer, int32 bufferOffset = -1, int32 count = -1)
params offset [>=0] Offset of first byte to read from file.
  buffer [not-null] The output buffer. The ByteBuffer object will not be modified by this method.
  bufferOffset [>=-1] Offset into output buffer. If set to -1, the current buffer position (see Position) will be used.
  count [>=-1] Total number of bytes to read. If set to -1, the remaining buffer bytes (see Remaining) will be used.
inherited FileBase.ReadAll

Remarks:

The maximum number of bytes that can be read with a single call is 2^31-1.

ReadArchive

Reads the file content as an archive.

[OwnerReturn]
public method ReadArchive (string entry = null)
type IDataStream
params entry Name of the archive entry to read or null to read the first entry.
returns [not-null] The data stream that reads the uncompressed archive entry.
inherited FileBase.ReadArchive

ReadOnly

Returns a read-only view on this IFile.

[OwnerReturn, OwnerThis]
public virtual method ReadOnly ()
type IFile
returns [not-null] The resulting IFile object.
inherited FileBase.ReadOnly

SetLength

Sets the length of this binary object.

[ThreadSafe]
public override method SetLength (int64 value)
params value [>=0] The new length, in bytes.
implements FileBase.SetLength

Remarks:

Setting the length of a binary object may cause additional management overhead by the OS and should only be done when absolutely necessary.

ToDataStream

Creates an IDataStream object for accessing the data of this object.

[OwnerReturn, OwnerThis]
public virtual method ToDataStream (int32 bufferSize = 65536, bool needLength = true)
type IDataStream
params bufferSize [>0] The buffer size to use, in bytes. Defaults to 65536.
  needLength Shall the returned data stream report a proper length (if possible) with its Length property? Defaults to true.
returns [not-null] The data stream.
inherited FileBase.ToDataStream

Write

Writes a chunk of bytes to the file.

[ThreadSafe]
public override method Write (int64 offset, ByteBuffer buffer, int32 bufferOffset = -1, int32 count = -1)
params offset [>=0] Offset of first byte to read from file.
  buffer [not-null] The input buffer. The ByteBuffer object will not be modified by this method.
  bufferOffset [>=-1] Offset into output buffer. If set to -1, the current buffer position (see Position) will be used.
  count [>=-1] Total number of bytes to read. If set to -1, the remaining buffer bytes (see Remaining) will be used.
implements FileBase.Write

Remarks:

The maximum number of bytes that can be written with a single call is 2^31-1. Writing past the end of the binary object will cause it to grow automatically.