dk.itu.haas.GPS.Garmin
Class GarminInputStream
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.FilterInputStream
|
+--dk.itu.haas.GPS.Garmin.GarminInputStream
- public class GarminInputStream
- extends java.io.FilterInputStream
This class provides the functionality of automatically removing the double DLEs from the GPS-inputstream.
The double-DLEs can be found in the size-,data-, and checksum-fields.
The only method providing the filtering-functionality is read().
Fields inherited from class java.io.FilterInputStream |
in |
Constructor Summary |
GarminInputStream(java.io.InputStream i)
Takes the stream to the GPS-unit as an argument. |
Method Summary |
int |
read()
Returns 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 |
GarminInputStream
public GarminInputStream(java.io.InputStream i)
- Takes the stream to the GPS-unit as an argument.
readPacket
public int[] readPacket()
throws InvalidPacketException,
java.io.IOException
- Reads a packet from the stream.
Note: Method assumes that it's 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.
InvalidPacketException
java.io.IOException
read
public int read()
throws java.io.IOException
- Returns the next byte from the stream. Makes sure to remove DLE stuffing.
- Overrides:
read
in class java.io.FilterInputStream
java.io.IOException