net.myrrix.common.io
Class IOUtils

java.lang.Object
  extended by net.myrrix.common.io.IOUtils

public final class IOUtils
extends Object

Simple utility methods related to I/O.

Author:
Sean Owen

Method Summary
static void deleteRecursively(File dir)
          Attempts to recursively delete a directory.
static InputStream openMaybeDecompressing(File file)
          Opens an InputStream to the file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

deleteRecursively

public static void deleteRecursively(File dir)
Attempts to recursively delete a directory. This may not work across symlinks.


openMaybeDecompressing

public static InputStream openMaybeDecompressing(File file)
                                          throws IOException
Opens an 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 accordingly

Parameters:
file - file, possibly compressed, to open
Returns:
InputStream on uncompressed contents
Throws:
IOException - if the stream can't be opened or is invalid or can't be read


Copyright © 2012. All Rights Reserved.