com.flagstone.transform.coder
Class CoderException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by com.flagstone.transform.coder.CoderException
All Implemented Interfaces:
Serializable

public final class CoderException
extends IOException

CoderException is thrown when errors occur while encoding or decoding objects. Errors are reported as either underflow or overflow errors indicating that the class used to encode/decode a particular data structure did not encode or decode the expected number of bytes. This allows the majority of software errors and errors due to improperly encoded flash files to be detected.

See Also:
Serialized Form

Constructor Summary
CoderException(int location, int size, int difference)
          Creates a CoderException to report where a problem occurred when encoding or decoding a Flash (.swf) file.
CoderException(int location, String message)
          Creates a CoderException to report where a problem occurred when encoding or decoding a Flash (.swf) file.
 
Method Summary
 int getDelta()
          Get the difference between the expected number of bytes and the actual number of bytes encoded or decoded.
 int getLength()
          Get number of bytes the object was expected to occupy when encoded.
 int getStart()
          Get the byte address of the start of the object that caused the error.
 String toString()
          Get a string representation of the error.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoderException

public CoderException(int location,
                      String message)
Creates a CoderException to report where a problem occurred when encoding or decoding a Flash (.swf) file.

Parameters:
location - the address in the file where the data structure being encoded/decoded is located. This is only valid for files being decoded since the encoded file will not be written if an exception occurs.
message - a short description of the error.

CoderException

public CoderException(int location,
                      int size,
                      int difference)
Creates a CoderException to report where a problem occurred when encoding or decoding a Flash (.swf) file.

Parameters:
location - the address in the file where the data structure being encoded/decoded is located. This is only valid for files being decoded since the encoded file will not be written if an exception occurs.
size - the number of bytes that were expected to be encoded or decoded.
difference - the difference between the expected number of bytes and the actual number encoded or decoded.
Method Detail

getStart

public int getStart()
Get the byte address of the start of the object that caused the error.

Returns:
the location of the start of the encoded object when the error occurred.

getLength

public int getLength()
Get number of bytes the object was expected to occupy when encoded.

Returns:
get the number of bytes expected to be encoded or decoded.

getDelta

public int getDelta()
Get the difference between the expected number of bytes and the actual number of bytes encoded or decoded.

Returns:
the difference from the expected number of bytes.

toString

public String toString()
Get a string representation of the error.

Overrides:
toString in class Throwable
Returns:
the string describing the error.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.