Package org.insa.graphs.model.io
Class BinaryPathReader
- java.lang.Object
-
- org.insa.graphs.model.io.BinaryReader
-
- org.insa.graphs.model.io.BinaryPathReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,PathReader
public class BinaryPathReader extends BinaryReader implements PathReader
Implementation ofPathReader
to read paths in binary format.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
MAGIC_NUMBER
protected static int
VERSION
-
Fields inherited from class org.insa.graphs.model.io.BinaryReader
dis
-
-
Constructor Summary
Constructors Constructor Description BinaryPathReader(java.io.DataInputStream dis)
Create a new BinaryPathReader that read from the given input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Node
readNode(Graph graph)
Read a node from the input stream and returns it.Path
readPath(Graph graph)
Read a path of the given graph and returns it.-
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.PathReader
close
-
-
-
-
Field Detail
-
VERSION
protected static final int VERSION
- See Also:
- Constant Field Values
-
MAGIC_NUMBER
protected static final int MAGIC_NUMBER
- See Also:
- Constant Field Values
-
-
Method Detail
-
readPath
public Path readPath(Graph graph) throws java.io.IOException
Description copied from interface:PathReader
Read a path of the given graph and returns it.- Specified by:
readPath
in interfacePathReader
- Parameters:
graph
- Graph of the path.- Returns:
- Path read.
- Throws:
java.io.IOException
- When an error occurs while reading the path.
-
readNode
protected Node readNode(Graph graph) throws java.io.IOException
Read a node from the input stream and returns it.- Parameters:
graph
- Graph containing the nodes.- Returns:
- The next node in the input stream.
- Throws:
java.io.IOException
- if something occurs while reading the note.java.lang.IndexOutOfBoundsException
- if the node is not in the graph.
-
-