public class FileUtils extends Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Collection<File> |
getAllFiles(File directory)
Collects all non-directory files in the given input directory
(recursively).
|
static BufferedReader |
getBufferedUTF8Reader(File file)
Creates a BufferedReader for UTF-8-encoded files
|
static BufferedReader |
getBufferedUTF8Reader(InputStream inputStream)
Creates a BufferedReader the UTF-8-encoded InputStream
|
static BufferedReader |
getBufferedUTF8Reader(String fileName)
Creates a BufferedReader for UTF-8-encoded files
|
static BufferedWriter |
getBufferedUTF8Writer(File file)
Creates a BufferedWriter for UTF-8-encoded files
|
static BufferedWriter |
getBufferedUTF8Writer(String fileName)
Creates a BufferedWriter for UTF-8-encoded files
|
static String |
getFileContent(File file)
Returns the content of the (UTF-8 encoded) file as string.
|
static void |
main(String[] args) |
static boolean |
verifyOrderedFile(File check,
boolean descending)
Verifies that a file is lexicographically order (ascending or descending)
|
static void |
writeFileContent(File file,
String content)
Writes the content of the string to the (UTF-8 encoded) file.
|
public static BufferedReader getBufferedUTF8Reader(File file) throws IOException
file - File in UTF-8 encodingFileNotFoundExceptionIOExceptionpublic static BufferedReader getBufferedUTF8Reader(String fileName) throws IOException
fileName - Path to file in UTF-8 encodingFileNotFoundExceptionIOExceptionpublic static BufferedReader getBufferedUTF8Reader(InputStream inputStream)
inputStream - InputStream in UTF-8 encodingpublic static BufferedWriter getBufferedUTF8Writer(File file) throws FileNotFoundException
file - File in UTF-8 encodingFileNotFoundExceptionpublic static BufferedWriter getBufferedUTF8Writer(String fileName) throws FileNotFoundException
fileName - Path to file in UTF-8 encodingFileNotFoundExceptionpublic static String getFileContent(File file) throws IOException
file - File to get String content fromIOExceptionpublic static void writeFileContent(File file, String content) throws IOException
file - File to write String content to.content - Content of file.IOExceptionpublic static boolean verifyOrderedFile(File check, boolean descending) throws IOException
check - File to checkdescending - true if ordering should be descending, false if it should be ascendingIOExceptionpublic static Collection<File> getAllFiles(File directory)
directory - Input directory.public static void main(String[] args) throws IOException
IOExceptionCopyright © 2018. All rights reserved.