| Package | flash.errors |
| Class | public dynamic class EOFError |
| Inheritance | EOFError IOError Error Object |
See also
| Method | Defined By | ||
|---|---|---|---|
|
Creates a new EOFError object.
| EOFError | ||
![]() |
Returns the call stack for an error as a string at the time of the error's construction (for the debugger version
of Flash Player and the AIR Debug Launcher (ADL) only; returns null if not using the debugger version
of Flash Player or the ADL.
| Error | |
![]() |
Indicates whether an object has a specified property defined.
| Object | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter.
| Object | |
![]() |
Indicates whether the specified property exists and is enumerable.
| Object | |
![]() |
Sets the availability of a dynamic property for loop operations.
| Object | |
![]() |
Returns the string "Error" by default or the value contained in the Error.message property,
if defined.
| Error | |
![]() |
Returns the primitive value of the specified object.
| Object | |
| EOFError | () | Constructor |
public function EOFError(message:String = "")
Creates a new EOFError object.
Parametersmessage:String (default = "") — A string associated with the error object.
|
EOFErrorExample class to show
the error generated if an attempt is made to read past the end of the available
data. This is accomplished with the following steps:
byteArr and writes a Boolean
value of false into the byte stream using writeBoolean(). byteArr is reset to 0 (start of the data stream).readBoolean(). The
data stream now contains no data.readBoolean()
is called a second time and the EOFError is caught and passed to a trace()
statement, which outputs the error message associated with EOFError objects.
package {
import flash.display.Sprite;
import flash.errors.EOFError;
import flash.utils.ByteArray;
public class EOFErrorExample extends Sprite {
public function EOFErrorExample() {
var byteArr:ByteArray = new ByteArray();
byteArr.writeBoolean(false);
trace(byteArr.length); // 1
byteArr.position = 0;
try {
trace(byteArr.readBoolean()); // false
}
catch(e:EOFError) {
trace(e);
}
try {
trace(byteArr.readBoolean());
}
catch(e:EOFError) {
trace(e); // EOFError: Error #2030: End of file was encountered.
}
}
}
}