Packagestarling.utils
Classpublic class ByteArrayUtil
InheritanceByteArrayUtil Inheritance Object

A utility class containing methods related to the ByteArray class.



Public Methods
 MethodDefined By
  
compareByteArrays(a:ByteArray, indexA:int, b:ByteArray, indexB:int, numBytes:int = -1):Boolean
[static] Compares the range of bytes within two byte arrays.
ByteArrayUtil
  
startsWithBytes(byteArray:ByteArray, firstBytes:Array):Boolean
[static] Figures out if a byte array starts with the given bytes.
ByteArrayUtil
  
startsWithString(bytes:ByteArray, string:String):Boolean
[static] Figures out if a byte array starts with the UTF bytes of a certain string.
ByteArrayUtil
Method Detail
compareByteArrays()method
public static function compareByteArrays(a:ByteArray, indexA:int, b:ByteArray, indexB:int, numBytes:int = -1):Boolean

Compares the range of bytes within two byte arrays.

Parameters

a:ByteArray
 
indexA:int
 
b:ByteArray
 
indexB:int
 
numBytes:int (default = -1)

Returns
Boolean
startsWithBytes()method 
public static function startsWithBytes(byteArray:ByteArray, firstBytes:Array):Boolean

Figures out if a byte array starts with the given bytes. Pass an array that contains integers in the range 0-255.

Parameters

byteArray:ByteArray
 
firstBytes:Array

Returns
Boolean
startsWithString()method 
public static function startsWithString(bytes:ByteArray, string:String):Boolean

Figures out if a byte array starts with the UTF bytes of a certain string. If the array starts with a 'BOM', it is ignored; so are leading zeros and whitespace.

Parameters

bytes:ByteArray
 
string:String

Returns
Boolean