|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
Static Public Member Functions | |
| static BufferedWriter | getWriteFileStream (String filename) throws IOException |
| static boolean | deleteRecursively (File f) |
| static FileOutputStream | writeBytes (int[] data, String filename) throws IOException |
| static void | writeBytes (int[] data, OutputStream out) throws IOException |
| static void | copyFile (String srFile, String dtFile) throws IOException |
| static void | copyFile (File srFile, File dtFile) throws IOException |
| static boolean | deleteFile (String fileName) |
| static String | dirname (String fileName) |
| static void | createFolderIfNotExisting (String folderName) |
| static void | closeCloseableIfNotNull (Closeable fileWriter) |
| static String | getWorkingDirectory () |
| static void | handleExceptions (Exception e) |
| static String | getFileAsString (File file) |
| static List< String > | getLines (File file, boolean keepDuplicates) |
| static Scanner | getScanner (File inputFile, String encoding) |
| static Scanner | getScanner (File inputFile) |
| static String | getFirstLineInFile (File inputFile) |
Static Public Attributes | |
| static String | DEFAULT_ENCODING = "UTF-8" |
Static Private Attributes | |
| static final Charset | FILE_ENCODING = Charset.forName(DEFAULT_ENCODING) |
utility functions for file operations
| static void joshua.util.FileUtility.closeCloseableIfNotNull | ( | Closeable | fileWriter | ) | [static] |
| static void joshua.util.FileUtility.copyFile | ( | String | srFile, |
| String | dtFile | ||
| ) | throws IOException [static] |
| static void joshua.util.FileUtility.copyFile | ( | File | srFile, |
| File | dtFile | ||
| ) | throws IOException [static] |
| static void joshua.util.FileUtility.createFolderIfNotExisting | ( | String | folderName | ) | [static] |
| static boolean joshua.util.FileUtility.deleteFile | ( | String | fileName | ) | [static] |
| static boolean joshua.util.FileUtility.deleteRecursively | ( | File | f | ) | [static] |
Recursively delete the specified file or directory.
| f | File or directory to delete |
true if the specified file or directory was deleted, false otherwise | static String joshua.util.FileUtility.dirname | ( | String | fileName | ) | [static] |
Returns the base directory of the file. For example, dirname('/usr/local/bin/emacs') -> '/usr/local/bin'
| static String joshua.util.FileUtility.getFileAsString | ( | File | file | ) | [static] |
Convenience method to get a full file as a String
| file |
| static String joshua.util.FileUtility.getFirstLineInFile | ( | File | inputFile | ) | [static] |
| static List<String> joshua.util.FileUtility.getLines | ( | File | file, |
| boolean | keepDuplicates | ||
| ) | [static] |
This method returns a List of String. Each element of the list corresponds to a line from the input file. The boolean keepDuplicates in the input determines if duplicate lines are allowed in the output LinkedList or not.
| static Scanner joshua.util.FileUtility.getScanner | ( | File | inputFile, |
| String | encoding | ||
| ) | [static] |
Returns a Scanner of the inputFile using a specific encoding
| inputFile |
| static Scanner joshua.util.FileUtility.getScanner | ( | File | inputFile | ) | [static] |
Returns a Scanner of the inputFile using default encoding
| inputFile |
| static String joshua.util.FileUtility.getWorkingDirectory | ( | ) | [static] |
Returns the directory were the program has been started, the base directory you will implicitly get when specifying no full path when e.g. opening a file
| static BufferedWriter joshua.util.FileUtility.getWriteFileStream | ( | String | filename | ) | throws IOException [static] |
Warning, will truncate/overwrite existing files
| static void joshua.util.FileUtility.handleExceptions | ( | Exception | e | ) | [static] |
Method to handle standard IO xceptions. catch (Exception e) {Utility.handleIO_exception(e);}
| static FileOutputStream joshua.util.FileUtility.writeBytes | ( | int[] | data, |
| String | filename | ||
| ) | throws IOException [static] |
Writes data from the integer array to disk as raw bytes, overwriting the old file if present.
| data | The integer array to write to disk. |
| filename | The filename where the data should be written. |
| IOException |
| static void joshua.util.FileUtility.writeBytes | ( | int[] | data, |
| OutputStream | out | ||
| ) | throws IOException [static] |
Writes data from the integer array to disk as raw bytes.
| data | The integer array to write to disk. |
| out | The output stream where the data should be written. |
| IOException |
String joshua.util.FileUtility.DEFAULT_ENCODING = "UTF-8" [static] |
final Charset joshua.util.FileUtility.FILE_ENCODING = Charset.forName(DEFAULT_ENCODING) [static, private] |