public class FileUtil extends Object
| Constructor and Description |
|---|
FileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List |
getContents(InputStream inputStream) |
static List |
getContents(String textFileName)
Reads a text file.
|
static void |
setContents(String textFileName,
List lines)
Saves the List of Strings to a file with the given filename.
|
static void |
setContents(String textFileName,
String contents)
Saves the String to a file with the given filename.
|
static void |
zip(Collection files,
File zipFile) |
public static List getContents(String textFileName) throws FileNotFoundException, IOException
textFileName - the pathname of the file to openFileNotFoundException - if the text file is not foundIOException - if the file is not found or another I/O error occurspublic static void setContents(String textFileName, String contents) throws IOException
textFileName - the pathname of the file to create (or overwrite)contents - the data to saveIOException - if an I/O error occurs.public static List getContents(InputStream inputStream) throws IOException
IOExceptionpublic static void setContents(String textFileName, List lines) throws IOException
textFileName - the pathname of the file to create (or overwrite)lines - the Strings to save as lines in the fileIOException - if an I/O error occurs.public static void zip(Collection files, File zipFile) throws IOException
IOExceptionCopyright © 2015. All rights reserved.