SourceJammer 1.3.0 November 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan

org.sourcejammer.client.filesys
Class FileSysUtil

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

public class FileSysUtil
extends java.lang.Object

Client file system utilities.


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.
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.
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, boolean promptIfWritable)
           
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, boolean promptIfWritable)
          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
 

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.

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.

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.

streamFileToFile

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

writeLocalFile

public static boolean writeLocalFile(java.io.File flTargetDirectory,
                                     java.lang.String sName,
                                     byte[] file,
                                     boolean setToReadOnly,
                                     boolean promptIfWritable)
                              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.
setReadOnly - -- if true, sets the file to readonly after writing it.
promptIfWritable - -- if true, prompts the user about overwriting the file if the file exists and is NOT read-only.
Returns:
true if file is successfully written.

makeFileHidden

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

makeFileVisible

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

makeFileWritable

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

fileCheckSum

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

fileCheckSum

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

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.

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.

SourceJammer 1.3.0 November 20, 2002
Copyright (c) 2001, 2002 Robert MacGrogan