org.jscience.devices.gps.garmin
Class InvalidPacketException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.jscience.devices.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. i is the index of the byte that was in error.
 
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.

Parameters:
pack - DOCUMENT ME!
i - DOCUMENT ME!
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.

Returns:
DOCUMENT ME!

getIndex

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

Returns:
DOCUMENT ME!

toString

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

Overrides:
toString in class java.lang.Throwable
Returns:
DOCUMENT ME!