The Proxy class has no constructor, and you should not attempt to instantiate Proxy.
Instead, subclass the Proxy class to override methods such as
And, keep in mind, your own code overriding the methods of the Proxy class can throw
exceptions unintentionally. Throwing exceptions when using these methods causes problems because
the calling code (using operators like
The Proxy class is a replacement for the
To avoid collisions with the
Where methods of the Proxy class take a
For example:
For example (with code from
For example (with code from
Note: The ByteArray class is for advanced developers who need to access data on the byte level.
In-memory data is a packed array (the most compact representation for the data type)
of bytes, but an instance of the ByteArray
class can be manipulated with the standard
In addition, zlib compression and decompression are supported, as well as Action Message Format (AMF) object serialization.
Possible uses of the ByteArray class include the following:
Note: when
Notice how a code segment is added at the end to check for end of file errors to ensure that the byte stream is not read past its end.
After the call, the
The zlib compressed data format is described at
The deflate compression algorithm is described at
The deflate compression algorithm is used in several compression formats, such as zlib, gzip, some zip implementations, and others. When data is compressed using one of those compression formats, in addition to storing the compressed version of the original data, the compression format data (for example, the .zip file) includes metadata information. Some examples of the types of metadata included in various file formats are file name, file modification date/time, original file size, optional comments, checksum data, and more.
For example, when a ByteArray is compressed using the zlib algorithm,
the resulting ByteArray is structured in a specific format. Certain bytes contain
metadata about the compressed data, while other bytes contain the actual compressed
version of the original ByteArray data. As defined by the zlib compressed data
format specification, those bytes (that is, the portion containing
the compressed version of the original data) are compressed using the deflate
algorithm. Consequently those bytes are identical to the result of calling
In order to use the deflate format to compress a ByteArray instance's
data in a specific format such as gzip or zip, you cannot simply call
After the call, the
The deflate compression algorithm is described at
In order to use the deflate format to compress a ByteArray instance's
data in a specific format such as gzip or zip, you cannot simply call
After the call, the
The deflate compression algorithm is described at
In order to decode data compressed in a format that uses the deflate compression algorithm,
such as data in gzip or zip format, it will not work to simply call
The returned value is in the range -128 to 127.
The returned value is in the range -2147483648 to 2147483647.
Note: If the value for the
The returned value is in the range -32768 to 32767.
The returned value is in the range 0 to 255.
The returned value is in the range 0 to 4294967295.
The returned value is in the range 0 to 65535.
After the call, the
The zlib compressed data format is described at
The deflate compression algorithm is described at
In order to decode data compressed in a format that uses the deflate compression algorithm,
such as data in gzip or zip format, it will not work to call
The low 8 bits of the parameter are used. The high 24 bits are ignored.
If the
If
Use the
When an object is written to or read from binary data, the
If the length is set to a value that is larger than the current length, the right side of the byte array is filled with zeros.
If the length is set to a value that is smaller than the current length, the byte array is truncated.
All IDataInput and IDataOutput operations are "bigEndian" by default (the most significant byte in the sequence is stored at the lowest or first storage address), and are nonblocking.
Sign extension matters only when you read data, not when you write it. Therefore, you do not need separate
write methods to work with
Notice how a code segment is added at the end to check for end of file errors to ensure that the byte stream is not read past its end.
If the
If the
Content in
The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
A stream using the bigEndian byte order (the most significant byte first) writes:
12 34 56 78
The hexadecimal number 0x12345678 has 4 bytes (2 hexadecimal digits per byte). The most significant byte is 0x12. The least significant byte is 0x78. (For the equivalent decimal number, 305419896, the most significant digit is 3, and the least significant digit is 6).
A stream using the littleEndian byte order (the least significant byte first) writes:
78 56 34 12
If a class does not implement, nor inherits from a class which implements, the IExternalizable interface, then an instance of the class will be serialized using the default mechanism of public members only. As a result, private, internal, and protected members of a class will not be available.
To serialize private members, a class must use the IExternalizable interface. For example, the following class will not serialize any of its members because they are private:
However, if you implement the IExternalizable interface, you can write to, and read from, the data stream the private members of the class as follows:
Note: If a class implements IExternalizable the default serialization no longer applies to instances of that class. If that class inherits public members from a super class, you must carefully manage those members as well.
When a subclass of a class implementing IExternalizable has private members of its own, the subclass must override the methods of IExternalizable, as follows:
The IExternalizable interface can also be used to compress data before writing it to a data stream. For example:
Note:
If the
To obtain the static properties of a type, pass the type itself for the
Note: If you need only to traverse an object's inheritance hierarchy and do not need the other information provided by
The following table describes some of the tags and attributes of the XML object generated by
After you retrieve the name of a class with this function, you can convert the class name to a class reference with the
Note: This function restricts itself to instance hierarchies, whereas the
For a calendar date (timestamp), see the Date object.
Each call of the
A loop is created to count to one million. If the system can process this request faster
than a second can expire,
Instead of using the
If you intend to use the
Instead of using this method, consider
creating a Timer object, with the specified interval, using 1 as the
If you intend to use the
You can create Timer objects to run once or repeat at specified intervals to execute code on a schedule.
The timer does not start automatically; you must call the
A Timer object is created that starts in 30 seconds (delay is set to 30000 milliseconds) and repeats three times, for a total of 90 seconds. (The timer stops after the third time.)
Two event listeners are added for the
Note: The Timer class keeps track of the number of times it has to start
(
After the timer is called for the last time, the
Note: A
All IDataInput and IDataOutput operations are "bigEndian" by default (the most significant
byte in the sequence is stored at the lowest or first storage address),
and are nonblocking.
If insufficient data is available, an
Sign extension matters only when you read data, not when you write it. Therefore you do not need separate
write methods to work with
Notice how a code segment is added at the end to check for end of file errors to ensure that the byte stream is not read past its end.
Note: If the value for the
This method is similar to the
The following statements show the relationship between a Dictionary object and a key object:
var dict = new Dictionary(); var obj = new Object(); var key:Object = new Object(); key.toString = function() { return "key" } dict[key] = "Letters"; obj["key"] = "Letters"; dict[key] == "Letters"; // true obj["key"] == "Letters"; // true obj[key] == "Letters"; // true because key == "key" is true b/c key.toString == "key" dict["key"] == "Letters"; // false because "key" === key is false delete dict[key]; //removes the key