|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.samcrow.io.IOBase
org.samcrow.io.BasicIO
public class BasicIO
Handles IO for a basic file with a non-standard format
The format is as follows:
Node <hash> <x> <y> "<name>";
if name
is nonexistent; the node is considered a waypoint instead of a destination
Link <start_node_hash> <end_node_hash> <speed>
#comment
Any Link must appear in the file after both of the Nodes that it links.
Field Summary | |
---|---|
private static java.lang.String |
LINK
The word at the start of a line that indicates that the line contains link information |
private static java.lang.String |
NODE
The word at the start of a line that indicates that the line contains node information |
Fields inherited from class org.samcrow.io.IOBase |
---|
file |
Constructor Summary | |
---|---|
BasicIO(java.io.File inFile)
Constructor with a given File object |
|
BasicIO(java.lang.String inFilename)
Construct this with a given filename |
Method Summary | |
---|---|
IOResponse |
read()
Read the file; get the nodes and links defined in it. This method is designed to be relatively robust. |
void |
write(java.util.Collection<Node> nodes,
java.util.Collection<Link> links)
Writes to the file that this instance uses |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String NODE
private static final java.lang.String LINK
Constructor Detail |
---|
public BasicIO(java.lang.String inFilename)
inFilename
- public BasicIO(java.io.File inFile)
inFile
- the File objectMethod Detail |
---|
public void write(java.util.Collection<Node> nodes, java.util.Collection<Link> links)
IOBase
write
in class IOBase
nodes
- the nodes to writelinks
- the links to writepublic IOResponse read() throws java.text.ParseException
IOBase
read
in class IOBase
java.text.ParseException
- if the file is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |