|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectutil.InputOutput
public final class InputOutput
Helper methods related to the filesystem, but not included in
java.nio or java.io
| Field Summary | |
|---|---|
static String |
FILE_SEPARATOR
File separator, OS-dependent |
static String |
LINE_SEPARATOR
Line separator, OS-dependent |
| Constructor Summary | |
|---|---|
InputOutput()
|
|
| Method Summary | |
|---|---|
static Collection<String> |
getFilePathsEndingWith(String directory,
String suffix)
Returns a list containing the absolute path of every file that is contained in the given directory and has the given suffix |
static Collection<String> |
getFilePathsMatching(String directory,
String suffix)
Returns a list containing the absolute path of every file that is contained in the given directory and matches the given regular expression. |
static Collection<String> |
getFilePathsStartingWith(String directory,
String prefix)
Returns a list containing the absolute path of every file that is contained in the given directory and has the given prefix |
static void |
write(String filePath,
String text)
Appends the given text into the designated file |
static void |
write(String filePath,
String text,
boolean append)
Write the given text into the designated file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String FILE_SEPARATOR
public static final String LINE_SEPARATOR
| Constructor Detail |
|---|
public InputOutput()
| Method Detail |
|---|
public static Collection<String> getFilePathsMatching(String directory,
String suffix)
directory - absolute path representing a directorysuffix - regular expression
public static Collection<String> getFilePathsEndingWith(String directory,
String suffix)
directory - absolute path representing a directory.suffix - suffix we are looking for.
public static Collection<String> getFilePathsStartingWith(String directory,
String prefix)
directory - absolute path representing a directoryprefix - prefix we are looking for
public static void write(String filePath,
String text)
throws IOException
filePath - full path to a file; if the file does not exist, it is created.text - text to write in the file
IOException - if there is an error while writing or closing the file
public static void write(String filePath,
String text,
boolean append)
throws IOException
filePath - full path to a file; if the file does not exist, it is created.text - text to write in the fileappend - whether to append (true) to or overwrite (false) the contents of
the file
IOException - if there is an error while writing or closing the file
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||