jwo.landserf.process.gps.garmin
Class InvalidPacketException

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byjwo.landserf.process.gps.garmin.InvalidPacketException
All Implemented Interfaces:
Serializable

public class InvalidPacketException
extends RuntimeException

Represents a problem in the form of a packet transferred to or from the GPS.

Version:
2.2, 15th June, 2004
Author:
Jo Wood, based on the design by Henrik Sorensen (haas@itu.dk).
See Also:
Serialized Form

Constructor Summary
InvalidPacketException(int[] packet, int pos)
          Creates an InvalidPacketException.
 
Method Summary
 int getIndex()
          Reports the index of the first erroneously configured byte.
 int[] getPacket()
          Reports the packet that caused the exception to be thrown.
 String toString()
          Provides formatted text 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[] packet,
                              int pos)
Creates an InvalidPacketException.

Parameters:
packet - Reference to the byte array that caused the exception.
pos - Position offset of the byte that was in error.
Method Detail

getPacket

public int[] getPacket()
Reports the packet that caused the exception to be thrown. Note that the return value is a reference to the original array. Therefore if the contents of this reported packet are to be altered, the array should be cloned first.

Returns:
Array representing the packet that generated the exception.

getIndex

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

Returns:
Offset in the packet array of the first erroneous byte.

toString

public String toString()
Provides formatted text showing which byte is wrong.

Returns:
Description of the problematic byte in the packet.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005