endrov.util.io
Class EvFileUtil

java.lang.Object
  extended by endrov.util.io.EvFileUtil

public class EvFileUtil
extends java.lang.Object

Utility functions for files


Constructor Summary
EvFileUtil()
           
 
Method Summary
static void copy(java.io.File source, java.io.File destination)
          Copy file from one location to another
static void deleteRecursive(java.io.File f)
          Delete directory or file recursively
static java.lang.String fileEnding(java.io.File file)
          Return file ending not including the dot, or null if there is none
static java.io.File getFileFromURL(java.net.URL urlToDecode)
          Work-around for a bug/faulty design in getResource().getFile(), making space %20 etc
static java.io.File makeFileEnding(java.io.File f, java.lang.String end)
          Make sure filename ends with ending, that must include a "." if wanted
static java.lang.String readFile(java.io.File file)
          Read file into string
static byte[] readFileRaw(java.io.File file)
           
static java.lang.String readStream(java.io.InputStream is)
          Read stream into string
static void touchRecursive(java.io.File f, long timestamp)
           
static void writeFile(java.io.File file, java.lang.String out)
          Write string to file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvFileUtil

public EvFileUtil()
Method Detail

getFileFromURL

public static java.io.File getFileFromURL(java.net.URL urlToDecode)
Work-around for a bug/faulty design in getResource().getFile(), making space %20 etc


readFile

public static java.lang.String readFile(java.io.File file)
                                 throws java.io.IOException
Read file into string

Throws:
java.io.IOException

readFileRaw

public static byte[] readFileRaw(java.io.File file)
                          throws java.io.IOException
Throws:
java.io.IOException

readStream

public static java.lang.String readStream(java.io.InputStream is)
                                   throws java.io.IOException
Read stream into string

Throws:
java.io.IOException

writeFile

public static void writeFile(java.io.File file,
                             java.lang.String out)
                      throws java.io.IOException
Write string to file

Throws:
java.io.IOException

touchRecursive

public static void touchRecursive(java.io.File f,
                                  long timestamp)

fileEnding

public static java.lang.String fileEnding(java.io.File file)
Return file ending not including the dot, or null if there is none


makeFileEnding

public static java.io.File makeFileEnding(java.io.File f,
                                          java.lang.String end)
Make sure filename ends with ending, that must include a "." if wanted


deleteRecursive

public static void deleteRecursive(java.io.File f)
                            throws java.io.IOException
Delete directory or file recursively

Throws:
java.io.IOException

copy

public static void copy(java.io.File source,
                        java.io.File destination)
                 throws java.io.IOException
Copy file from one location to another

Throws:
java.io.IOException