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

ByteConverter

This library contains a ByeConverter object that can transform arrays of primitive
types to and from arrays of Bytes specifying the "endian-ness" of the conversion
and also provides for the copying of part or all of the contents of one array to
another array of the same type.

Byte arrays can be transformed to and from a hexadecimal string representation and
Strings can be transformed to and from arrays of Bytes using specified encodings.

List of types:

ByteConverter

ByteConverter

This ByeConverter object can transform arrays of primitive types to and from arrays
of Bytes with the "endian-ness" of the conversion specified.

Byte arrays can be transformed to and from a hexadecimal string representation.

Strings can be transformed to and from arrays of Bytes using specified encodings and
to and from arrays of Chars.

An array copy method is thrown in for good measure.

Events:

None

Members:


  ArrayCopy (src As Object, srcOffset As Int, dest As Object, destOffset As Int, count As Int)

  CharsFromBytes (bytes() As ByteAs Char()

  CharsToBytes (vals() As CharAs Byte()

  DoublesFromBytes (bytes() As ByteAs Double()

  DoublesToBytes (vals() As DoubleAs Byte()

  FloatsFromBytes (bytes() As ByteAs Float()

  FloatsToBytes (vals() As FloatAs Byte()

  FromChars (chars() As CharAs String

  HexFromBytes (bytes() As ByteAs String

  HexToBytes (hex As StringAs Byte()

  IntsFromBytes (bytes() As ByteAs Int()

  IntsToBytes (vals() As IntAs Byte()

  LittleEndian As Boolean

  LongsFromBytes (bytes() As ByteAs Long()

  LongsToBytes (vals() As LongAs Byte()

  ShortsFromBytes (bytes() As ByteAs Short()

  ShortsToBytes (vals() As ShortAs Byte()

  StringFromBytes (bytes() As Byte, encoding As StringAs String

  StringToBytes (str As String, encoding As StringAs Byte()

  SupportedEncodings As String()

  ToChars (str As StringAs Char()

  Version As Double  [read only]

Members description:

ArrayCopy (src As Object, srcOffset As Int, dest As Object, destOffset As Int, count As Int)
Copies count elements from the srcoffset in the src array to destoffset in the dest array.
The arrays need to be of the same type otherwise an ArrayStoreException is thrown.
CharsFromBytes (bytes() As ByteAs Char()
Takes an array of Bytes and returns an array of Chars converted from that array.
CharsToBytes (vals() As CharAs Byte()
Takes an array of Chars and returns an array of Bytes converted from that array.
DoublesFromBytes (bytes() As ByteAs Double()
Takes an array of Bytes and returns an array of Doubles converted from that array.
DoublesToBytes (vals() As DoubleAs Byte()
Takes an array of Doubles and returns an array of Bytes converted from that array.
FloatsFromBytes (bytes() As ByteAs Float()
Takes an array of Bytes and returns an array of Floats converted from that array.
FloatsToBytes (vals() As FloatAs Byte()
Takes an array of Floats and returns an array of Bytes converted from that array.
FromChars (chars() As CharAs String
Returns a string converted from the specified array of characters.
HexFromBytes (bytes() As ByteAs String
Returns a string containing the representation in hexadecimal of the bytes in a byte array.
HexToBytes (hex As StringAs Byte()
Returns an array of bytes containing the data represented by a hexadecimal string. The string can be upper or lower case.
IntsFromBytes (bytes() As ByteAs Int()
Takes an array of Bytes and returns an array of Ints converted from that array.
IntsToBytes (vals() As IntAs Byte()
Takes an array of Ints and returns an array of Bytes converted from that array.
LittleEndian As Boolean
Gets or sets the endian-ness of byte conversions to and from other primitive values.
The default for Android is Big_Endian, Windows PCs are Little_Endian.
LongsFromBytes (bytes() As ByteAs Long()
Takes an array of Bytes and returns an array of Longs converted from that array.
LongsToBytes (vals() As LongAs Byte()
Takes an array of Longs and returns an array of Bytes converted from that array.
ShortsFromBytes (bytes() As ByteAs Short()
Takes an array of Bytes and returns an array of Shorts converted from that array.
ShortsToBytes (vals() As ShortAs Byte()
Takes an array of Shorts and returns an array of Bytes converted from that array.
StringFromBytes (bytes() As Byte, encoding As StringAs String
Returns a string containing the bytes in the array interpreted as characters according to encoding.
StringToBytes (str As String, encoding As StringAs Byte()
Returns an array of bytes containing the the characters in str converted to bytes according to encoding.
SupportedEncodings As String()
Returns a string array containing all the values for encodings that are supported by this system.
ToChars (str As StringAs Char()
Returns an array of chars comprising the characters of the specified string
Version As Double  [read only]
Returns the version number of this library.
Top