FileHandle

Overview

Low level file handle.

Location

  • Reference:
    • Elements.dll  .NET, .NET Core 6.0, .NET Standard 2.0
    • elements.jar  Cooper
    • Elements.fx  Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, ToffeeV2
    • libElements.fx  Toffee
  • Namespace: RemObjects.Elements.RTL
  • Platforms: .NET, .NET Core 6.0, .NET Standard 2.0, Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2
  • Mapped to:
    • FileStream  .NET, .NET Core 6.0, .NET Standard 2.0, ToffeeV2
    • RandomAccessFile  Cooper
    • FileStream  Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows
    • NSFileHandle  Toffee

 

constructor

Creates a new file handle for the given filename.

 

constructor(FileName: String; Mode: FileOpenMode)

 

FileHandle(String FileName, FileOpenMode Mode)

 

init(_ FileName: String, _ Mode: FileOpenMode)

 

FileHandle(String FileName, FileOpenMode Mode)

 

Sub New(FileName As String, Mode As FileOpenMode)

Parameters:

  • FileName:
  • Mode:

Close Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Close the handle.

 

method Close

 

void Close()

 

func Close()

 

void Close()

 

Sub Close()

Flush Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Flush the changes to the file to disk.

 

method Flush

 

void Flush()

 

func Flush()

 

void Flush()

 

Sub Flush()

FromFile

Create a filehandle from a File object

 

class method FromFile(aFile: File; Mode: FileOpenMode): FileHandle

 

static FileHandle FromFile(File aFile, FileOpenMode Mode)

 

static func FromFile(_ aFile: File, _ Mode: FileOpenMode) -> FileHandle

 

static FileHandle FromFile(File aFile, FileOpenMode Mode)

 

Shared Function FromFile(aFile As File, Mode As FileOpenMode) As FileHandle

Parameters:

  • aFile:
  • Mode:

Length

Returns the size of this file.

 

property Length: Int64 read write;

 

Int64 Length { get; set; }

 

var Length: Int64 { get{} set{} }

 

Int64 Length { __get; __set; }

 

Property Length() As Int64

Position

Returns the current position in this file.

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

var Position: Int64 { get{} set{} }

 

Int64 Position { __get; __set; }

 

Property Position() As Int64

Read (array of Byte, Integer): Integer Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes into buffer; returning the nr of bytes actually read. Returns 0 when the end has been reached.

 

method Read(Buffer: array of Byte; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Count: Int32) -> Int32

 

Integer Read(Byte[] Buffer, Integer Count)

 

Function Read(Buffer As Byte(), Count As Int32) As Int32

Parameters:

  • Buffer:
  • Count:

Read (array of Byte, Integer, Integer): Integer Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes into buffer; returning the nr of bytes actually read. Returns 0 when the end has been reached.

 

method Read(Buffer: array of Byte; Offset: Int32; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32) -> Int32

 

Integer Read(Byte[] Buffer, Integer Offset, Integer Count)

 

Function Read(Buffer As Byte(), Offset As Int32, Count As Int32) As Int32

Parameters:

  • Buffer:
  • Offset:
  • Count:

Read (Integer): ImmutableBinary Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes from a file, returning it as binary.

 

method Read(Count: Int32): ImmutableBinary

 

ImmutableBinary Read(Int32 Count)

 

func Read(_ Count: Int32) -> ImmutableBinary

 

ImmutableBinary Read(Integer Count)

 

Function Read(Count As Int32) As ImmutableBinary

Parameters:

  • Count:

Read (array of Byte, Int32): Int32 .NET, .NET Core 6.0, .NET Standard 2.0

 

method Read(Buffer: array of Byte; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Count: Int32) -> Int32

 

Function Read(Buffer As Byte(), Count As Int32) As Int32

Parameters:

  • Buffer:
  • Count:

Read (array of Byte, Int32, Int32): Int32 .NET, .NET Core 6.0, .NET Standard 2.0

 

method Read(Buffer: array of Byte; Offset: Int32; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32) -> Int32

 

Function Read(Buffer As Byte(), Offset As Int32, Count As Int32) As Int32

Parameters:

  • Buffer:
  • Offset:
  • Count:

Read (Int32): ImmutableBinary .NET, .NET Core 6.0, .NET Standard 2.0

 

method Read(Count: Int32): ImmutableBinary

 

ImmutableBinary Read(Int32 Count)

 

func Read(_ Count: Int32) -> ImmutableBinary

 

Function Read(Count As Int32) As ImmutableBinary

Parameters:

  • Count:

Seek (Int64, SeekOrigin) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Changes the position, relative to Origin.

 

method Seek(Offset: Int64; Origin: SeekOrigin)

 

void Seek(Int64 Offset, SeekOrigin Origin)

 

func Seek(_ Offset: Int64, _ Origin: SeekOrigin)

 

void Seek(Int64 Offset, SeekOrigin Origin)

 

Sub Seek(Offset As Int64, Origin As SeekOrigin)

Parameters:

  • Offset:
  • Origin:

Seek (Int64, SeekOrigin) .NET, .NET Core 6.0, .NET Standard 2.0

 

method Seek(Offset: Int64; Origin: SeekOrigin)

 

void Seek(Int64 Offset, SeekOrigin Origin)

 

func Seek(_ Offset: Int64, _ Origin: SeekOrigin)

 

Sub Seek(Offset As Int64, Origin As SeekOrigin)

Parameters:

  • Offset:
  • Origin:

Write (array of Byte) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte)

 

void Write(Byte[] Buffer)

 

func Write(_ Buffer: Byte...)

 

void Write(Byte[] Buffer)

 

Sub Write(Buffer As Byte())

Parameters:

  • Buffer:

Write (array of Byte, Integer) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Count: Int32)

 

void Write(Byte[] Buffer, Integer Count)

 

Sub Write(Buffer As Byte(), Count As Int32)

Parameters:

  • Buffer:
  • Count:

Write (array of Byte, Integer, Integer) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte; Offset: Int32; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32)

 

void Write(Byte[] Buffer, Integer Offset, Integer Count)

 

Sub Write(Buffer As Byte(), Offset As Int32, Count As Int32)

Parameters:

  • Buffer:
  • Offset:
  • Count:

Write (ImmutableBinary) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a binary to a file.

 

method Write(Data: ImmutableBinary)

 

void Write(ImmutableBinary Data)

 

func Write(_ Data: ImmutableBinary)

 

void Write(ImmutableBinary Data)

 

Sub Write(Data As ImmutableBinary)

Parameters:

  • Data:

Write (array of Byte) .NET, .NET Core 6.0, .NET Standard 2.0

 

method Write(Buffer: array of Byte)

 

void Write(Byte[] Buffer)

 

func Write(_ Buffer: Byte...)

 

Sub Write(Buffer As Byte())

Parameters:

  • Buffer:

Write (array of Byte, Int32) .NET, .NET Core 6.0, .NET Standard 2.0

 

method Write(Buffer: array of Byte; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Count: Int32)

 

Sub Write(Buffer As Byte(), Count As Int32)

Parameters:

  • Buffer:
  • Count:

Write (array of Byte, Int32, Int32) .NET, .NET Core 6.0, .NET Standard 2.0

 

method Write(Buffer: array of Byte; Offset: Int32; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32)

 

Sub Write(Buffer As Byte(), Offset As Int32, Count As Int32)

Parameters:

  • Buffer:
  • Offset:
  • Count:

Write (ImmutableBinary) .NET, .NET Core 6.0, .NET Standard 2.0

 

method Write(Data: ImmutableBinary)

 

void Write(ImmutableBinary Data)

 

func Write(_ Data: ImmutableBinary)

 

Sub Write(Data As ImmutableBinary)

Parameters:

  • Data:

 

Length

Returns the size of this file.

 

property Length: Int64 read write;

 

Int64 Length { get; set; }

 

var Length: Int64 { get{} set{} }

 

Int64 Length { __get; __set; }

 

Property Length() As Int64

Position

Returns the current position in this file.

 

property Position: Int64 read write;

 

Int64 Position { get; set; }

 

var Position: Int64 { get{} set{} }

 

Int64 Position { __get; __set; }

 

Property Position() As Int64

 

FromFile

Create a filehandle from a File object

 

class method FromFile(aFile: File; Mode: FileOpenMode): FileHandle

 

static FileHandle FromFile(File aFile, FileOpenMode Mode)

 

static func FromFile(_ aFile: File, _ Mode: FileOpenMode) -> FileHandle

 

static FileHandle FromFile(File aFile, FileOpenMode Mode)

 

Shared Function FromFile(aFile As File, Mode As FileOpenMode) As FileHandle

Parameters:

  • aFile:
  • Mode:

 

constructor

Creates a new file handle for the given filename.

 

constructor(FileName: String; Mode: FileOpenMode)

 

FileHandle(String FileName, FileOpenMode Mode)

 

init(_ FileName: String, _ Mode: FileOpenMode)

 

FileHandle(String FileName, FileOpenMode Mode)

 

Sub New(FileName As String, Mode As FileOpenMode)

Parameters:

  • FileName:
  • Mode:

Close Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Close the handle.

 

method Close

 

void Close()

 

func Close()

 

void Close()

 

Sub Close()

Flush Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Flush the changes to the file to disk.

 

method Flush

 

void Flush()

 

func Flush()

 

void Flush()

 

Sub Flush()

Read (array of Byte, Integer): Integer Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes into buffer; returning the nr of bytes actually read. Returns 0 when the end has been reached.

 

method Read(Buffer: array of Byte; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Count: Int32) -> Int32

 

Integer Read(Byte[] Buffer, Integer Count)

 

Function Read(Buffer As Byte(), Count As Int32) As Int32

Parameters:

  • Buffer:
  • Count:

Read (array of Byte, Integer, Integer): Integer Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes into buffer; returning the nr of bytes actually read. Returns 0 when the end has been reached.

 

method Read(Buffer: array of Byte; Offset: Int32; Count: Int32): Int32

 

Int32 Read(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Read(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32) -> Int32

 

Integer Read(Byte[] Buffer, Integer Offset, Integer Count)

 

Function Read(Buffer As Byte(), Offset As Int32, Count As Int32) As Int32

Parameters:

  • Buffer:
  • Offset:
  • Count:

Read (Integer): ImmutableBinary Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Read Count bytes from a file, returning it as binary.

 

method Read(Count: Int32): ImmutableBinary

 

ImmutableBinary Read(Int32 Count)

 

func Read(_ Count: Int32) -> ImmutableBinary

 

ImmutableBinary Read(Integer Count)

 

Function Read(Count As Int32) As ImmutableBinary

Parameters:

  • Count:

Seek (Int64, SeekOrigin) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Changes the position, relative to Origin.

 

method Seek(Offset: Int64; Origin: SeekOrigin)

 

void Seek(Int64 Offset, SeekOrigin Origin)

 

func Seek(_ Offset: Int64, _ Origin: SeekOrigin)

 

void Seek(Int64 Offset, SeekOrigin Origin)

 

Sub Seek(Offset As Int64, Origin As SeekOrigin)

Parameters:

  • Offset:
  • Origin:

Write (array of Byte) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte)

 

void Write(Byte[] Buffer)

 

func Write(_ Buffer: Byte...)

 

void Write(Byte[] Buffer)

 

Sub Write(Buffer As Byte())

Parameters:

  • Buffer:

Write (array of Byte, Integer) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Count: Int32)

 

void Write(Byte[] Buffer, Integer Count)

 

Sub Write(Buffer As Byte(), Count As Int32)

Parameters:

  • Buffer:
  • Count:

Write (array of Byte, Integer, Integer) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a byte array to this file.

 

method Write(Buffer: array of Byte; Offset: Int32; Count: Int32)

 

void Write(Byte[] Buffer, Int32 Offset, Int32 Count)

 

func Write(_ Buffer: Byte..., _ Offset: Int32, _ Count: Int32)

 

void Write(Byte[] Buffer, Integer Offset, Integer Count)

 

Sub Write(Buffer As Byte(), Offset As Int32, Count As Int32)

Parameters:

  • Buffer:
  • Offset:
  • Count:

Write (ImmutableBinary) Cooper, Island-Android, Island-iOS, Island-iOS Simulator, Island-Mac Catalyst, Island-macOS, Island-tvOS, Island-tvOS Simulator, Island-Ubuntu, Island-visionOS, Island-visionOS Simulator, Island-watchOS, Island-watchOS Simulator, Island-Windows, Toffee, ToffeeV2

Write a binary to a file.

 

method Write(Data: ImmutableBinary)

 

void Write(ImmutableBinary Data)

 

func Write(_ Data: ImmutableBinary)

 

void Write(ImmutableBinary Data)

 

Sub Write(Data As ImmutableBinary)

Parameters:

  • Data: