|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sourceforge.xconf.toolbox.IOUtils
public class IOUtils
Common IO utility methods for file/stream reading and writing.
If you are using JDK 1.5 or later, try the generics-enhanced
IOUtils version.
| Constructor Summary | |
|---|---|
IOUtils()
|
|
| Method Summary | |
|---|---|
static void |
copy(InputStream src,
OutputStream dest)
Read all bytes from input stream and write them to the output stream. |
static byte[] |
readBytes(File file)
Read all bytes from the file. |
static byte[] |
readBytes(InputStream input)
Read all bytes from the input stream. |
static byte[] |
readBytesAndClose(InputStream input)
Read all bytes from the input stream. |
static List |
readLines(File file)
Read all lines from the file using default platform end-of-line characters and the default platform character set. |
static List |
readLines(InputStream input)
Read all lines from the input stream using default platform end-of-line characters and the default platform character set. |
static List |
readLinesAndClose(InputStream input)
Read all lines from the input stream using default platform end-of-line characters and the default platform character set. |
static String |
readText(File file)
Read all bytes from the file and return them as a string using the default platform character set. |
static String |
readText(InputStream input)
Read all bytes from the input stream and return them as a string using the default platform character set. |
static String |
readTextAndClose(InputStream input)
Read all bytes from the input stream and return them as a string using the default platform character set. |
static void |
writeBytes(File file,
byte[] bytes)
Writes the given byte array to the file. |
static void |
writeLines(File file,
List lines)
Writes the given lines of text to the file using the platform default character set and the platform default end-of-line characters. |
static void |
writeLines(OutputStream out,
List lines)
Writes the given lines of text to the OutputStream using the platform default character set and the platform default end-of-line characters. |
static void |
writeText(File file,
String text)
Writes the given text to the file using the platform default character set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IOUtils()
| Method Detail |
|---|
public static void copy(InputStream src,
OutputStream dest)
throws IOException
IOException
public static String readText(File file)
throws IOException
IOException
public static String readText(InputStream input)
throws IOException
NOTE: this method does NOT close the given input stream.
IOExceptionreadTextAndClose(InputStream)
public static String readTextAndClose(InputStream input)
throws IOException
NOTE: this method also closes the given input stream.
IOExceptionreadText(InputStream)
public static List readLines(File file)
throws IOException
IOException
public static List readLines(InputStream input)
throws IOException
NOTE: this method does NOT close the given input stream.
IOExceptionreadLinesAndClose(InputStream)
public static List readLinesAndClose(InputStream input)
throws IOException
NOTE: this method closes the given input stream.
IOExceptionreadLines(InputStream)
public static byte[] readBytes(File file)
throws IOException
IOException
public static byte[] readBytes(InputStream input)
throws IOException
NOTE: this method does NOT close the given input stream.
IOExceptionreadBytesAndClose(InputStream)
public static byte[] readBytesAndClose(InputStream input)
throws IOException
NOTE: this method closes the given input stream.
IOExceptionreadBytesAndClose(InputStream)
public static void writeText(File file,
String text)
throws IOException
IOException
public static void writeLines(File file,
List lines)
throws IOException
IOException
public static void writeLines(OutputStream out,
List lines)
throws IOException
IOException
public static void writeBytes(File file,
byte[] bytes)
throws IOException
IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||