org.yajul.io
Class FileUtil

java.lang.Object
  extended by org.yajul.io.FileUtil

public class FileUtil
extends java.lang.Object

Provides utility methods for dealing with files (java.io.File).

Author:
josh May 4, 2004 7:08:23 AM

Constructor Summary
FileUtil()
           
 
Method Summary
static int recursiveDelete(java.io.File f)
          Deletes files or directories recursively, returns the number of files deleted.
static long tail(int numberOfLines, java.io.File file, java.io.Writer writer)
          Like UN*X tail - writes the last 'n' lines of a file to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtil

public FileUtil()
Method Detail

recursiveDelete

public static int recursiveDelete(java.io.File f)
                           throws java.io.IOException
Deletes files or directories recursively, returns the number of files deleted.

Parameters:
f - The file or directory to delete.
Returns:
The number of files deleted.
Throws:
java.io.IOException - if something goes wrong.

tail

public static long tail(int numberOfLines,
                        java.io.File file,
                        java.io.Writer writer)
                 throws java.io.IOException
Like UN*X tail - writes the last 'n' lines of a file to the writer.

Parameters:
numberOfLines - the number of tail lines
file - the file to tail
writer - where to send the output
Returns:
long - The position of the last byte read.
Throws:
java.io.IOException - if something goes wrong


Copyright © 2008. All Rights Reserved.