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 booleanstatic intcopy(InputStream in, OutputStream out) static intstatic Stringstatic BufferedReadergetReader(InputStream in) static PrintWritergetWriter(OutputStream out) lineIterator(BufferedReader reader) lineIterator(String path) static BufferedReaderstatic BufferedReaderstatic BufferedReaderopenInHard(File path) static BufferedReaderopenInHard(String path) static ObjectInputStreamstatic ObjectInputStreamstatic ObjectOutputStreamopenObjOut(File path) static ObjectOutputStreamopenObjOut(String path) static PrintWriterstatic PrintWriterstatic PrintWriteropenOutEasy(File path) static PrintWriteropenOutEasy(String path) static PrintWriteropenOutHard(File path) static PrintWriteropenOutHard(String path) static Stringstatic StringreadLineEasy(String path) readLinesEasy(String path) readLinesHard(String path) static ObjectreadObjFile(File path) static ObjectreadObjFile(String path) static ObjectreadObjFileEasy(File path) static ObjectreadObjFileEasy(String path) static ObjectreadObjFileHard(File path) static ObjectreadObjFileHard(String path) static voidsetCharEncoding(String charEncoding) static voidwriteObjFile(File path, Object obj) static booleanwriteObjFileEasy(File path, Object obj) static voidwriteObjFileHard(File path, Object obj) static voidwriteObjFileHard(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:
IOExceptionClassNotFoundException
-
readObjFile
- Throws:
IOExceptionClassNotFoundException
-
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
-