net.sf.zekr.common.util
Class FileUtils

java.lang.Object
  extended by net.sf.zekr.common.util.FileUtils

public class FileUtils
extends java.lang.Object

Since:
Zekr 1.0
Author:
Mohsen Saboorian

Constructor Summary
FileUtils()
           
 
Method Summary
static boolean delete(java.io.File file)
          A more enhanced implementation of File.delete() with also deletes directories recursively.
static java.io.InputStream getContent(java.net.URL url)
          Open a connection to a remote/local URL.
static java.lang.String readFully(java.io.InputStream is, int size)
          FileUtils.readFully(is, size, "UTF-8")
This method doesn't work correctly on GCJ
static java.lang.String readFully(java.io.InputStream is, int size, java.lang.String encoding)
          This method doesn't work correctly on GCJ
static void recreateDirectory(java.io.File dir)
           
static void recreateDirectory(java.lang.String dir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtils

public FileUtils()
Method Detail

delete

public static boolean delete(java.io.File file)
A more enhanced implementation of File.delete() with also deletes directories recursively.

Parameters:
file -
Returns:
true if successful, false otherwise

readFully

public static java.lang.String readFully(java.io.InputStream is,
                                         int size,
                                         java.lang.String encoding)
                                  throws java.io.IOException
This method doesn't work correctly on GCJ

Parameters:
is -
size -
encoding -
Returns:
the whole file being read
Throws:
java.io.IOException

readFully

public static java.lang.String readFully(java.io.InputStream is,
                                         int size)
                                  throws java.io.IOException
FileUtils.readFully(is, size, "UTF-8")
This method doesn't work correctly on GCJ

Parameters:
is -
size -
Returns:
the whole stream being read
Throws:
java.io.IOException

recreateDirectory

public static void recreateDirectory(java.io.File dir)
                              throws java.io.IOException
Throws:
java.io.IOException

recreateDirectory

public static void recreateDirectory(java.lang.String dir)
                              throws java.io.IOException
Throws:
java.io.IOException

getContent

public static java.io.InputStream getContent(java.net.URL url)
                                      throws java.io.IOException
Open a connection to a remote/local URL.

Parameters:
url -
Returns:
an open stream to the URL
Throws:
java.io.IOException