All Packages  This Package  Class Hierarchy  Class Search  Index

Class kh.io.FileUtil
java.lang.Object
   |
   +----kh.io.FileUtil

  Summary

public class  FileUtil
     extends java.lang.Object
{
          // Constructors 1
     public FileUtil();

          // Methods 4
     public static void deleteAll(File) throws IOException;
     public static File getTemporaryFile(File);
     public static void replace(File, File);
     public static int streamCopy(InputStream, OutputStream) throws IOException;

}

This class provides misc utility routines for dealing with files




  Constructors

· FileUtil

Summary  |  Top

   public FileUtil() 

Default constructor



  Methods

· deleteAll

Summary  |  Top
   public static void deleteAll(File f)  throws IOException

Given a directory or file, recursively delete all files and directories contained within, then delete the directory/file itself.



· getTemporaryFile

Summary  |  Top
   public static File getTemporaryFile(File sourcePath) 

Given a file, return a file which is a temporary file in the same directory.

Parameter Description
sourcePath the extant file



· replace

Summary  |  Top
   public static void replace(File sourcePath, 
                              File destPath) 

Given a source file path and dest file path, move the file. However we need to be careful to do the move in stages, because we want to handle power outages gracefully.

Parameter Description
sourcePath the source
destPath the destination



· streamCopy

Summary  |  Top
   public static int streamCopy(InputStream source, 
                                OutputStream dest)  throws IOException

Copies the entire contents of an input stream to an output stream.

Parameter Description
source an InputStream
dest an OutputStream

Returns:
the number of bytes copied.


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7