Package org.biojavax.bio.phylo.io.nexus
Class NexusFileFormat
java.lang.Object
org.biojavax.bio.phylo.io.nexus.NexusFileFormat
Reads/writes Nexus files and fires events at a NexusFileListener object.
Blocks are parsed using NexusBlockParser objects provided at runtime. Each of
those objects should probably have a NexusBlockListener object associated
with them that receives events generated from the processed data in the
block.
- Since:
- 1.6
- Author:
- Richard Holland, Tobias Thierer, Jim Balhoff
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidparseFile(NexusFileListener listener, File inputFile) Parse a file and send events to the given listener.static voidparseInputStream(NexusFileListener listener, InputStream inputStream) Parse a stream and send events to the given listener.static voidparseReader(NexusFileListener listener, Reader inputReader) Parse a reader and send events to the given listener.static voidWrites the given Nexus output to a file.static voidwriteStream(OutputStream os, NexusFile nexusFile) Writes the given Nexus output to a stream.static voidwriteWriter(Writer writer, NexusFile nexusFile) Writes the given Nexus output to a writer.
-
Field Details
-
NEW_LINE
New-line symbol.
-
-
Method Details
-
parseFile
public static void parseFile(NexusFileListener listener, File inputFile) throws IOException, ParseException Parse a file and send events to the given listener.- Parameters:
listener- the listener that will receive events.inputFile- the file to parse.- Throws:
IOException- if anything goes wrong with reading the file.ParseException- if the file format is incorrect.
-
parseInputStream
public static void parseInputStream(NexusFileListener listener, InputStream inputStream) throws IOException, ParseException Parse a stream and send events to the given listener.- Parameters:
listener- the listener that will receive events.inputStream- the stream to parse.- Throws:
IOException- if anything goes wrong with reading the stream.ParseException- if the stream format is incorrect.
-
parseReader
public static void parseReader(NexusFileListener listener, Reader inputReader) throws IOException, ParseException Parse a reader and send events to the given listener.- Parameters:
listener- the listener that will receive events.inputReader- the file to parse.- Throws:
IOException- if anything goes wrong with reading the reader.ParseException- if the reader format is incorrect.
-
writeFile
Writes the given Nexus output to a file.- Parameters:
file- the file to write to.nexusFile- the Nexus output to write.- Throws:
IOException- if there is a problem during writing.
-
writeStream
Writes the given Nexus output to a stream.- Parameters:
os- the stream to write to.nexusFile- the Nexus output to write.- Throws:
IOException- if there is a problem during writing.
-
writeWriter
Writes the given Nexus output to a writer.- Parameters:
writer- the writer to write to.nexusFile- the Nexus output to write.- Throws:
IOException- if there is a problem during writing.
-