Package edu.berkeley.nlp.lm.io
Class IOUtils
java.lang.Object
edu.berkeley.nlp.lm.io.IOUtils
Some IO utility functions. Naming convention: "Hard" means that the function
throws a RuntimeException upon failure, "Easy" means it returns null.
- Author:
- adampauls, Percy Liang
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static int
copy
(InputStream in, OutputStream out) static int
static String
static BufferedReader
getReader
(InputStream in) static PrintWriter
getWriter
(OutputStream out) lineIterator
(BufferedReader reader) lineIterator
(String path) static BufferedReader
static BufferedReader
static BufferedReader
openInHard
(File path) static BufferedReader
openInHard
(String path) static ObjectInputStream
static ObjectInputStream
static ObjectOutputStream
openObjOut
(File path) static ObjectOutputStream
openObjOut
(String path) static PrintWriter
static PrintWriter
static PrintWriter
openOutEasy
(File path) static PrintWriter
openOutEasy
(String path) static PrintWriter
openOutHard
(File path) static PrintWriter
openOutHard
(String path) static String
static String
readLineEasy
(String path) readLinesEasy
(String path) readLinesHard
(String path) static Object
readObjFile
(File path) static Object
readObjFile
(String path) static Object
readObjFileEasy
(File path) static Object
readObjFileEasy
(String path) static Object
readObjFileHard
(File path) static Object
readObjFileHard
(String path) static void
setCharEncoding
(String charEncoding) static void
writeObjFile
(File path, Object obj) static boolean
writeObjFileEasy
(File path, Object obj) static void
writeObjFileHard
(File path, Object obj) static void
writeObjFileHard
(String path, Object obj)
-
Constructor Details
-
IOUtils
public IOUtils()
-
-
Method Details
-
openIn
- Throws:
IOException
-
openIn
- Throws:
IOException
-
openInHard
-
openInHard
-
openOut
- Throws:
IOException
-
openOut
- Throws:
IOException
-
openOutEasy
-
openOutEasy
-
openOutHard
-
openOutHard
-
openObjIn
- Throws:
IOException
-
openObjIn
- Throws:
IOException
-
openObjOut
- Throws:
IOException
-
openObjOut
- Throws:
IOException
-
readObjFile
- Throws:
IOException
ClassNotFoundException
-
readObjFile
- Throws:
IOException
ClassNotFoundException
-
readObjFileEasy
-
readObjFileEasy
-
readObjFileHard
-
readObjFileHard
-
writeObjFile
- Throws:
IOException
-
writeObjFileEasy
-
writeObjFileHard
-
writeObjFileHard
-
closeEasy
-
copy
- Throws:
IOException
-
copy
- Throws:
IOException
-
lineIterator
- Throws:
IOException
-
lineIterator
- Parameters:
reader
-- Returns:
-
readLines
- Throws:
IOException
-
readLinesEasy
-
readLinesHard
-
readLine
- Throws:
IOException
-
readLineEasy
-
readLines
- Throws:
IOException
-
getCharEncoding
-
setCharEncoding
-
getReader
- Throws:
IOException
-
getWriter
- Throws:
IOException
-