Package com.blackrook.archetext
Class ArcheTextReader
- java.lang.Object
-
- com.blackrook.archetext.ArcheTextReader
-
public final class ArcheTextReader extends Object
A reader class for reading in ArcheText data and creating objects from it.- Author:
- Matthew Tropiano
-
-
Field Summary
Fields Modifier and Type Field Description static StringSTREAMNAME_TEXT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapply(File f, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(File f, PreprocessorLexer.Includer includer, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String text, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String text, PreprocessorLexer.Includer includer, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String streamName, InputStream in, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String streamName, InputStream in, PreprocessorLexer.Includer includer, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String streamName, Reader reader, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static voidapply(String streamName, Reader reader, PreprocessorLexer.Includer includer, ArcheTextRoot root)Applies the ArcheText objects read to an already existing root.static ArcheTextRootread(File file)Reads ArcheText objects into a new root from a starting text file.static ArcheTextRootread(File file, PreprocessorLexer.Includer includer)Reads ArcheText objects into a new root from a starting text file.static ArcheTextRootread(String text)Reads ArcheText objects from a String of text into a new root.static ArcheTextRootread(String text, PreprocessorLexer.Includer includer)Reads ArcheText objects from a String of text into a new root.static ArcheTextRootread(String streamName, InputStream in)Reads ArcheText objects into a new root.static ArcheTextRootread(String streamName, InputStream in, PreprocessorLexer.Includer includer)Reads ArcheText objects into a new root.static ArcheTextRootread(String streamName, Reader reader)Reads ArcheText objects into a new root from a reader stream.static ArcheTextRootread(String streamName, Reader reader, PreprocessorLexer.Includer includer)Reads ArcheText objects into a new root from a reader stream.static ArcheTextRootreadResource(String name)Reads ArcheText objects from a classpath resource.
-
-
-
Field Detail
-
STREAMNAME_TEXT
public static final String STREAMNAME_TEXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
read
public static ArcheTextRoot read(File file) throws IOException
Reads ArcheText objects into a new root from a starting text file. Note: Calls apply() with a new root.- Parameters:
file- the file to read from.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
read
public static ArcheTextRoot read(String text) throws IOException
Reads ArcheText objects from a String of text into a new root. Note: Calls apply() with a new root.- Parameters:
text- the String to read from.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
read
public static ArcheTextRoot read(String streamName, InputStream in) throws IOException
Reads ArcheText objects into a new root. Note: Calls apply() with a new root.- Parameters:
streamName- the name of the stream.in- the stream to read from.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if in is null.
-
read
public static ArcheTextRoot read(String streamName, Reader reader) throws IOException
Reads ArcheText objects into a new root from a reader stream. Note: Calls apply() with a new root.- Parameters:
streamName- the name of the stream.reader- the reader to read from.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
read
public static ArcheTextRoot read(File file, PreprocessorLexer.Includer includer) throws IOException
Reads ArcheText objects into a new root from a starting text file. Note: Calls apply() with a new root.- Parameters:
file- the file to read from.includer- the includer to use to resolve "included" paths.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
read
public static ArcheTextRoot read(String text, PreprocessorLexer.Includer includer) throws IOException
Reads ArcheText objects from a String of text into a new root. Note: Calls apply() with a new root.- Parameters:
text- the String to read from.includer- the includer to use to resolve "included" paths.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
read
public static ArcheTextRoot read(String streamName, InputStream in, PreprocessorLexer.Includer includer) throws IOException
Reads ArcheText objects into a new root. Note: Calls apply() with a new root.- Parameters:
streamName- the name of the stream.in- the stream to read from.includer- the includer to use to resolve "included" paths.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if in is null.
-
read
public static ArcheTextRoot read(String streamName, Reader reader, PreprocessorLexer.Includer includer) throws IOException
Reads ArcheText objects into a new root from a reader stream. Note: Calls apply() with a new root.- Parameters:
streamName- the name of the stream.reader- the reader to read from.includer- the includer to use to resolve "included" paths.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if f is null.
-
readResource
public static ArcheTextRoot readResource(String name) throws IOException
Reads ArcheText objects from a classpath resource. Note: Calls apply() with a new root.- Parameters:
name- the resource name.- Returns:
- A new ArcheTextRoot that contains all the read object hierarchy.
- Throws:
IOException- if the stream can't be read.NullPointerException- if name is null.
-
apply
public static void apply(File f, ArcheTextRoot root) throws IOException
Applies the ArcheText objects read to an already existing root.- Parameters:
f- the file to read from.root- the root to apply the objects to.- Throws:
IOException- if an I/O error occurs during read.NullPointerException- if either object is null.
-
apply
public static void apply(String text, ArcheTextRoot root) throws IOException
Applies the ArcheText objects read to an already existing root.- Parameters:
text- the String to read from.root- the root to apply the objects to.- Throws:
IOException- if an I/O error occurs during read.NullPointerException- if either object is null.
-
apply
public static void apply(String streamName, InputStream in, ArcheTextRoot root)
Applies the ArcheText objects read to an already existing root.- Parameters:
streamName- the name of the stream.in- the stream to read from.root- the root to apply the objects to.- Throws:
NullPointerException- if either object is null.
-
apply
public static void apply(String streamName, Reader reader, ArcheTextRoot root)
Applies the ArcheText objects read to an already existing root.- Parameters:
streamName- the name of the stream.reader- the reader to read from.root- the root to apply the objects to.- Throws:
NullPointerException- if either object is null.
-
apply
public static void apply(File f, PreprocessorLexer.Includer includer, ArcheTextRoot root) throws IOException
Applies the ArcheText objects read to an already existing root.- Parameters:
f- the file to read from.includer- the includer to use to resolve "included" paths.root- the root to apply the objects to.- Throws:
IOException- if an I/O error occurs during read.NullPointerException- if either object is null.
-
apply
public static void apply(String streamName, InputStream in, PreprocessorLexer.Includer includer, ArcheTextRoot root)
Applies the ArcheText objects read to an already existing root.- Parameters:
streamName- the name of the stream.in- the stream to read from.includer- the includer to use to resolve "included" paths.root- the root to apply the objects to.- Throws:
NullPointerException- if either object is null.
-
apply
public static void apply(String text, PreprocessorLexer.Includer includer, ArcheTextRoot root) throws IOException
Applies the ArcheText objects read to an already existing root.- Parameters:
text- the String to read from.includer- the includer to use to resolve "included" paths.root- the root to apply the objects to.- Throws:
IOException- if an I/O error occurs during read.NullPointerException- if either object is null.
-
apply
public static void apply(String streamName, Reader reader, PreprocessorLexer.Includer includer, ArcheTextRoot root)
Applies the ArcheText objects read to an already existing root.- Parameters:
streamName- the name of the stream.reader- the reader to read from.includer- the includer to use to resolve "included" paths.root- the root to apply the objects to.- Throws:
NullPointerException- if either object is null.
-
-