|
Java APG, Version 1.0 Author Lowell D. Thomas Copyright © Coast to Coast Research, Inc. 2011 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.coasttocoastresearch.apg.Utilities
public class Utilities
The Utilities class defines several helper classes and static functions. These are stand-alone classes and functions that have general utility beyond the needs of any single class.
| Nested Class Summary | |
|---|---|
static class |
Utilities.LineCatalog
A class for reading a text file and cataloging its text lines. |
static class |
Utilities.XMLWriter
A class for assisting in the writing of XML files. |
| Method Summary | |
|---|---|
static java.lang.String |
charArrayToString(char[] input,
int offset,
int length,
int maxChars)
Converts a subset of a character array to a String representation. |
static java.lang.String |
charArrayToXml(char[] input,
int offset,
int length)
Converts a subset of a character array to XML string format. |
static java.lang.String |
displayError(java.lang.Error e)
Get the Error message and stack trace as a String. |
static java.lang.String |
displayException(java.lang.Exception e)
Get the Exception message and stack trace as a String. |
static void |
displayFileInfo(java.io.PrintStream out,
java.io.File file)
Displays detailed information on File. |
static void |
displayFileInfo(java.io.PrintStream out,
java.lang.String name)
Displays detailed information on the named file. |
static java.io.File |
getFile(java.lang.String dir,
java.lang.String filename)
Return a File object for the named file. |
static java.lang.String |
getFileAsString(java.lang.String fileName)
Reads the named file and returns its contents as a String. |
static java.lang.String |
getFileAsString(java.lang.String workingDir,
java.lang.String fileName)
Reads the named file and returns its contents as a String. |
static java.lang.String |
indent(int length)
Generates a string of spaces ( 0x20) which is often used to provide an indent to a line of text. |
static java.lang.String |
parserStateToString(boolean down,
boolean match,
int length)
Converts the parser state to a String representation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static java.lang.String charArrayToString(char[] input,
int offset,
int length,
int maxChars)
32-126) are displayed as hex values
(eg. x1F)
input - the character array to convertoffset - offset of the first character in the array subset to convert.length - the number of characters in the array subset.maxChars - imposes a maximum character length limit on the subset.
If length is greater than maxChars, the subset will be truncated.
public static java.lang.String charArrayToXml(char[] input,
int offset,
int length)
input - the character array to convertoffset - offset of the first character in the array subset to convert.length - the number of characters in the array subset.
public static java.lang.String displayError(java.lang.Error e)
e - the Error to display
public static java.lang.String displayException(java.lang.Exception e)
e - the Exception to display
public static void displayFileInfo(java.io.PrintStream out,
java.io.File file)
throws java.io.IOException
File.
out - the output device to display on.file - the File to get information on.
java.io.IOException - thrown if the file cannot be found or opened.
public static void displayFileInfo(java.io.PrintStream out,
java.lang.String name)
throws java.io.IOException
out - the output device to display on.name - the name of the file to get information on.
java.io.IOException - thrown if the file cannot be found or opened.
public static java.io.File getFile(java.lang.String dir,
java.lang.String filename)
File object for the named file.
dir - directory to find the file in.filename - name of the file to find.
File object or null if not the file could not be found
public static java.lang.String getFileAsString(java.lang.String fileName)
throws java.lang.NullPointerException,
java.io.FileNotFoundException,
java.io.IOException,
java.lang.Exception
fileName - name of the file to open and read.
java.lang.NullPointerException - File
java.io.FileNotFoundException - File
java.io.IOException - File
java.lang.Exception - thrown if the named file does not exist or for some reason cannot be opened.
public static java.lang.String getFileAsString(java.lang.String workingDir,
java.lang.String fileName)
throws java.lang.NullPointerException,
java.io.FileNotFoundException,
java.io.IOException,
java.lang.Exception
fileName - name of the file to open and read.workingDir - working directory to find "fileName" in.
java.lang.NullPointerException - File
java.io.FileNotFoundException - File
java.io.IOException - File
java.lang.Exception - thrown if the named file does not exist or for some reason cannot be opened.public static java.lang.String indent(int length)
0x20) which is often used to provide an indent to a line of text.
length - the number of spaces in the indent string.
public static java.lang.String parserStateToString(boolean down,
boolean match,
int length)
down - if true, the parser direction is "down" the syntax tree -
before to parsing the branch below.
If false, the direction is "up" after visiting the branch below.match - if true, the phrase was matched (may be empty)length - if match is true, the length of the matched phrase.
Zero (0) length indicates an empty phrase matched.
|
Java APG, Version 1.0 Author Lowell D. Thomas Copyright © Coast to Coast Research, Inc. 2011 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||