public class FileExt
extends java.lang.Object
| Constructor and Description |
|---|
FileExt() |
| Modifier and Type | Method and Description |
|---|---|
static void |
printLines(java.io.File file,
java.util.List<java.lang.String> lines)
Prints the file as lines, using writer.println.
|
static void |
printLines(java.io.File file,
java.util.List<java.lang.String> lines,
java.util.EnumSet<WriteOptionType> options)
Prints the file as lines, using writer.println.
|
static byte[] |
readBytes(java.io.File file)
Returns the contents of the file, as a byte array.
|
static java.util.List<java.lang.String> |
readLines(java.io.File file)
Reads the file into a string array, returning an empty array if there is
an error.
|
static java.util.List<java.lang.String> |
readLines(java.io.File file,
java.util.EnumSet<ReadOptionType> options)
Reads the file into a string array, without end-of-line characters
(sequences).
|
static java.lang.String |
resolveFileName(java.lang.String fname)
Resolves the file name, converting ~ to the home directory for the
current user.
|
public static java.util.List<java.lang.String> readLines(java.io.File file)
file - the file to read fromreadLines(File, EnumSet)public static java.util.List<java.lang.String> readLines(java.io.File file,
java.util.EnumSet<ReadOptionType> options)
throws IORuntimeException
options
contains ReadOptionType.WITH_EXCEPTION.file - the file to read fromoptions - options for readingIORuntimeExceptionReaderExt.readLines(java.io.Reader, java.util.EnumSet<org.incava.ijdk.io.ReadOptionType>)public static void printLines(java.io.File file,
java.util.List<java.lang.String> lines)
file - the file to read fromprintLines(File, List, EnumSet)public static void printLines(java.io.File file,
java.util.List<java.lang.String> lines,
java.util.EnumSet<WriteOptionType> options)
throws IORuntimeException
file - the file to write toIORuntimeException - Thrown if options contains
WriteOptionType.WITH_EXCEPTION.public static java.lang.String resolveFileName(java.lang.String fname)
public static byte[] readBytes(java.io.File file)
throws IORuntimeException
file - the file to read fromIORuntimeException