public final class IOUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
copyStreamToFile(InputStream in,
File file) |
static void |
copyURLToFile(URL url,
File file) |
static boolean |
deleteRecursively(File dir)
Attempts to recursively delete a directory.
|
static InputStream |
openMaybeDecompressing(File file)
Opens an
InputStream to the file. |
static String |
readSmallTextFromURL(URL url) |
public static boolean deleteRecursively(File dir)
dir - directory to delete along with contentstrue if all files and dirs were deleted successfullypublic static InputStream openMaybeDecompressing(File file) throws IOException
InputStream to the file. If it appears to be compressed, because its file name ends in
".gz" or ".zip" or ".deflate", then it will be decompressed accordinglyfile - file, possibly compressed, to openInputStream on uncompressed contentsIOException - if the stream can't be opened or is invalid or can't be readpublic static void copyStreamToFile(InputStream in, File file) throws IOException
in - stream to read and copyfile - file to write stream's contents toIOException - if the stream can't be read or the file can't be writtenpublic static void copyURLToFile(URL url, File file) throws IOException
url - URL whose contents are to be read and copiedfile - file to write contents toIOException - if the URL can't be read or the file can't be writtenpublic static String readSmallTextFromURL(URL url) throws IOException
IOExceptionCopyright © 2012. All Rights Reserved.