Package org.insa.graphs.model.io
Class BinaryGraphReader
- java.lang.Object
-
- org.insa.graphs.model.io.BinaryReader
-
- org.insa.graphs.model.io.BinaryGraphReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,GraphReader
public class BinaryGraphReader extends BinaryReader implements GraphReader
Implementation ofGraphReaderto read graph in binary format.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intMAP_ID_FIELD_LENGTHprotected java.util.List<GraphReaderObserver>observers-
Fields inherited from class org.insa.graphs.model.io.BinaryReader
dis
-
-
Constructor Summary
Constructors Constructor Description BinaryGraphReader(java.io.DataInputStream dis)Create a new BinaryGraphReader that read from the given input stream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObserver(GraphReaderObserver observer)Add a new observer to this graph reader.Graphread()Read a graph an returns it.protected static AccessRestrictionstoAccessInformation(long access)Parse the given long value into a new instance of AccessRestrictions.protected static RoadInformation.RoadTypetoRoadType(char ch)Convert a character to its corresponding road type.-
Methods inherited from class org.insa.graphs.model.io.BinaryReader
checkByteOrThrow, checkMagicNumberOrThrow, checkVersionOrThrow, close, getCurrentVersion, read24bits, readFixedLengthString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.insa.graphs.model.io.GraphReader
close
-
-
-
-
Field Detail
-
MAP_ID_FIELD_LENGTH
protected static final int MAP_ID_FIELD_LENGTH
- See Also:
- Constant Field Values
-
observers
protected java.util.List<GraphReaderObserver> observers
-
-
Method Detail
-
toAccessInformation
protected static AccessRestrictions toAccessInformation(long access)
Parse the given long value into a new instance of AccessRestrictions.- Parameters:
access- The value to parse.- Returns:
- New instance of access restrictions parsed from the given value.
-
toRoadType
protected static RoadInformation.RoadType toRoadType(char ch)
Convert a character to its corresponding road type.- Parameters:
ch- Character to convert.- Returns:
- Road type corresponding to the given character.
-
addObserver
public void addObserver(GraphReaderObserver observer)
Description copied from interface:GraphReaderAdd a new observer to this graph reader.- Specified by:
addObserverin interfaceGraphReader- Parameters:
observer- Observer to add.
-
read
public Graph read() throws java.io.IOException
Description copied from interface:GraphReaderRead a graph an returns it.- Specified by:
readin interfaceGraphReader- Returns:
- The graph read.
- Throws:
java.io.IOException- if an exception occurs while reading the graph.
-
-