public class IOUtils extends Object
Constructor and Description |
---|
IOUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
deleteDirectory(File path)
Remove all files and directory from the given path
|
static InputStream |
getStreamForPath(Package pack,
String filename)
get an input stream for a file inside a given package.
|
static InputStream |
getStreamForPath(String path)
Produces a FileInputStream initialized with the given path
|
static boolean |
isFileWritable(String path)
Verify if the file at the given path can be opened in write mode
|
static void |
read(Reader rd,
StringBuffer sb) |
static StringBuffer |
readFromFile(String file_path)
Produces a StringBuffer initialized with the given path
|
static void |
readFromFile(String file_path,
StringBuffer sb)
Fill the given StringBuffer with the content of the file located at the given path
|
static StringBuffer |
readFromResource(InputStream istream) |
public static InputStream getStreamForPath(String path) throws IOException, FileNotFoundException
path
- the path for which the InputSTream is desiredIOException
FileNotFoundException
public static InputStream getStreamForPath(Package pack, String filename) throws IOException, FileNotFoundException
pack
- the package in which to lookupfilename
- the name of the desired file in this packageIOException
FileNotFoundException
public static StringBuffer readFromFile(String file_path) throws IOException
file_path
- the path for which the StringBuffer is desiredIOException
public static void readFromFile(String file_path, StringBuffer sb) throws IOException
file_path
- the path to the file to readsb
- the StringBuffer to fillIOException
public static StringBuffer readFromResource(InputStream istream) throws IOException
IOException
public static void read(Reader rd, StringBuffer sb) throws IOException
IOException
public static boolean isFileWritable(String path) throws GsException
path
- the path of the file to testGsException
public static boolean deleteDirectory(File path)
path
- the file to deleteCopyright © 2005–2020. All rights reserved.