public class FileUtils extends Object
Constructor and Description |
---|
FileUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
delete(String fileOrDirectoryName) |
static boolean |
exists(String fileOrDirectoryName) |
static String |
getFileContents(String fileName)
Read text files contents in as a String.
|
static InputStream |
getInputStream(String fileName) |
static OutputStream |
getOutputStream(String fileName) |
static File[] |
listFiles(String directory,
String endsWithString) |
static String |
makeValidFileName(String fileName)
Replace all invalid file characters with valid ones.
|
static boolean |
mkdirs(String directoryName)
Create directory including any non existing parent directories in the the passed in path
|
public static String getFileContents(String fileName) throws FileNotFoundException, IOException
Sample Call: String contents=FileUtils.getFileContents("autoexec.bat");
FileNotFoundException
IOException
public static String makeValidFileName(String fileName)
fileName
- public static boolean mkdirs(String directoryName)
directoryName
- public static boolean exists(String fileOrDirectoryName)
public static boolean delete(String fileOrDirectoryName)
public static OutputStream getOutputStream(String fileName) throws IOException
IOException
public static InputStream getInputStream(String fileName) throws IOException
IOException
Copyright © 2015. All rights reserved.