Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.util.FileUtility Class Reference
Collaboration diagram for joshua.util.FileUtility:
[legend]

List of all members.

Static Public Member Functions

static BufferedReader getReadFileStream (String filename) throws IOException
static BufferedWriter getWriteFileStream (String filename) throws IOException
static BufferedWriter getAppendFileStream (String filename) throws IOException
static String read_line_lzf (BufferedReader in)
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 Private Attributes

static final Charset FILE_ENCODING = Charset.forName("UTF-8")

Detailed Description

utility functions for file operations

Author:
Zhifei Li, zhife.nosp@m.i.wo.nosp@m.rk@gm.nosp@m.ail..nosp@m.com
wren ng thornton wren@.nosp@m.user.nosp@m.s.sou.nosp@m.rcef.nosp@m.orge..nosp@m.net
Since:
28 February 2009
Version:
$LastChangedDate$

Member Function Documentation

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 boolean joshua.util.FileUtility.deleteFile ( String  fileName) [static]
static boolean joshua.util.FileUtility.deleteRecursively ( File  f) [static]

Recursively delete the specified file or directory.

Parameters:
fFile or directory to delete
Returns:
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'

Here is the caller graph for this function:

static BufferedWriter joshua.util.FileUtility.getAppendFileStream ( String  filename) throws IOException [static]
static BufferedReader joshua.util.FileUtility.getReadFileStream ( String  filename) throws IOException [static]
Deprecated:
use joshua.util.io.LineReader instead.

Here is the caller graph for this function:

static BufferedWriter joshua.util.FileUtility.getWriteFileStream ( String  filename) throws IOException [static]

Warning, will truncate/overwrite existing files

Here is the caller graph for this function:

static String joshua.util.FileUtility.read_line_lzf ( BufferedReader  in) [static]
Deprecated:
use joshua.util.io.LineReader instead.

Here is the caller graph for this function:

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.

Parameters:
dataThe integer array to write to disk.
filenameThe filename where the data should be written.
Exceptions:
IOException
Returns:
the FileOutputStream on which the bytes were written
static void joshua.util.FileUtility.writeBytes ( int[]  data,
OutputStream  out 
) throws IOException [static]

Writes data from the integer array to disk as raw bytes.

Parameters:
dataThe integer array to write to disk.
outThe output stream where the data should be written.
Exceptions:
IOException

Member Data Documentation

final Charset joshua.util.FileUtility.FILE_ENCODING = Charset.forName("UTF-8") [static, private]