|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjd.io.FileUtil
A collection of utility function for I/O access.
Constructor Summary | |
FileUtil()
|
Method Summary | |
static void |
close(InputStream in)
Close an InputStream and catch any thrown IOException. |
static void |
close(OutputStream out)
Close an OutputStream and catch any thrown IOException. |
static void |
close(Reader reader)
Close a Reader and catch any thrown IOException. |
static void |
close(Writer writer)
Close a Writer and catch any thrown IOException. |
static void |
copy(File srcfile,
File destfile)
Copy all data from an File to another File. |
static void |
copy(InputStream src,
OutputStream dest)
Copy all data from an InputStream to an OutputStream. |
static void |
copy(InputStream src,
StringBuffer s)
Copy the data from src to the destination StringBuffer. |
static void |
copy(Reader src,
StringBuffer s)
Copy the data from src to the destination StringBuffer. |
static void |
copy(Reader src,
Writer dest)
Copy all data from a Reader to a Writer. |
static void |
deleteDirectoryContent(File directory,
boolean recursive)
Delete all files of a directory. |
static void |
deleteDirectoryTree(File directory)
Delete a directory with all files and subdirectories. |
static Object |
deserialize(byte[] array)
|
static String |
getExtension(File file)
Return the extension of a file name. |
static String |
getExtension(String filename)
Return the extension of a file name. |
static String |
getFileName(File file)
Return the name of a file without the extension. |
static String |
getLineSeparator()
|
static String |
read(File srcfile)
Read the data from src. |
static String |
read(InputStream src)
Copy the data from src to the destination StringBuffer. |
static String |
read(Reader src)
Read the data from src. |
static String[] |
readLines(InputStream in)
Read the lines from an InputStream. |
static String[] |
readLines(InputStream in,
boolean trim)
Read the lines from an InputStream. |
static byte[] |
serialize(Serializable object)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileUtil()
Method Detail |
public static void close(InputStream in)
public static void close(OutputStream out)
public static void close(Writer writer)
public static void close(Reader reader)
public static void copy(Reader src, Writer dest) throws IOException
IOException
- if an I/O error occurspublic static void copy(InputStream src, OutputStream dest) throws IOException
IOException
- if an I/O error occurspublic static void copy(File srcfile, File destfile) throws IOException
IOException
- if an I/O error occurspublic static void copy(Reader src, StringBuffer s) throws IOException
IOException
- if an I/O error occurspublic static void copy(InputStream src, StringBuffer s) throws IOException
IOException
- if an I/O error occurspublic static String read(InputStream src) throws IOException
IOException
- if an I/O error occurspublic static String read(Reader src) throws IOException
IOException
- if an I/O error occurspublic static String read(File srcfile) throws IOException
IOException
- if an I/O error occurspublic static String[] readLines(InputStream in) throws IOException
IOException
- if an I/O error occurspublic static String[] readLines(InputStream in, boolean trim) throws IOException
IOException
- if an I/O error occurspublic static String getExtension(File file)
public static String getExtension(String filename)
public static String getFileName(File file)
public static void deleteDirectoryTree(File directory) throws IOException
IOException
- if a file can not be deleted.public static void deleteDirectoryContent(File directory, boolean recursive) throws IOException
directory
- a directory
IOException
- if a file can not be deleted.public static byte[] serialize(Serializable object) throws IOException
IOException
public static Object deserialize(byte[] array) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static String getLineSeparator()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |