Android Programming Press on the image to return to the main documentation page.

iRandomAccessFile

List of types:

AsyncStreams
B4XSerializator
ByteConverter
CompressedStreams
RandomAccessFile

AsyncStreams


Events:

NewData (Buffer() As Byte)
Error
Terminated
NewStream (Dir As String, FileName As String)

Members:


  Close

  Initialize (In As Object, Out As Object, EventName As String)

  InitializePrefix (In As Object, BigEndian As Boolean, Out As Object, EventName As String)

  IsInitialized As Boolean

  OutputQueueSize As Int

  SendAllAndClose As Boolean

  StreamFolder As String

  StreamReceived As Long

  StreamTotal As Long

  Write (Buffer() As Byte) As Boolean

  Write2 (Buffer() As Byte, Start As Int, Length As Int) As Boolean

  WriteStream (In As Object, Size1 As Long) As Boolean

Members description:

Close
Closes the monitored streams.
Initialize (In As Object, Out As Object, EventName As String)
Initializes AsyncStreams in standard mode.
InitializePrefix (In As Object, BigEndian As Boolean, Out As Object, EventName As String)
Initializes AsyncStreams in prefix mode. This mode can only be used if both sides of the connection adhere to the "prefix" protocol.
In / Out - The monitored streams.
BigEndian - The prefix endianess.
IsInitialized As Boolean
OutputQueueSize As Int
SendAllAndClose As Boolean
Sends a message to the internal message queue. AsyncStreams will be closed when the message is processed.
The Terminated event will be raised.
Returns False is AsyncStreams is closed.
StreamFolder As String
Gets or sets the folder that is used when receiving streams.
StreamReceived As Long
StreamTotal As Long
Write (Buffer() As Byte) As Boolean
Asynchronously writes all the data in the array.
Write2 (Buffer() As Byte, Start As Int, Length As Int) As Boolean
Asynchronously writes the data.
Buffer - The array holding the data.
Start - The position in the array of the first byte that will be written.
Length - Number of bytes to write.
WriteStream (In As Object, Size1 As Long) As Boolean

B4XSerializator


Events:

ObjectToBytes (Success As Boolean, Bytes() As Byte)
BytesToObject (Success As Boolean, NewObject As Object)

Members:


  ConvertBytesToObject (Bytes() As Byte) As Object

  ConvertBytesToObjectAsync (Bytes() As Byte, EventName As String)

  ConvertObjectToBytes (Object As Object) As Byte()

  ConvertObjectToBytesAsync (Object As Object, EventName As String)

  Tag As Object

Members description:

ConvertBytesToObject (Bytes() As Byte) As Object
In-memory version of RandomAccessFile.ReadB4XObject.
ConvertBytesToObjectAsync (Bytes() As Byte, EventName As String)
Asynchronously converts the bytes to object. The BytesToObject event will be raised when the object is ready.
Do not reuse the same B4XSerializator instance when calling asynchronous methods.
ConvertObjectToBytes (Object As Object) As Byte()
In-memory version of RandomAccessFile.WriteB4XObject.
This method is capable of writing the following types: Lists, Arrays, Maps, Strings, primitive types and user types.
Combinations of these types are also supported.
ConvertObjectToBytesAsync (Object As Object, EventName As String)
Asynchronously converts the object to bytes. The ObjectToBytes event will be raised with the serialized bytes.
Do not reuse the same B4XSerializator instance when calling asynchronous methods.
Tag As Object

ByteConverter


Events:

None

Members:


  ArrayCopy (Src() As Byte, SrcOffset As Int, Dest() As Byte, DestOffset As Int, Count As Int)

  DoublesFromBytes (Bytes() As Byte) As Double()

  DoublesToBytes (Doubles() As Double) As Byte()

  FloatsFromBytes (Bytes() As Byte) As Float()

  FloatsToBytes (Doubles() As Float) As Byte()

  HexFromBytes (Bytes() As Byte) As String

  HexToBytes (Hex As String) As Byte()

  IntsFromBytes (Bytes() As Byte) As Int()

  IntsToBytes (Ints() As Int) As Byte()

  LittleEndian As Boolean

  LongsFromBytes (Bytes() As Byte) As Long()

  LongsToBytes (Longs() As Long) As Byte()

  ShortsFromBytes (Bytes() As Byte) As Short()

  ShortsToBytes (Shorts() As Short) As Byte()

  StringFromBytes (Bytes() As Byte, Encoding As String) As String

  StringToBytes (Str As String, Encoding As String) As Byte()

  SupportedEncodings As String()

Members description:

ArrayCopy (Src() As Byte, SrcOffset As Int, Dest() As Byte, DestOffset As Int, Count As Int)
Copies data from the source array to the destination array.
Src - The source array.
SrcOffset - The position of the first byte that will be copied.
Dest - The destination array.
DestOffset - The position in the destination array of the first byte.
Count - Number of bytes to copy.
DoublesFromBytes (Bytes() As Byte) As Double()
Converts an array of Bytes to an array of Doubles. Each 8 bytes are converted to a Double.
DoublesToBytes (Doubles() As Double) As Byte()
Converts an array of Doubles to an array of Bytes. Each Double is converted to 8 bytes.
FloatsFromBytes (Bytes() As Byte) As Float()
Converts an array of Bytes to an array of Floats. Each 4 bytes are converted to a Float.
FloatsToBytes (Doubles() As Float) As Byte()
Converts an array of Floats to an array of Bytes. Each Float is converted to 4 bytes.
HexFromBytes (Bytes() As Byte) As String
Returns the hex representation of the given bytes.
HexToBytes (Hex As String) As Byte()
Parses a hex string to an array of bytes.
IntsFromBytes (Bytes() As Byte) As Int()
Converts an array of Bytes to an array of Ints. Each 4 bytes are converted to an Int.
IntsToBytes (Ints() As Int) As Byte()
Converts an array of Ints to an array of Bytes. Each Int is converted to 4 bytes.
LittleEndian As Boolean
Gets or sets the converter endianess. The default value is False (big endian).
LongsFromBytes (Bytes() As Byte) As Long()
Converts an array of Bytes to an array of Longs. Each 8 bytes are converted to a Long.
LongsToBytes (Longs() As Long) As Byte()
Converts an array of Longs to an array of Bytes. Each Long is converted to 8 bytes.
ShortsFromBytes (Bytes() As Byte) As Short()
Converts an array of Bytes to an array of Shorts. Each 2 bytes are converted to a Short.
ShortsToBytes (Shorts() As Short) As Byte()
Converts an array of Shorts to an array of Bytes. Each Short is converted to 2 bytes.
StringFromBytes (Bytes() As Byte, Encoding As String) As String
Converts the bytes to a string. Similar to BytesToString keyword.
StringToBytes (Str As String, Encoding As String) As Byte()
Converts the string to an array of bytes.
SupportedEncodings As String()
Returns an array of strings with the supported encodings.

CompressedStreams


Events:

None

Members:


  CompressBytes (Data() As Byte, CompressMethod As String) As Byte()

  DecompressBytes (CompressedData() As Byte, CompressMethod As String) As Byte()

Members description:

CompressBytes (Data() As Byte, CompressMethod As String) As Byte()
Compresses the Data array using zlib or gzip compression. Returns the compressed data as an array of bytes.
Data - The data to compress.
CompressMethod - "zlib" or "gzip"
DecompressBytes (CompressedData() As Byte, CompressMethod As String) As Byte()
Decompresses the data using zlib or gzip compression. Returns the uncompressed data as an array of bytes.
CompressedData - The data to decompress.
CompressMethod - "zlib" or "gzip"

RandomAccessFile


Events:

None

Members:


  Close

  CurrentPosition As Long

  Flush

  Initialize (Dir As String, FileName As String, ReadOnly As Boolean)

  Initialize2 (Dir As String, FileName As String, ReadOnly As Boolean, LittleEndian As Boolean)

  Initialize3 (Buffer() As Byte, LittleEndian As Boolean)

  ReadB4XObject (Position As Long) As Object

  ReadBytes (Buffer() As Byte, StartOffset As Int, Length As Int, Position As Long)

  ReadDouble (Position As Long) As Double

  ReadFloat (Position As Long) As Float

  ReadInt (Position As Long) As Int

  ReadLong (Position As Long) As Long

  ReadShort (Position As Long) As Short

  ReadSignedByte (Position As Long) As Int

  ReadUnsignedByte (Position As Long) As Byte

  Size As Long [read only]

  WriteB4XObject (Object As Object, Position As Long)

  WriteByte (Value As Byte, Position As Long)

  WriteBytes (Buffer() As Byte, StartOffset As Int, Length As Int, Position As Long)

  WriteDouble (Value As Double, Position As Long)

  WriteFloat (Value As Float, Position As Long)

  WriteInt (Value As Int, Position As Long)

  WriteLong (Value As Long, Position As Long)

  WriteShort (Value As Short, Position As Long)

Members description:

Close
Closes the file.
CurrentPosition As Long
Returns the current file position. The position is updated automatically after each operation.
Flush
Writes any cached data to the file.
Initialize (Dir As String, FileName As String, ReadOnly As Boolean)
Opens the specified file in big endian mode.
Initialize2 (Dir As String, FileName As String, ReadOnly As Boolean, LittleEndian As Boolean)
Opens the specified file with the specified endianess mode.
Initialize3 (Buffer() As Byte, LittleEndian As Boolean)
Treats the array of bytes as a random access file with a constant size.
ReadB4XObject (Position As Long) As Object
Reads an object previously saved with WriteB4XObject. See WriteB4XObject for the supported types.
ReadBytes (Buffer() As Byte, StartOffset As Int, Length As Int, Position As Long)
Reads the bytes from Position to Position + Length (exclusive) and writes them to the given array starting from StartOffset.
The position is updated automatically.
ReadDouble (Position As Long) As Double
Reads a Double value (8 bytes). The position is updated automatically.
ReadFloat (Position As Long) As Float
Reads a Float value (4 bytes). The position is updated automatically.
ReadInt (Position As Long) As Int
Reads an Int value (4 bytes). The position is updated automatically.
ReadLong (Position As Long) As Long
Reads a Long value (8 bytes). The position is updated automatically.
ReadShort (Position As Long) As Short
Reads a Short value (2 bytes). The position is updated automatically.
ReadSignedByte (Position As Long) As Int
ReadUnsignedByte (Position As Long) As Byte
Reads a single byte. The position is updated automatically.
Size As Long [read only]
Returns the total size.
WriteB4XObject (Object As Object, Position As Long)
Writes the given object to the file.
This method is capable of writing the following types: Lists, Arrays, Maps, Strings, primitive types and user types.
Combinations of these types are also supported.
WriteByte (Value As Byte, Position As Long)
Writes a single Byte. The position is updated automatically.
WriteBytes (Buffer() As Byte, StartOffset As Int, Length As Int, Position As Long)
Writes the bytes from the array to the file. The position is updated automatically.
WriteDouble (Value As Double, Position As Long)
Writes Double value (8 bytes). The position is updated automatically.
WriteFloat (Value As Float, Position As Long)
Writes a Float value (4 bytes). The position is updated automatically.
WriteInt (Value As Int, Position As Long)
Writes an Int value (4 bytes). The position is updated automatically.
WriteLong (Value As Long, Position As Long)
Writes a Long value (8 bytes). The position is updated automatically.
WriteShort (Value As Short, Position As Long)
Writes a Short value (2 bytes). The position is updated automatically.
Top