|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--uk.ac.umist.co.brailletrans.utils.Translator
Superclass of translation tools that use the Language programs. Contains various commonly-used utilities for reading from disk, converting arrays and so forth.
| Field Summary | |
static int |
DISK_ERROR
Error code for disk error. |
static int |
END_OF_FILE
The int returned by input streams in Java that indicates that the stream has not been completely read. |
static int |
FILE_SIZE_ERROR_LEEWAY
Some of the Translator methods test for file size: this is added to any result in case of discrepancies in reality/JVM perception. |
static int |
SUCCESS
Report code indicating successful operation. |
static int |
UNKNOWN_ERROR
Error code for errors with multiple possible causes. |
| Constructor Summary | |
Translator()
|
|
| Method Summary | |
static int[] |
readIntArrayFromDisk(java.lang.String filename)
Reads an array of ints from a local file using BufferedInputStream. |
static java.lang.String |
readStringFromDisk(java.lang.String filename)
Reads text as a String from a local file using java.io.BufferedReader. |
static byte[] |
turnIntoByteArray(int[] toConvert)
Converts an arrays of ints into an array of bytes |
static java.lang.String |
turnIntoString(byte[] toConvert)
Converts an array of bytes into a String |
static java.lang.String |
turnIntoString(int[] toConvert)
Converts an array of ints into a String |
static void |
writeIntArrayToDisk(int[] toWrite,
java.lang.String filename)
Saves an array of integers to disk using FileOutputStream |
static void |
writeStringToDisk(java.lang.String filename,
java.lang.String toWrite)
Writes a String to a local file using BufferedWriter |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int FILE_SIZE_ERROR_LEEWAY
public static final int END_OF_FILE
public static final int UNKNOWN_ERROR
public static final int DISK_ERROR
public static final int SUCCESS
| Constructor Detail |
public Translator()
| Method Detail |
public static void writeStringToDisk(java.lang.String filename,
java.lang.String toWrite)
throws java.io.IOException
String to a local file using BufferedWriterfilename - String containing full path and name of file to write to.toWrite - String to be written to file in filename.
public static java.lang.String readStringFromDisk(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException
String from a local file using java.io.BufferedReader.filename - String containing the full path and filename of the local file to read text from.String read from the local file.
public static int[] readIntArrayFromDisk(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException
BufferedInputStream.filename - String containing the full path and filename of the local file to read from.public static byte[] turnIntoByteArray(int[] toConvert)
toConvert - int[] to be converted into byte[]public static java.lang.String turnIntoString(int[] toConvert)
toConvert - int[] to be converted into Stringpublic static java.lang.String turnIntoString(byte[] toConvert)
toConvert - byte[] to be converted into String
public static void writeIntArrayToDisk(int[] toWrite,
java.lang.String filename)
throws java.io.IOException
toWrite - Array of ints to write to disk.filename - String holding the full path and filename to write to.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||