jwo.landserf.process.gps.garmin
Class GarminInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjwo.landserf.process.gps.garmin.GarminInputStream

public class GarminInputStream
extends FilterInputStream

Handles low level input from GPS. Automatically removes the DLEs from the GPS input stream. The double-DLEs can be found in the size, data, and checksum fields. The only method providing the filtering functionality is read().

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

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
GarminInputStream(InputStream i)
          Passes the stream to the GPS unit.
 
Method Summary
 int read()
          Reads the next byte from the stream.
 int[] readPacket()
          Reads a packet from the stream.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GarminInputStream

public GarminInputStream(InputStream i)
Passes the stream to the GPS unit.

Parameters:
i - Input stream to channel GPS input.
Method Detail

readPacket

public int[] readPacket()
                 throws InvalidPacketException,
                        IOException
Reads a packet from the stream. This assumes that this method is called between packets. ie. when the first byte of a packet is the next in the stream. If this condition is met, the method will leave the stream in the same state.

Returns:
packet data.
Throws:
InvalidPacketException
IOException

read

public int read()
         throws IOException
Reads the next byte from the stream. Removes DLE stuffing where necessary.

Returns:
Next item in input stream.
Throws:
IOException


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