Gets a reference to the internal array of bytes.
On the Flash side, this is a ByteArray.
On the JS side, it's a Uint8Array.
This is primarily used for indexed access to the bytes, and particularly
where platform-specific performance optimization is required.
To maintain cross-target consistency, you should not alter the length
of the ByteArray in any swf specific code, you should assume its length is fixed
(even though it is not).
Implementation public function get array():ByteArray
bytesAvailable
property
bytesAvailable:uint [read-only]
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
The total number of bytes available to read from the current position.
Implementation public function get bytesAvailable():uint
data
property
data:Object [read-only]
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Get the platform-specific data for sending.
Generally only used by the network services.
Implementation public function get data():Object
endian
property
endian:String
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Indicates the byte order for the data.
The default is Endian BIG_ENDIAN.
It is possible to check the default system Endianness of the target platform at runtime with
org.apache.flex.utils.Endian.systemEndian.
Setting to values other than Endian.BIG_ENDIAN or Endian.LITTLE_ENDIAN is ignored.
Implementation public function get endian():String public function set endian(value:String):void
length
property
length:int
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
The length of this BinaryData, in bytes.
If the length is set to a value that is larger than the current length, the right side
of the BinaryData is filled with zeros.
If the length is set to a value that is smaller than the current length, the BinaryData is truncated.
Implementation public function get length():int public function set length(value:int):void
position
property
position:uint
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Moves, or returns the current position, in bytes, of the pointer into the BinaryData object.
This is the point at which the next call to a read method starts reading or a write method starts writing.
Setting the position beyond the end of the current length value is possible and will increase the length
during write operations, but will throw an error during read operations.
Implementation public function get position():uint public function set position(value:uint):void
Constructor Detail
BinaryData
()
Constructor
public function BinaryData(bytes:ByteArray = null)
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Constructor. The constructor takes an optional bytes argument.
In Flash this should be a ByteArray. In JS this should be an ArrayBuffer
Parameters
bytes:ByteArray (default = null)
Method Detail
fromString
()
method
public static function fromString(str:String):BinaryData
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Utility method to create a BinaryData object from a string.
Parameters
str:String — str The string to convert to BinaryData as UTF-8 bytes.
Returns
BinaryData — {BinaryData} The BinaryData instance from the UTF-8 bytes of the string.
growBuffer
()
method
public function growBuffer(extra:uint):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
A convenience method to extend the length of the BinaryData
so you can efficiently write more bytes to it. Not all
browsers have a way to auto-resize a binary
data as you write data to the binary data buffer
and resizing in large chunks is generally more
efficient anyway. Preallocating bytes to write into
is also more efficient on the swf target.
Parameters
extra:uint — The number of additional bytes.
readBoolean
()
method
public function readBoolean():Boolean
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads a Boolean value (as a single byte) at the current position.
returns true if the byte was non-zero, false otherwise
Returns
Boolean — {Boolean} The boolean value read from the current position
readByte
()
method
public function readByte():int
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read a signed byte of binary data at the current position
Returns
int — {int} An int value in the range -128 to 127, read from the current position
readByteAt
()
method
public function readByteAt(idx:uint):uint
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read a byte of binary data at the specified index. Does not change the position property.
If an index is out of range (beyond the current length) this will return zero.
Parameters
idx:uint
Returns
uint — {uint} A byte value in the range 0-255 from the index
readBytes
()
method
public function readBytes(destination:BinaryData, offset:uint = 0, length:uint = 0):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads the number of data bytes, specified by the length parameter, from the BinaryData.
The bytes are read into the BinaryData object specified by the destination parameter,
and the bytes are written into the destination BinaryData starting at the position specified by offset.
If length is omitted or is zero, all bytes are read following the current position to the end
of this BinaryData. If offset is also omitted, it defaults to zero.
Parameters
destination:BinaryData — destination The destination BinaryData to write bytes into from the current position
offset:uint (default = 0) — offset The optional offset value of the starting bytes to write inside destination
length:uint (default = 0) — length The optional length value of the bytes to read
readDouble
()
method
public function readDouble():Number
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads an IEEE 754 double-precision (64-bit) floating-point number from the BinaryData.
Returns
Number — {Number} A Number value, read from the current position
readFloat
()
method
public function readFloat():Number
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads an IEEE 754 single-precision (32-bit) floating-point number from the BinaryData.
Returns
Number — {Number} A Number value, read from the current position
readInt
()
method
public function readInt():int
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read a signed int (32bit) of binary data at the current position
Returns
int — {int} An int value, read from the current position
readShort
()
method
public function readShort():int
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read a short int of binary data at the current position
Returns
int — {int} An int value in the range -32768 to 32767, read from the current position
readUnsignedByte
()
method
public function readUnsignedByte():uint
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read an unsigned byte of binary data at the current position
Returns
uint — {uint} An uint value in the range 0 to 255, read from the current position
readUnsignedInt
()
method
public function readUnsignedInt():uint
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read an unsigned int (32bit) of binary data at the current position
Returns
uint — {uint} A uint value, read from the current position
readUnsignedShort
()
method
public function readUnsignedShort():uint
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Read an unsigned short (16bit) of binary data at the current position
Returns
uint — {uint} A uint value in the range 0 to 65535, read from the current position
readUTF
()
method
public function readUTF():String
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads a UTF-8 string from the BinaryData.
The string is assumed to be prefixed with an unsigned short indicating the length in bytes.
The position is advanced to the first byte following the string's bytes.
Returns
String — {String} The utf-8 decoded string
readUTFBytes
()
method
public function readUTFBytes(length:uint):String
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Reads a sequence of UTF-8 bytes specified by the length parameter
from the BinaryData and returns a string.
The position is advanced to the first byte following the string's bytes.
Parameters
length:uint — length An unsigned short indicating the length of the UTF-8 bytes.
Returns
String
writeBoolean
()
method
public function writeBoolean(value:Boolean):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Write a Boolean value (as a single byte) at the current position
Parameters
value:Boolean — value The boolean value to write into the BinaryData at the current position
writeByte
()
method
public function writeByte(byte:int):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Write a byte of binary data at the current position
Parameters
byte:int — byte The value to write into the BinaryData at the current position
writeByteAt
()
method
public function writeByteAt(idx:uint, byte:int):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes a byte of binary data at the specified index. Does not change the position property.
This is a method for optimzed writes with no range checking.
If the specified index is out of range, it can throw an error.
Parameters
idx:uint
byte:int
writeBytes
()
method
public function writeBytes(source:BinaryData, offset:uint = 0, length:uint = 0):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes a sequence of length bytes from the source BinaryData, starting
at offset (zero-based index) bytes into the source BinaryData. If length
is omitted or is zero, it will represent the entire length of the source
starting from offset. If offset is omitted also, it defaults to zero.
Parameters
source:BinaryData — source The source BinaryData to write from at the current position
offset:uint (default = 0) — offset The optional offset value of the starting bytes to write inside source
length:uint (default = 0) — length The optional length value of the bytes to write from offset in source
writeDouble
()
method
public function writeDouble(val:Number):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes an IEEE 754 double-precision (64-bit) floating-point number to the
BinaryData at the current position
Parameters
val:Number — val The value to write into the BinaryData at the current position
writeFloat
()
method
public function writeFloat(val:Number):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes an IEEE 754 single-precision (32-bit) floating-point number to the
BinaryData at the current position
Parameters
val:Number — val The value to write into the BinaryData at the current position
writeInt
()
method
public function writeInt(val:int):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Write a signed int (32 bits) of binary data at the current position
Parameters
val:int — val The value to write into the BinaryData at the current position
writeShort
()
method
public function writeShort(short:int):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Write a short integer (16 bits, typically represented by a 32 bit int parameter between -32768 and 65535)
of binary data at the current position
Parameters
short:int — short The value to write into the BinaryData at the current position
writeUnsignedInt
()
method
public function writeUnsignedInt(val:uint):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Write an unsigned int (32 bits) of binary data at the current position
Parameters
val:uint — val The value to write into the BinaryData at the current position
writeUTF
()
method
public function writeUTF(str:String):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes a UTF-8 string to the byte stream.
The length of the UTF-8 string in bytes is written first, as a 16-bit unsigned integer,
followed by the bytes representing the characters of the string.
If the byte length of the string is larger than 65535 this will throw a RangeError
The position is advanced to the first byte following the string's bytes.
Parameters
str:String — str The string value to be written.
writeUTFBytes
()
method
public function writeUTFBytes(str:String):void
Language Version :
ActionScript 3.0
Product Version :
FlexJS 0.7.0
Runtime Versions :
Flash Player 10.2, AIR 2.6
Writes a UTF-8 string to the BinaryData. Similar to the writeUTF() method,
but writeUTFBytes() does not prefix the string with a 16-bit length word, and
therefore also permits strings longer than 65535 bytes (note: byte length will not
necessarily be the same as string length because some characters can be
multibyte characters).