org.apache.commons.vfs
Class FileUtil

java.lang.Object
  extended by org.apache.commons.vfs.FileUtil

public final class FileUtil
extends java.lang.Object

Utility methods for dealng with FileObjects.

Version:
$Revision: 764356 $ $Date: 2009-04-13 06:06:01 +0200 (Mo, 13. Apr 2009) $
Author:
Adam Murdoch

Method Summary
static void copyContent(FileObject srcFile, FileObject destFile)
          Copies the content from a source file to a destination file.
static byte[] getContent(FileObject file)
          Returns the content of a file, as a byte array.
static void writeContent(FileObject file, java.io.OutputStream outstr)
          Writes the content of a file to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContent

public static byte[] getContent(FileObject file)
                         throws java.io.IOException
Returns the content of a file, as a byte array.

Parameters:
file - The file to get the content of.
Returns:
The content as a byte array.
Throws:
java.io.IOException - if the file content cannot be accessed.

writeContent

public static void writeContent(FileObject file,
                                java.io.OutputStream outstr)
                         throws java.io.IOException
Writes the content of a file to an OutputStream.

Parameters:
file - The FileObject to write.
outstr - The OutputStream to write to.
Throws:
java.io.IOException - if an error occurs writing the file.

copyContent

public static void copyContent(FileObject srcFile,
                               FileObject destFile)
                        throws java.io.IOException
Copies the content from a source file to a destination file.

Parameters:
srcFile - The source FileObject.
destFile - The target FileObject
Throws:
java.io.IOException - If an error occurs copying the file.


Copyright © 2002-2009 Apache Software Foundation. All Rights Reserved.