oemware.core.util
Class FileUtils

java.lang.Object
  extended by oemware.core.util.FileUtils

public final class FileUtils
extends java.lang.Object

The file utils.


Field Summary
static int DEFAULT_MAX_FILE_NAMES
           
 
Constructor Summary
FileUtils()
           
 
Method Summary
static java.lang.String assembleTimePathUuidFile(java.lang.String pRootDir, java.lang.String pFileNameExt)
          Create a file name path with a random uuid for the name and the current time for the path (and passed extension).
static void checkCanReadOrWrite(java.io.File pFile, boolean pReadCheck)
          Check to see if a file is readable or writable.
static void closeFileInputStream(java.io.FileInputStream pInputStream)
          Close the input stream.
static void closeFileInputStreams(java.util.List<java.io.FileInputStream> pInputStreams)
          Close the input streams.
static void closeFileOutputStream(java.io.FileOutputStream pOutputStream)
          Close the output stream.
static void closeInputStream(java.io.InputStream pInputStream)
          Close the input stream.
static void createDir(java.lang.String pDir)
          Make sure all the directories are in place for the path.
static java.io.File createFile(java.lang.String pFileName)
          Create a new file.
static java.io.FileInputStream createFileInputStream(java.lang.String pFileName, boolean pExists)
          Load a file channel.
static java.lang.String createFileName(java.lang.String pDataDir, java.lang.String pPrefix, java.lang.String pExtension, short pNodeId, byte pInstanceId, byte pFormatId, byte pVersionId, int pStartTime, int pStopTime, int pRandom)
          Returns the file name based on the params.
static java.io.File createUuidFile(java.lang.String pFilePath)
          Create a new file with a UUID file name.
static java.lang.String createUuidFileName(java.lang.String pFilePath)
          Create a new file with a UUID file name.
static void deleteFile(java.io.File pFile)
           
static void deleteFile(java.lang.String pFileName)
          Delete the file.
static java.lang.String extractDir(java.lang.String pFileName)
          Extract the directory from the absolute file name.
static boolean fileExists(java.io.File pFile)
          Checks to see if the object passed is a file.
static boolean fileExists(java.lang.String pFileName)
          Checks to see if the object passed is a file.
static java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter, boolean pExclude)
          Returns the file filter object.
static java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter, boolean pExclude, boolean pEndsWith)
          Returns the file filter object.
static java.lang.String[] getFileNames(java.lang.String pDataDir, java.lang.String pFilter)
          Returns files from the data dir based on the max allowed.
static java.lang.String[] getFileNames(java.lang.String pDataDir, java.lang.String pFilter, boolean pExclude)
          Returns files from the data dir based on the max allowed.
static java.lang.String[] getFileNames(java.lang.String pDataDir, java.lang.String pFilter, boolean pExclude, boolean pEndsWith)
          Returns files from the data dir based on the max allowed.
static java.lang.String[] getFileNames(java.lang.String pDataDir, java.lang.String pFilter, boolean pExclude, boolean pEndsWith, boolean pRecursive)
          Returns files from the data dir based on the max allowed.
static java.lang.String[] getFileNames(java.lang.String pDataDir, java.lang.String pFilter, boolean pExclude, boolean pEndsWith, boolean pRecursive, int pMaxFiles)
          Returns files from the data dir based on the max allowed.
static java.lang.String[] getFileNamesRecursive(java.lang.String pDataDir, java.io.FilenameFilter pFilter, int pMaxFiles)
          Do a recursive file find.
static java.lang.String getFileParent(java.io.File pFile)
          Returns the file file path.
static java.lang.String getFileParent(java.lang.String pFile)
          Returns the file file path.
static boolean isDir(java.io.File pFile)
          Checks to see if the object passed is a directory.
static boolean isDir(java.lang.String pFile)
          Checks to see if the object passed is a directory.
static void isFile(java.io.File pFile)
          Checks to see if the object passed is a file.
static void isFile(java.lang.String pFileName)
          Checks to see if the object passed is a file.
static long lastModifiedTime(java.io.File pFile)
          Retrurns a file's last modified time.
static java.util.List<java.nio.channels.FileChannel> loadChannels(java.util.List<java.io.FileInputStream> pInputStreams)
          Load the file channels for the files passed.
static java.lang.String[] loadFileNames(java.lang.String pDataDir, java.lang.String pFilter, int pMax, boolean pEndsWith)
          Load all (or max) of the file names.
static java.util.List<java.io.File> loadFiles(java.lang.String pDataDir, java.lang.String pFilter, int pMax)
          Load all (or max) of the file input streams.
static java.util.List<java.io.File> loadFiles(java.lang.String pDataDir, java.lang.String pFilter, int pMax, boolean pEndsWith)
          Load all (or max) of the file input streams.
static java.util.List<java.io.FileInputStream> loadInputStreams(java.util.List<java.io.File> pFiles)
          Load the file input streams for the files passed.
static void loadProperties(java.io.File pFile, java.util.Properties pProperties)
          Refresh the values in a properties object with the values in the file system.
static void loadProperties(java.io.File pFile, java.util.Properties pProperties, boolean mIsXml)
          Refresh the values in a properties object with the values in the file system.
static void loadProperties(java.lang.String pFileName, java.util.Properties pProperties)
          Refresh the values in a properties object with the values in the file system.
static void loadXmlProperties(java.io.File pFile, java.util.Properties pProperties)
          Refresh the values in a properties object with the values in the file system.
static java.util.Properties loadXmlProperties(java.lang.String pFileName)
          Load properties from an xml config file.
static void loadXmlProperties(java.lang.String pFileName, java.util.Properties pProperties)
          Refresh the values in a properties object with the values in the file system.
static java.nio.ByteBuffer mapFileToBuffer(java.lang.String pFileName)
          Read a file to a memory mapped buffer (read only).
static void moveFile(java.io.File pFile, java.io.File pToDir)
          Move a file.
static void moveFile(java.lang.String pFile, java.lang.String pToDir)
          Move a file.
static void readableFile(java.io.File pFile)
          Check to see if the file name is a readable file.
static void readableFile(java.lang.String pFileName)
          Check to see if the file name is a readable file.
static java.nio.ByteBuffer readFileBuffer(java.io.File pFile)
          Reads a file and closes the file stream/channel.
static java.lang.String readFileStr(java.io.File pFile)
          Reads a file and closes the file stream/channel.
static java.lang.String readFileStr(java.lang.String pFileName)
          Reads a file and closes the file stream/channel.
static void renameFile(java.io.File pBefore, java.io.File pAfter)
          Rename the file.
static void renameFile(java.io.File pFrom, java.io.File pTo, long pRetrySleep)
          Rename a file with a retry.
static void renameFile(java.lang.String pBefore, java.lang.String pAfter)
          Rename the file.
static void storeProperties(java.lang.String pFileName, java.util.Properties pProperties)
          Store properties object.
static void storeProperties(java.lang.String pFileName, java.util.Properties pProperties, boolean pUseXml)
          Store properties object.
static void storeXmlProperties(java.lang.String pFileName, java.util.Properties pProperties)
          Store properties object to xml.
static void writableFile(java.io.File pFile)
          Check to see if the file name is a writable file.
static void writableFile(java.lang.String pFileName)
          Check to see if the file name is a writable file.
static void writeBufferToFile(java.nio.ByteBuffer pBuffer, java.lang.String pFileName)
          Write the entire byte buffer to a file.
static void writeBufferToFile(java.nio.ByteBuffer pBuffer, java.lang.String pFileName, java.lang.String pTmpFileName)
          Write the entire byte buffer to a file.
static int writeInputStreamToFile(java.io.InputStream pInputStream, byte[] pReadBuffer, java.lang.String pFilePath)
          Writes the entire input stream to the file.
static java.lang.String writeInputStreamToFile(java.io.InputStream pInputStream, int pReadBufferSize, java.lang.String pFilePath)
          Writes the entire input stream to the file.
static void writeInputStreamToFile(java.io.InputStream pInputStream, java.lang.String pFileName)
          Writes the entire input stream to the file.
static int writeInputStreamToFile(java.io.InputStream pInputStream, java.lang.String pFileName, byte[] pReadBuffer)
          Writes the entire input stream to the file.
static int writeInputStreamToFile(java.io.InputStream pInputStream, java.lang.String pFileName, int pReadBufferSize)
          Writes the entire input stream to the file.
static void writeStrToFile(java.lang.String pContent, java.lang.String pFileName)
          Writes the string to to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_FILE_NAMES

public static final int DEFAULT_MAX_FILE_NAMES
See Also:
Constant Field Values
Constructor Detail

FileUtils

public FileUtils()
Method Detail

writeInputStreamToFile

public static final void writeInputStreamToFile(java.io.InputStream pInputStream,
                                                java.lang.String pFileName)
                                         throws FileException
Writes the entire input stream to the file. This class creates a 1024 byte buffer for reading.

Parameters:
pInputStream - The is.
pFileName - The file name.
Throws:
FileException

getFileParent

public static java.lang.String getFileParent(java.lang.String pFile)
Returns the file file path.

Parameters:
pFile - The file.
Returns:
The file path.

getFileParent

public static java.lang.String getFileParent(java.io.File pFile)
Returns the file file path.

Parameters:
pFile - The file.
Returns:
The file path.

writeInputStreamToFile

public static final java.lang.String writeInputStreamToFile(java.io.InputStream pInputStream,
                                                            int pReadBufferSize,
                                                            java.lang.String pFilePath)
                                                     throws FileException
Writes the entire input stream to the file.

Parameters:
pInputStream - The is.
pReadBufferSize - The read buffer size.
pFilePath - The directory to store the file in.
Returns:
The name of the new file.
Throws:
FileException

writeInputStreamToFile

public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
                                               byte[] pReadBuffer,
                                               java.lang.String pFilePath)
                                        throws FileException
Writes the entire input stream to the file.

Parameters:
pInputStream - The is.
pReadBuffer - The read buffer.
pFilePath - The directory to store the file in.
Returns:
The total number of bytes read.
Throws:
FileException

writeInputStreamToFile

public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
                                               java.lang.String pFileName,
                                               int pReadBufferSize)
                                        throws FileException
Writes the entire input stream to the file.

Parameters:
pInputStream - The is.
pFileName - The file name.
pReadBufferSize - The read buffer size.
Returns:
The total number of bytes read.
Throws:
FileException

writeStrToFile

public static final void writeStrToFile(java.lang.String pContent,
                                        java.lang.String pFileName)
                                 throws FileException
Writes the string to to a file.

Parameters:
pContent - The content.
pFileName - The file name.
Throws:
FileException

writeInputStreamToFile

public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
                                               java.lang.String pFileName,
                                               byte[] pReadBuffer)
                                        throws FileException
Writes the entire input stream to the file.

Parameters:
pInputStream - The is.
pFileName - The file name.
pReadBuffer - The read buffer.
Returns:
The total number of bytes read.
Throws:
FileException

writeBufferToFile

public static final void writeBufferToFile(java.nio.ByteBuffer pBuffer,
                                           java.lang.String pFileName)
                                    throws CoreException
Write the entire byte buffer to a file. This calls clear on the buffer.

Parameters:
pBuffer - The buffer.
pFileName - The file name.
Throws:
CoreException

mapFileToBuffer

public static final java.nio.ByteBuffer mapFileToBuffer(java.lang.String pFileName)
                                                 throws CoreException
Read a file to a memory mapped buffer (read only).

Parameters:
pFileName - The file name.
Throws:
CoreException

writeBufferToFile

public static final void writeBufferToFile(java.nio.ByteBuffer pBuffer,
                                           java.lang.String pFileName,
                                           java.lang.String pTmpFileName)
                                    throws CoreException
Write the entire byte buffer to a file. This calls clear on the buffer.

Parameters:
pBuffer - The buffer.
pFileName - The file name.
pTmpFileName - The temp file name if null, doesn't use.
Throws:
CoreException

deleteFile

public static final void deleteFile(java.io.File pFile)
                             throws CoreException
Throws:
CoreException

deleteFile

public static final void deleteFile(java.lang.String pFileName)
                             throws CoreException
Delete the file.

Parameters:
pFileName - The file name.
Throws:
CoreException

getFileNames

public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
                                                    java.lang.String pFilter)
Returns files from the data dir based on the max allowed.

Returns:
The file names.

getFileNames

public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
                                                    java.lang.String pFilter,
                                                    boolean pExclude)
Returns files from the data dir based on the max allowed.

Returns:
The file names.

getFileNames

public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
                                                    java.lang.String pFilter,
                                                    boolean pExclude,
                                                    boolean pEndsWith)
Returns files from the data dir based on the max allowed.

Parameters:
pDataDir - The data directory.
pExclude - Set to true to get all the files but this filter.
pEndsWith - Set to true to indicate that the filter be the end value.
Returns:
The files names.

getFileNames

public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
                                                    java.lang.String pFilter,
                                                    boolean pExclude,
                                                    boolean pEndsWith,
                                                    boolean pRecursive)
Returns files from the data dir based on the max allowed.

Parameters:
pDataDir - The data directory.
pExclude - Set to true to get all the files but this filter.
pEndsWith - Set to true to indicate that the filter be the end value.
pRecursive - Set to true to walk the directories below. Uses the DEFAULT_MAX_FILE_NAMES (10,000).
Returns:
The files names.

getFileNames

public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
                                                    java.lang.String pFilter,
                                                    boolean pExclude,
                                                    boolean pEndsWith,
                                                    boolean pRecursive,
                                                    int pMaxFiles)
Returns files from the data dir based on the max allowed.

Parameters:
pDataDir - The data directory.
pExclude - Set to true to get all the files but this filter.
pEndsWith - Set to true to indicate that the filter be the end value.
pRecursive - Set to true to walk the directoeis below.
pMaxFiles - The maximum number of files to return. This only applies if to recursive is set to true.
Returns:
The files names.

getFileNamesRecursive

public static final java.lang.String[] getFileNamesRecursive(java.lang.String pDataDir,
                                                             java.io.FilenameFilter pFilter,
                                                             int pMaxFiles)
Do a recursive file find.

Parameters:
pDataDir - The data directory.
pFilter - The file filter.
pMaxFiles - The maximum number of files.
pFileNames - This is set to null to start. If for whatever reason you pass in file names, they will be preserved.
Returns:
The file names.

loadInputStreams

public static final java.util.List<java.io.FileInputStream> loadInputStreams(java.util.List<java.io.File> pFiles)
                                                                      throws CoreException
Load the file input streams for the files passed.

Parameters:
pFiles - The files.
Returns:
The input streams.
Throws:
CoreException

closeFileInputStreams

public static final void closeFileInputStreams(java.util.List<java.io.FileInputStream> pInputStreams)
                                        throws CoreException
Close the input streams.

Parameters:
pInputStreams - The input streams.
Throws:
CoreException

closeFileInputStream

public static final void closeFileInputStream(java.io.FileInputStream pInputStream)
                                       throws CoreException
Close the input stream.

Parameters:
pInputStream - The input stream.
Throws:
CoreException

closeInputStream

public static final void closeInputStream(java.io.InputStream pInputStream)
                                   throws CoreException
Close the input stream.

Parameters:
pInputStream - The input stream.
Throws:
CoreException

closeFileOutputStream

public static final void closeFileOutputStream(java.io.FileOutputStream pOutputStream)
                                        throws FileException
Close the output stream.

Parameters:
pOutputStream - The file.
Throws:
FileException

createFileInputStream

public static final java.io.FileInputStream createFileInputStream(java.lang.String pFileName,
                                                                  boolean pExists)
                                                           throws CoreException
Load a file channel.

Parameters:
pFileName - The file name.
pExists - The flag that indicates if an error should be thrown if the file doesn't exist.
Returns:
The file channel.
Throws:
CoreException

loadChannels

public static final java.util.List<java.nio.channels.FileChannel> loadChannels(java.util.List<java.io.FileInputStream> pInputStreams)
Load the file channels for the files passed.

Parameters:
pInputStreams - The input streams.
Returns:
The file channels.
Throws:
java.io.FileNotFoundException

loadFiles

public static final java.util.List<java.io.File> loadFiles(java.lang.String pDataDir,
                                                           java.lang.String pFilter,
                                                           int pMax)
Load all (or max) of the file input streams.

Parameters:
pDataDir - The data dir.
pFilter - The filter.
pMax - The maximum number of files to process.

loadFiles

public static final java.util.List<java.io.File> loadFiles(java.lang.String pDataDir,
                                                           java.lang.String pFilter,
                                                           int pMax,
                                                           boolean pEndsWith)
Load all (or max) of the file input streams.

Parameters:
pDataDir - The data dir.
pFilter - The filter.
pMax - The maximum number of files to process.

loadFileNames

public static final java.lang.String[] loadFileNames(java.lang.String pDataDir,
                                                     java.lang.String pFilter,
                                                     int pMax,
                                                     boolean pEndsWith)
Load all (or max) of the file names.

Parameters:
pDataDir - The data dir.
pFilter - The filter.
pMax - The maximum number of files to process.

readFileStr

public static final java.lang.String readFileStr(java.lang.String pFileName)
                                          throws CoreException
Reads a file and closes the file stream/channel. WARNING: This loads the entire file into memory. Do this for known "small" files.

Parameters:
pFile - The file.
Throws:
CoreException

readFileStr

public static final java.lang.String readFileStr(java.io.File pFile)
                                          throws CoreException
Reads a file and closes the file stream/channel. WARNING: This loads the entire file into memory. Do this for known "small" files.

Parameters:
pFile - The file.
Throws:
CoreException

readFileBuffer

public static final java.nio.ByteBuffer readFileBuffer(java.io.File pFile)
                                                throws CoreException
Reads a file and closes the file stream/channel. WARNING: This loads the entire file into memory. Do this for known "small" files.

Parameters:
pFile - The file.
Throws:
CoreException

getFilenameFilter

public static final java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter,
                                                             boolean pExclude)
Returns the file filter object. This checks the cache based on the filter value.

Parameters:
pFilter - The filter.
pExclude - The exclude flag.

getFilenameFilter

public static final java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter,
                                                             boolean pExclude,
                                                             boolean pEndsWith)
Returns the file filter object. This checks the cache based on the filter value. This method can be refactored :-) In a hurry now,.

Parameters:
pFilter - The filter.
pExclude - The exclude flag.
pEndsWith - Make sure the suffix is there (in the filter).

createUuidFile

public static final java.io.File createUuidFile(java.lang.String pFilePath)
                                         throws FileException
Create a new file with a UUID file name.

Parameters:
pFilePath - The file path. This must end with a slash ( / or \ ).
Returns:
The new file.
Throws:
FileException

createUuidFileName

public static final java.lang.String createUuidFileName(java.lang.String pFilePath)
                                                 throws FileException
Create a new file with a UUID file name.

Parameters:
pFilePath - The file path. This must end with a slash ( / or \ ).
Returns:
The new file.
Throws:
FileException

extractDir

public static java.lang.String extractDir(java.lang.String pFileName)
Extract the directory from the absolute file name.

Parameters:
pFileName - The file name.
Returns:
The directory without the trailing slash /.

createFile

public static final java.io.File createFile(java.lang.String pFileName)
                                     throws FileException
Create a new file. If the file exisits, an exception is thrown.

Parameters:
pFileName - The file name.
Returns:
The new file.
Throws:
FileException

createDir

public static final void createDir(java.lang.String pDir)
                            throws FileException
Make sure all the directories are in place for the path. If already there, does nothing.

Parameters:
pDir - The directory we're looking for.
Throws:
CoreException
FileException

renameFile

public static final void renameFile(java.lang.String pBefore,
                                    java.lang.String pAfter)
                             throws CoreException
Rename the file.

Parameters:
pBefore - The current name.
pAfter - THe new name.
Throws:
CoreException

renameFile

public static final void renameFile(java.io.File pBefore,
                                    java.io.File pAfter)
                             throws CoreException
Rename the file.

Parameters:
pBefore - The current name.
pAfter - THe new name.
Throws:
CoreException

renameFile

public static final void renameFile(java.io.File pFrom,
                                    java.io.File pTo,
                                    long pRetrySleep)
                             throws CoreException
Rename a file with a retry.

Parameters:
pFrom - The from file.
pTo - The to file.
pRetrySleep - The retry sleep on failure. Set to zero for no retry.
Throws:
CoreException

moveFile

public static final void moveFile(java.lang.String pFile,
                                  java.lang.String pToDir)
                           throws CoreException
Move a file.

Parameters:
pFile - The from file.
pToDir - The directory to file.
Throws:
CoreException

moveFile

public static final void moveFile(java.io.File pFile,
                                  java.io.File pToDir)
                           throws CoreException
Move a file.

Parameters:
pFile - The from file.
pToDir - The directory to file.
Throws:
CoreException

lastModifiedTime

public static final long lastModifiedTime(java.io.File pFile)
                                   throws CoreException
Retrurns a file's last modified time.

Parameters:
pFile - The file.
Returns:
The last modified time.
Throws:
CoreException

storeXmlProperties

public static final void storeXmlProperties(java.lang.String pFileName,
                                            java.util.Properties pProperties)
                                     throws CoreException
Store properties object to xml.

Parameters:
pFileName - The file name.
pProperties - The properties.
Throws:
CoreException

storeProperties

public static final void storeProperties(java.lang.String pFileName,
                                         java.util.Properties pProperties)
                                  throws CoreException
Store properties object.

Parameters:
pFileName - The file name.
pProperties - The properties.
Throws:
CoreException

storeProperties

public static final void storeProperties(java.lang.String pFileName,
                                         java.util.Properties pProperties,
                                         boolean pUseXml)
                                  throws CoreException
Store properties object.

Parameters:
pFileName - The file name.
pProperties - The properties.
pUseXml - The xml flag.
Throws:
CoreException

loadProperties

public static final void loadProperties(java.io.File pFile,
                                        java.util.Properties pProperties)
                                 throws CoreException
Refresh the values in a properties object with the values in the file system.

Parameters:
pFile - The file.
pProperties - The properties.
Throws:
CoreException

loadProperties

public static final void loadProperties(java.lang.String pFileName,
                                        java.util.Properties pProperties)
                                 throws CoreException
Refresh the values in a properties object with the values in the file system.

Parameters:
pFileName - The file name.
pProperties - The properties.
Throws:
CoreException

loadXmlProperties

public static final void loadXmlProperties(java.lang.String pFileName,
                                           java.util.Properties pProperties)
                                    throws CoreException
Refresh the values in a properties object with the values in the file system.

Parameters:
pFileName - The file name.
pProperties - The properties.
Throws:
CoreException

loadXmlProperties

public static final void loadXmlProperties(java.io.File pFile,
                                           java.util.Properties pProperties)
                                    throws CoreException
Refresh the values in a properties object with the values in the file system.

Parameters:
pFile - The file.
pProperties - The properties.
Throws:
CoreException

loadProperties

public static final void loadProperties(java.io.File pFile,
                                        java.util.Properties pProperties,
                                        boolean mIsXml)
                                 throws CoreException
Refresh the values in a properties object with the values in the file system.

Parameters:
pFile - The file name.
pProperties - The properties.
Throws:
CoreException

loadXmlProperties

public static final java.util.Properties loadXmlProperties(java.lang.String pFileName)
                                                    throws CoreException
Load properties from an xml config file. This checks to see if the file is there (see readableFile(fileName). This creates a new properties object.

Parameters:
pFileName - The file name.
Returns:
The properties object.
Throws:
CoreException

fileExists

public static final boolean fileExists(java.lang.String pFileName)
Checks to see if the object passed is a file.

Parameters:
pFileName - The file name.
Returns:
True if the file exists.

fileExists

public static final boolean fileExists(java.io.File pFile)
Checks to see if the object passed is a file.

Parameters:
pFile - The file.
Returns:
True if the file exists.

isFile

public static final void isFile(java.lang.String pFileName)
                         throws CoreException
Checks to see if the object passed is a file. Throws an exception if it's not.

Parameters:
pFileName - The file name.
Throws:
CoreException

isFile

public static final void isFile(java.io.File pFile)
                         throws CoreException
Checks to see if the object passed is a file. Throws an exception if it's not.

Parameters:
pFile - The file.
Throws:
CoreException

isDir

public static final boolean isDir(java.lang.String pFile)
Checks to see if the object passed is a directory.

Parameters:
pFile - The file.
Throws:
CoreException

isDir

public static final boolean isDir(java.io.File pFile)
Checks to see if the object passed is a directory.

Parameters:
pFile - The file.

checkCanReadOrWrite

public static final void checkCanReadOrWrite(java.io.File pFile,
                                             boolean pReadCheck)
                                      throws CoreException
Check to see if a file is readable or writable.

Parameters:
pFile - The file.
pReadCheck - The read check flag.
Throws:
CoreException

writableFile

public static final void writableFile(java.lang.String pFileName)
                               throws CoreException
Check to see if the file name is a writable file. If it's not then throw an exception with the reason.

Parameters:
pFileName - The file name.
Throws:
CoreException

writableFile

public static final void writableFile(java.io.File pFile)
                               throws CoreException
Check to see if the file name is a writable file. If it's not then throw an exception with the reason.

Parameters:
pFile - The file.
Throws:
CoreException

readableFile

public static final void readableFile(java.io.File pFile)
                               throws CoreException
Check to see if the file name is a readable file. If it's not then throw an exception with the reason.

Parameters:
pFile - The file.
Throws:
CoreException

readableFile

public static final void readableFile(java.lang.String pFileName)
                               throws CoreException
Check to see if the file name is a readable file. If it's not then throw an exception with the reason.

Parameters:
pFileName - The file name.
Throws:
CoreException

createFileName

public static final java.lang.String createFileName(java.lang.String pDataDir,
                                                    java.lang.String pPrefix,
                                                    java.lang.String pExtension,
                                                    short pNodeId,
                                                    byte pInstanceId,
                                                    byte pFormatId,
                                                    byte pVersionId,
                                                    int pStartTime,
                                                    int pStopTime,
                                                    int pRandom)
Returns the file name based on the params.

Parameters:
pDataDir - The data directory. Don't include trailing /.
pPrefix - The file name prefix.
pExtension - File extension (do not include '.').
pNodeId - The node id.
pInstanceId - The instance id.
pFormatId - The format id.
pVersionId - The version id.
pStartTime - The start time.
pStopTime - The stop time.
pRandom - A random int.

assembleTimePathUuidFile

public static java.lang.String assembleTimePathUuidFile(java.lang.String pRootDir,
                                                        java.lang.String pFileNameExt)
Create a file name path with a random uuid for the name and the current time for the path (and passed extension).

Parameters:
pRootDir - The base directory.
pFileNameExt - The file name extension.
Returns:
The file name/path.


Copyright © 2009 Deft Labs - Released under LGPL, Version 3.0