IFile

Description

interface Tinman.Core.IO.Files.IFile

Base interface for classes that represent binary objects with random-access semantics.

Public / Methods

Get​Length


[ThreadSafe]
public method GetLength → ()

returns → int64

The current length, in bytes.

Returns the current length of this binary object.

IOException

If an I/O error has occurred.

Get​Timestamp


public method GetTimestamp → ()

returns → int64

The timestamp value (see LicenceUtil.SystemTime).

Returns the timestamp of the last file modification.

If SetTimestamp has been called, this method will return the provided timestamp value. Otherwise, the method will fetch the timestamp from the underlying filesystem each time is it called.

IOException

If an I/O error has occurred.

Read


[ThreadSafe]
public method Read → (4)

offset in : int64

[>=0]
Offset of first byte to read from file.

buffer in : ByteBuffer

[not-null]
The output buffer. The ByteBuffer object will not be modified by this method. The current buffer position (see ByteBuffer.Position) will be queried iff bufferOffset opt is -1. The current buffer limit will be queried iff count opt is -1.

bufferOffset opt : int32 = -1

[>=-1]
Offset into output buffer in. If set to -1, the current buffer position (see ByteBuffer.Position) will be used.

count opt : int32 = -1

[>=-1]
Total number of bytes to read. If set to -1, the remaining buffer bytes (see ByteBuffer.Remaining) will be used.

returns → int32

The actual number of read bytes.

Reads a chunk of bytes from the binary object.

The actual number of read bytes may be lower than count opt 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.

IOException

If an I/O error has occurred.

Read​All


[ThreadSafe]
public method ReadAll → (4)

offset in : int64

[>=0]
Offset of first byte to read from file.

buffer in : ByteBuffer

[not-null]
The output buffer. The ByteBuffer object will not be modified by this method.

bufferOffset opt : int32 = -1

[>=-1]
Offset into output buffer in. If set to -1, the current buffer position (see ByteBuffer.Position) will be used.

count opt : int32 = -1

[>=-1]
Total number of bytes to read. If set to -1, the remaining buffer bytes (see ByteBuffer.Remaining) will be used.

Reads a chunk of bytes from the binary object.

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

IOException

If an I/O error has occurred.

Set​Length


[ThreadSafe]
public method SetLength → (1)

value in : int64

[>=0]
The new length, in bytes.

Sets the length of this binary object.

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

IOException

If an I/O error has occurred.

Set​Timestamp


[ThreadSafe]
public method SetTimestamp → (1)

timestamp in : int64

The timestamp value (see LicenceUtil.SystemTime).

Sets the timestamp of the last file modification.

Once called, the GetTimestamp will return timestamp in. The new timestamp may not become apparent to the underlying filesystem immediately, but it will when this file is disposed, at the latest.

IOException

If an I/O error has occurred.

Write


[ThreadSafe]
public method Write → (4)

offset in : int64

[>=0]
Offset of first byte to read from file.

buffer in : ByteBuffer

[not-null]
The input buffer. The ByteBuffer object will not be modified by this method.

bufferOffset opt : int32 = -1

[>=-1]
Offset into output buffer in. If set to -1, the current buffer position (see ByteBuffer.Position) will be used.

count opt : int32 = -1

[>=-1]
Total number of bytes to read. If set to -1, the remaining buffer bytes (see ByteBuffer.Remaining) will be used.

Writes a chunk of bytes to the file.

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.

IOException

If an I/O error has occurred.

Public / Attributes

Is​Local


public attribute IsLocal → (get)

value : bool

true if this file is local, false if not.

Is the data of this file present on the host machine?

Is​Temporary


public attribute IsTemporary → (get)

value : bool

true if this file is a temporary one, false if it is a regular one.

Is this a temporary file?

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