uk.ac.umist.co.brailletrans.utils
Class Translator
java.lang.Object
|
+--uk.ac.umist.co.brailletrans.utils.Translator
- public class Translator
- extends java.lang.Object
Superclass of translation tools that use the Language programs. Contains
various commonly-used utilities for reading from disk, converting arrays
and so forth.
|
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 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 |
Translator
public Translator()
writeStringToDisk
public static void writeStringToDisk(java.lang.String filename,
java.lang.String toWrite)
throws java.io.IOException
- Writes a
String to a local file using BufferedWriter
- Parameters:
filename - String containing full path and name of file to write to.toWrite - String to be written to file in filename.
readStringFromDisk
public static java.lang.String readStringFromDisk(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException
- Reads text as a
String from a local file using java.io.BufferedReader.
- Parameters:
filename - String containing the full path and filename of the local file to read text from.- Returns:
- toReturn The
String read from the local file.
readIntArrayFromDisk
public static int[] readIntArrayFromDisk(java.lang.String filename)
throws java.io.FileNotFoundException,
java.io.IOException
- Reads an array of ints from a local file using
BufferedInputStream.
- Parameters:
filename - String containing the full path and filename of the local file to read from.- Returns:
- toReturn An int[] containing ints read from file.
writeIntArrayToDisk
public static void writeIntArrayToDisk(int[] toWrite,
java.lang.String filename)
throws java.io.IOException
- Saves an array of integers to disk using FileOutputStream
- Parameters:
toWrite - Array of ints to write to disk.filename - String holding the full path and filename to write to.