dk.itu.haas.GPS.Garmin
Class InvalidPacketException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--dk.itu.haas.GPS.Garmin.InvalidPacketException
All Implemented Interfaces:
java.io.Serializable

public class InvalidPacketException
extends java.lang.RuntimeException

This method is thrown from the constructors of the packet-classes, whenever the int[]-array is not formatted according to the Garmin-packet-specs.

See Also:
Serialized Form

Constructor Summary
InvalidPacketException(int[] pack, int i)
          Creates an InvalidPacketException. pack is a reference to the byte-array that caused the exception.
 
Method Summary
 int getIndex()
          Returns the index of the first erroneously configured byte.
 int[] getPacket()
          Returns the packet that caused the exception to be thrown.
 java.lang.String toString()
          Returns a formatted string showing which byte is wrong.
 
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

InvalidPacketException

public InvalidPacketException(int[] pack,
                              int i)
Creates an InvalidPacketException. pack is a reference to the byte-array that caused the exception. i is the index of the byte that was in error.

Method Detail

getPacket

public int[] getPacket()
Returns the packet that caused the exception to be thrown. Note: The return-value is a reference to the original array. Changes will likely propagate to other parts of the program.


getIndex

public int getIndex()
Returns the index of the first erroneously configured byte.


toString

public java.lang.String toString()
Returns a formatted string showing which byte is wrong.

Overrides:
toString in class java.lang.Throwable