org.sourcejammer.util
Class FileUtil

java.lang.Object
  |
  +--org.sourcejammer.util.FileUtil

public class FileUtil
extends java.lang.Object

Title: $FileName: FileUtil.java$

Version:
$VerNum: 4$

$Description: $ $KeyWordsOff: $
Author:
$AuthorName: Rob MacGrogan$

Field Summary
private static int BUFFER_SIZE
           
 
Constructor Summary
private FileUtil()
           
 
Method Summary
private static void channelToOutputStream(java.nio.channels.ByteChannel channel, java.io.OutputStream outputStream)
           
static void copyDirectory(java.io.File sourceDir, java.io.File targetDir)
          Recursively copy a directory.
private static void copyDirectory(java.io.File sourceDir, java.io.File targetDir, boolean isMove)
          Recursively copy a directory.
private static void copyDirectory(java.io.File sourceDir, java.io.File targetDir, boolean isMove, Spinner spinner)
          Recursively copy a directory.
static void copyDirectory(java.io.File sourceDir, java.io.File targetDir, Spinner spinner)
          Recursively copy a directory.
static java.io.File copyFile(java.lang.String fileName, java.io.File sourceDir, java.io.File targetDir)
          Copy the specified file from sourceDir to targetDir.
static java.io.File copyFile(java.lang.String fileName, java.io.File sourceDir, java.io.File targetDir, boolean overwrite)
          Copy the specified file from sourceDir to targetDir.
static java.lang.String getExtension(java.lang.String fileName)
          Copied from HistoryTypeMapper in cient.
static void handlerStreamFileToFile(java.io.File source, java.io.File target)
           
static void handlerStreamFileToOutputStream(java.io.File source, java.io.OutputStream target)
           
static void inputStreamToOutputStream(java.io.InputStream stmIn, java.io.OutputStream stmOut)
           
static boolean isBinaryFile(java.io.File the_file)
          Copied from com.jj.javadiff.BinaryHandler, part of the javadiff package available from Launch Software (www.launchsoftware.com).
static void main(java.lang.String[] args)
           
static void moveDirectory(java.io.File sourceDir, java.io.File targetDir)
          Move a directory and all its contents.
static void moveDirectory(java.io.File sourceDir, java.io.File targetDir, Spinner spinner)
          Move a directory and all its contents.
static java.io.File moveFile(java.lang.String fileName, java.io.File sourceDir, java.io.File targetDir)
          Move the specified file from sourceDir to targetDir.
static java.io.File moveFile(java.lang.String fileName, java.io.File sourceDir, java.io.File targetDir, boolean overwrite)
          Move the specified file from sourceDir to targetDir.
static byte[] newReadBytesFromFileSys(java.io.File fileRead)
           
static void newStreamFileToFile(java.io.File source, java.io.File target)
           
static void oldStreamFileToFile(java.io.File source, java.io.File target)
           
static void optStreamFileToFile(java.io.File source, java.io.File target)
           
static byte[] readBytesFromFileSys(java.io.File fileRead)
           
static byte[] readBytesFromFileSys(java.lang.String fullPathAndName)
           
static java.lang.Object readObjectFromFileSys(java.io.File fileRead)
          Gets an object from file system.
static java.lang.Object readObjectFromFileSys(java.lang.String fullPathAndName)
          Gets an object from file system.
static void sendBytesToSendBytesDataSource(SendBytesDataSource source, byte[] by)
           
static void simpleStreamFileToFile(java.io.File source, java.io.File target)
           
static void streamFileToFile(java.io.File source, java.io.File target)
           
static void writeBytesToFileSys(byte[] file, java.io.File fileWrite)
          Saves byte array as a file using fullPathAndName as location.
static void writeBytesToFileSys(byte[] file, java.lang.String fullPathAndName)
          Saves byte array as a file using fullPathAndName as location.
static void writeObjectToFileSys(java.lang.Object o, java.io.File fileWrite)
          Writes the object to the specified location on the file system.
static void writeObjectToFileSys(java.lang.Object o, java.lang.String fullPathAndName)
          Writes the object to the specified location on the file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUFFER_SIZE

private static final int BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

FileUtil

private FileUtil()
Method Detail

sendBytesToSendBytesDataSource

public static void sendBytesToSendBytesDataSource(SendBytesDataSource source,
                                                  byte[] by)
                                           throws java.io.IOException
java.io.IOException

writeBytesToFileSys

public static void writeBytesToFileSys(byte[] file,
                                       java.lang.String fullPathAndName)
                                throws java.io.IOException
Saves byte array as a file using fullPathAndName as location.

java.io.IOException

writeBytesToFileSys

public static void writeBytesToFileSys(byte[] file,
                                       java.io.File fileWrite)
                                throws java.io.IOException
Saves byte array as a file using fullPathAndName as location.

java.io.IOException

readBytesFromFileSys

public static byte[] readBytesFromFileSys(java.lang.String fullPathAndName)
                                   throws java.io.IOException
java.io.IOException

channelToOutputStream

private static void channelToOutputStream(java.nio.channels.ByteChannel channel,
                                          java.io.OutputStream outputStream)
                                   throws java.io.IOException
java.io.IOException

newReadBytesFromFileSys

public static byte[] newReadBytesFromFileSys(java.io.File fileRead)
                                      throws java.io.IOException
java.io.IOException

readBytesFromFileSys

public static byte[] readBytesFromFileSys(java.io.File fileRead)
                                   throws java.io.IOException
java.io.IOException

readObjectFromFileSys

public static java.lang.Object readObjectFromFileSys(java.lang.String fullPathAndName)
                                              throws java.io.IOException
Gets an object from file system.

java.io.IOException

writeObjectToFileSys

public static void writeObjectToFileSys(java.lang.Object o,
                                        java.lang.String fullPathAndName)
                                 throws java.io.IOException
Writes the object to the specified location on the file system. If the file already exists, it will be overwritten.

java.io.IOException

writeObjectToFileSys

public static void writeObjectToFileSys(java.lang.Object o,
                                        java.io.File fileWrite)
                                 throws java.io.IOException
Writes the object to the specified location on the file system. If the file already exists, it will be overwritten.

java.io.IOException

readObjectFromFileSys

public static java.lang.Object readObjectFromFileSys(java.io.File fileRead)
                                              throws java.io.IOException
Gets an object from file system.

java.io.IOException

inputStreamToOutputStream

public static void inputStreamToOutputStream(java.io.InputStream stmIn,
                                             java.io.OutputStream stmOut)
                                      throws java.io.IOException
java.io.IOException

streamFileToFile

public static void streamFileToFile(java.io.File source,
                                    java.io.File target)
                             throws java.io.IOException
java.io.IOException

oldStreamFileToFile

public static void oldStreamFileToFile(java.io.File source,
                                       java.io.File target)
                                throws java.io.IOException
java.io.IOException

simpleStreamFileToFile

public static void simpleStreamFileToFile(java.io.File source,
                                          java.io.File target)
                                   throws java.io.IOException
java.io.IOException

handlerStreamFileToFile

public static void handlerStreamFileToFile(java.io.File source,
                                           java.io.File target)
                                    throws java.io.IOException
java.io.IOException

handlerStreamFileToOutputStream

public static void handlerStreamFileToOutputStream(java.io.File source,
                                                   java.io.OutputStream target)
                                            throws java.io.IOException
java.io.IOException

optStreamFileToFile

public static void optStreamFileToFile(java.io.File source,
                                       java.io.File target)
                                throws java.io.IOException
java.io.IOException

newStreamFileToFile

public static void newStreamFileToFile(java.io.File source,
                                       java.io.File target)
                                throws java.io.IOException
java.io.IOException

getExtension

public static java.lang.String getExtension(java.lang.String fileName)
Copied from HistoryTypeMapper in cient.


moveFile

public static java.io.File moveFile(java.lang.String fileName,
                                    java.io.File sourceDir,
                                    java.io.File targetDir)
                             throws java.io.IOException
Move the specified file from sourceDir to targetDir.

java.io.IOException

moveFile

public static java.io.File moveFile(java.lang.String fileName,
                                    java.io.File sourceDir,
                                    java.io.File targetDir,
                                    boolean overwrite)
                             throws java.io.IOException
Move the specified file from sourceDir to targetDir. Throws IOException if oerwrite is true and target file already exists.

java.io.IOException

moveDirectory

public static void moveDirectory(java.io.File sourceDir,
                                 java.io.File targetDir)
                          throws java.io.IOException
Move a directory and all its contents.

java.io.IOException

copyDirectory

public static void copyDirectory(java.io.File sourceDir,
                                 java.io.File targetDir)
                          throws java.io.IOException
Recursively copy a directory.

java.io.IOException

moveDirectory

public static void moveDirectory(java.io.File sourceDir,
                                 java.io.File targetDir,
                                 Spinner spinner)
                          throws java.io.IOException
Move a directory and all its contents.

java.io.IOException

copyDirectory

public static void copyDirectory(java.io.File sourceDir,
                                 java.io.File targetDir,
                                 Spinner spinner)
                          throws java.io.IOException
Recursively copy a directory.

java.io.IOException

copyDirectory

private static void copyDirectory(java.io.File sourceDir,
                                  java.io.File targetDir,
                                  boolean isMove)
                           throws java.io.IOException
Recursively copy a directory.

java.io.IOException

copyDirectory

private static void copyDirectory(java.io.File sourceDir,
                                  java.io.File targetDir,
                                  boolean isMove,
                                  Spinner spinner)
                           throws java.io.IOException
Recursively copy a directory.

java.io.IOException

copyFile

public static java.io.File copyFile(java.lang.String fileName,
                                    java.io.File sourceDir,
                                    java.io.File targetDir)
                             throws java.io.IOException
Copy the specified file from sourceDir to targetDir.

java.io.IOException

copyFile

public static java.io.File copyFile(java.lang.String fileName,
                                    java.io.File sourceDir,
                                    java.io.File targetDir,
                                    boolean overwrite)
                             throws java.io.IOException
Copy the specified file from sourceDir to targetDir. Throws IOException if oerwrite is true and target file already exists.

java.io.IOException

isBinaryFile

public static boolean isBinaryFile(java.io.File the_file)
Copied from com.jj.javadiff.BinaryHandler, part of the javadiff package available from Launch Software (www.launchsoftware.com).


main

public static void main(java.lang.String[] args)


Copyright 2003 Soucejammer project.