Packageshell
Classpublic class BinaryData
InheritanceBinaryData Inheritance ByteArray Inheritance Object

Language Version : ActionScript 3.0
Runtime Versions : RedTamarin 0.4

Allows to create a subclass with metadata to embed binary data.

To define the binary uses the metadata [HexData].

You will need to use the -md option when compiling with ASC.

View the examples



Public Properties
 PropertyDefined By
 InheritedbytesAvailable : uint
[read-only] The number of bytes of data available for reading from the current position in the byte array to the end of the array.
ByteArray
 InheriteddefaultObjectEncoding : uint
[static] Denotes the default object encoding for the ByteArray class to use for a new ByteArray instance.
ByteArray
 Inheritedendian : String
Changes or reads the byte order for the data; either Endian.BIG_ENDIAN or Endian.LITTLE_ENDIAN.
ByteArray
 Inheritedlength : uint
The length of the ByteArray object, in bytes.
ByteArray
 InheritedobjectEncoding : uint
Used to determine whether the ActionScript 3.0, ActionScript 2.0, or ActionScript 1.0 format should be used when writing to, or reading from, a ByteArray instance.
ByteArray
 Inheritedposition : uint
Moves, or returns the current position, in bytes, of the file pointer into the ByteArray object.
ByteArray
 Inheritedshareable : Boolean
Every byte array can either be "non-shareable" or "shareable".
ByteArray
Public Methods
 MethodDefined By
  
BinaryData
 Inherited
_init():*
[static]
_init
 Inherited
atomicCompareAndSwapIntAt(byteIndex:int, expectedValue:int, newValue:int):int
Atomic compare and swap of integer values in adjacent bytes in this byte array.
ByteArray
 Inherited
atomicCompareAndSwapLength(expectedLength:int, newLength:int):int
Atomic compare and change the length of this byte array.
ByteArray
 Inherited
clear():void
Clears the contents of the byte array and resets the length and position properties to 0.
ByteArray
 Inherited
compress(algorithm:String):void
Compresses the byte array.
ByteArray
 Inherited
deflate():void
Compresses the byte array using the deflate compression algorithm.
ByteArray
 Inherited
AS3
 Inherited
inflate():void
Decompresses the byte array using the deflate compression algorithm.
ByteArray
 Inherited
init():*
[static]
init
 Inherited
AS3
 Inherited
AS3
 Inherited
Reads a Boolean value from the byte stream.
ByteArray
 Inherited
Reads a signed byte from the byte stream.
ByteArray
 Inherited
readBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void
Reads the number of data bytes, specified by the length parameter, from the byte stream.
ByteArray
 Inherited
Reads an IEEE 754 double-precision (64-bit) floating-point number from the byte stream.
ByteArray
 Inherited
Reads an IEEE 754 single-precision (32-bit) floating-point number from the byte stream.
ByteArray
 Inherited
Reads a signed 32-bit integer from the byte stream.
ByteArray
 Inherited
readMultiByte(length:uint, charSet:String):String
Reads a multibyte string of specified length from the byte stream using the specified character set.
ByteArray
 Inherited
Reads an object from the byte array, encoded in AMF serialized format.
ByteArray
 Inherited
Reads a signed 16-bit integer from the byte stream.
ByteArray
 Inherited
Reads an unsigned byte from the byte stream.
ByteArray
 Inherited
Reads an unsigned 32-bit integer from the byte stream.
ByteArray
 Inherited
Reads an unsigned 16-bit integer from the byte stream.
ByteArray
 Inherited
Reads a UTF-8 string from the byte stream.
ByteArray
 Inherited
Reads a sequence of UTF-8 bytes specified by the length parameter from the byte stream and returns a string.
ByteArray
 Inherited
Converts the byte array to a string.
ByteArray
 Inherited
uncompress(algorithm:String):void
Decompresses the byte array.
ByteArray
 Inherited
writeBoolean(value:Boolean):void
Writes a Boolean value.
ByteArray
 Inherited
writeByte(value:int):void
Writes a byte to the byte stream.
ByteArray
 Inherited
writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void
Writes a sequence of length bytes from the specified byte array, bytes, starting offset(zero-based index) bytes into the byte stream.
ByteArray
 Inherited
writeDouble(value:Number):void
Writes an IEEE 754 double-precision (64-bit) floating-point number to the byte stream.
ByteArray
 Inherited
writeFloat(value:Number):void
Writes an IEEE 754 single-precision (32-bit) floating-point number to the byte stream.
ByteArray
 Inherited
writeInt(value:int):void
Writes a 32-bit signed integer to the byte stream.
ByteArray
 Inherited
writeMultiByte(value:String, charSet:String):void
Writes a multibyte string to the byte stream using the specified character set.
ByteArray
 Inherited
writeObject(object:*):void
Writes an object into the byte array in AMF serialized format.
ByteArray
 Inherited
writeShort(value:int):void
Writes a 16-bit integer to the byte stream.
ByteArray
 Inherited
Writes a 32-bit unsigned integer to the byte stream.
ByteArray
 Inherited
writeUTF(value:String):void
Writes a UTF-8 string to the byte stream.
ByteArray
 Inherited
writeUTFBytes(value:String):void
Writes a UTF-8 string to the byte stream.
ByteArray
Protected Methods
 MethodDefined By
 Inherited
[static]
protected
 Inherited
_setPropertyIsEnumerable(o:*, V:String, enumerable:Boolean):void
[static]
protected
Public Constants
 ConstantDefined By
 Inheritedlength : int = 1
[static]
length
Constructor Detail
BinaryData()Constructor
public function BinaryData()



Examples
Usage
     import shell.BinaryData;
     import flash.utils.ByteArray;
     
     // define a class that extend BinaryData
     // and use the metadata to define the binary in hexadecimal
     [HexData("aabbccdd")]
     public class BlobOfData extends BinaryData
     {
     }
     
     
     // then later, instanciate the class
     var binary:BlobOfData = new BlobOfData();
     
     // to get the original data, you can copy it
     var original1:ByteArray = new ByteArray();
         original1.writeBytes( binary, 0, binary.length );
     
     // or you can downcast it
     var original2:ByteArray = binary as ByteArray;
     
Compilation
     java -jar asc.jar -AS3 -md -import redtamarin.abc test.as