org.sourcejammer.client.filesys
Class FileSysUtil

java.lang.Object
  |
  +--org.sourcejammer.client.filesys.FileSysUtil

public class FileSysUtil
extends java.lang.Object

Title: $FileName: FileSysUtil.java$

Version:
$VerNum: 5$

$Description: $. $KeyWordsOff: $

Client file system utilities.
Author:
$AuthorName: Rob MacGrogan$

Field Summary
private static int NO
           
private static int NO_ALL
           
private static int YES
           
private static int YES_ALL
           
 
Constructor Summary
private FileSysUtil()
           
 
Method Summary
static long fileCheckSum(byte[] file)
          Returns the sum of all bytes in the byte array.
static long fileCheckSum(java.io.File fl)
          Returns the sum of all bytes in the file.
static long fileCheckSum(java.lang.String sFullPathAndName)
          Returns the sum of all bytes in the file.
private static boolean interpretOverwriteResponse(int iResponse, org.sourcejammer.util.RepeatingResponse repeating)
           
static void makeFileHidden(java.io.File file)
           
static void makeFileVisible(java.io.File file)
           
static void makeFileWritable(java.io.File file)
          Makes a read-only file writable.
private static int overwriteDialog(java.lang.String fileName, java.awt.Component parentComponent)
           
static byte[] readLocalFile(java.io.File fileRead)
          Returns the file at the specified location as an array of bytes.
static byte[] readLocalFile(java.lang.String sFullPathAndName)
          Returns the file at the specified location as an array of bytes.
static java.lang.Object readObjectFromFileSys(java.io.File fileRead)
          Read and return a serialized object from specified File.
static boolean streamFileToFile(java.io.File flSource, java.io.File flTarget, boolean setToReadOnly)
           
static boolean streamFileToFile(java.io.File flSource, java.io.File flTarget, boolean setToReadOnly, org.sourcejammer.util.RepeatingResponse repeating)
           
static boolean writeLocalFile(java.io.File flTargetDirectory, java.lang.String sName, byte[] file)
          Write the byte array file to the specified directory using the specified name.
static boolean writeLocalFile(java.io.File flTargetDirectory, java.lang.String sName, byte[] file, boolean setToReadOnly)
          Write the byte array file to the specified directory using the specified name.
static boolean writeLocalFile(java.io.File flTargetDirectory, java.lang.String sName, byte[] file, boolean setToReadOnly, org.sourcejammer.util.RepeatingResponse repeating)
          Write the byte array file to the specified directory using the specified name.
static void writeObjectToFileSys(java.lang.Object o, java.io.File fileWrite)
          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

YES

private static final int YES
See Also:
Constant Field Values

YES_ALL

private static final int YES_ALL
See Also:
Constant Field Values

NO

private static final int NO
See Also:
Constant Field Values

NO_ALL

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

FileSysUtil

private FileSysUtil()
Method Detail

readLocalFile

public static byte[] readLocalFile(java.lang.String sFullPathAndName)
                            throws java.io.IOException
Returns the file at the specified location as an array of bytes.

java.io.IOException

readLocalFile

public static byte[] readLocalFile(java.io.File fileRead)
                            throws java.io.IOException
Returns the file at the specified location as an array of bytes.

java.io.IOException

writeLocalFile

public static boolean writeLocalFile(java.io.File flTargetDirectory,
                                     java.lang.String sName,
                                     byte[] file)
                              throws java.io.IOException
Write the byte array file to the specified directory using the specified name.

Returns:
true if file is successfully written.
java.io.IOException

streamFileToFile

public static boolean streamFileToFile(java.io.File flSource,
                                       java.io.File flTarget,
                                       boolean setToReadOnly)
                                throws java.io.IOException
java.io.IOException

streamFileToFile

public static boolean streamFileToFile(java.io.File flSource,
                                       java.io.File flTarget,
                                       boolean setToReadOnly,
                                       org.sourcejammer.util.RepeatingResponse repeating)
                                throws java.io.IOException
java.io.IOException

writeLocalFile

public static boolean writeLocalFile(java.io.File flTargetDirectory,
                                     java.lang.String sName,
                                     byte[] file,
                                     boolean setToReadOnly)
                              throws java.io.IOException
Write the byte array file to the specified directory using the specified name.

Parameters:
flTargetDirectory - -- the directory to write the file to.
sName - -- the name to give the file.
file - -- the byte array that is the file's contents.
setToReadOnly - -- if true, sets the file to readonly after writing it.
Returns:
true if file is successfully written.
java.io.IOException

interpretOverwriteResponse

private static boolean interpretOverwriteResponse(int iResponse,
                                                  org.sourcejammer.util.RepeatingResponse repeating)

writeLocalFile

public static boolean writeLocalFile(java.io.File flTargetDirectory,
                                     java.lang.String sName,
                                     byte[] file,
                                     boolean setToReadOnly,
                                     org.sourcejammer.util.RepeatingResponse repeating)
                              throws java.io.IOException
Write the byte array file to the specified directory using the specified name.

Parameters:
flTargetDirectory - -- the directory to write the file to.
sName - -- the name to give the file.
file - -- the byte array that is the file's contents.
setToReadOnly - -- if true, sets the file to readonly after writing it.
repeating - -- To hold "all" response from dialog, if applicable.
Returns:
true if file is successfully written.
java.io.IOException

overwriteDialog

private static int overwriteDialog(java.lang.String fileName,
                                   java.awt.Component parentComponent)

makeFileHidden

public static void makeFileHidden(java.io.File file)
                           throws java.io.IOException
java.io.IOException

makeFileVisible

public static void makeFileVisible(java.io.File file)
                            throws java.io.IOException
java.io.IOException

makeFileWritable

public static void makeFileWritable(java.io.File file)
                             throws java.io.IOException
Makes a read-only file writable.

java.io.IOException

fileCheckSum

public static long fileCheckSum(java.lang.String sFullPathAndName)
                         throws java.io.IOException
Returns the sum of all bytes in the file.

java.io.IOException

fileCheckSum

public static long fileCheckSum(java.io.File fl)
                         throws java.io.IOException
Returns the sum of all bytes in the file.

java.io.IOException

fileCheckSum

public static long fileCheckSum(byte[] file)
Returns the sum of all bytes in the byte array.


readObjectFromFileSys

public static java.lang.Object readObjectFromFileSys(java.io.File fileRead)
                                              throws java.io.IOException
Read and return a serialized object from specified File.

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


Copyright © 2003 Soucejammer project.