|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectoemware.core.util.FileUtils
public final class FileUtils
The file utils.
| Constructor Summary | |
|---|---|
FileUtils()
|
|
| Method Summary | |
|---|---|
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 |
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 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 pEndsWidth)
Returns files from the data dir based on the max allowed. |
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 pEndsWidth)
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 pEndsWidth)
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 |
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 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileUtils()
| Method Detail |
|---|
public static final void writeInputStreamToFile(java.io.InputStream pInputStream,
java.lang.String pFileName)
throws FileException
pInputStream - The is.pFileName - The file name.
FileException
public static final java.lang.String writeInputStreamToFile(java.io.InputStream pInputStream,
int pReadBufferSize,
java.lang.String pFilePath)
throws FileException
pInputStream - The is.pReadBufferSize - The read buffer size.pFilePath - The directory to store the file in.
FileException
public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
byte[] pReadBuffer,
java.lang.String pFilePath)
throws FileException
pInputStream - The is.pReadBuffer - The read buffer.pFilePath - The directory to store the file in.
FileException
public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
java.lang.String pFileName,
int pReadBufferSize)
throws FileException
pInputStream - The is.pFileName - The file name.pReadBufferSize - The read buffer size.
FileException
public static final int writeInputStreamToFile(java.io.InputStream pInputStream,
java.lang.String pFileName,
byte[] pReadBuffer)
throws FileException
pInputStream - The is.pFileName - The file name.pReadBuffer - The read buffer.
FileException
public static final void writeBufferToFile(java.nio.ByteBuffer pBuffer,
java.lang.String pFileName)
throws CoreException
pBuffer - The buffer.pFileName - The file name.
CoreException
public static final java.nio.ByteBuffer mapFileToBuffer(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreException
public static final void writeBufferToFile(java.nio.ByteBuffer pBuffer,
java.lang.String pFileName,
java.lang.String pTmpFileName)
throws CoreException
pBuffer - The buffer.pFileName - The file name.pTmpFileName - The temp file name if null, doesn't use.
CoreException
public static final void deleteFile(java.io.File pFile)
throws CoreException
CoreException
public static final void deleteFile(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreException
public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
java.lang.String pFilter)
public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
java.lang.String pFilter,
boolean pExclude)
public static final java.lang.String[] getFileNames(java.lang.String pDataDir,
java.lang.String pFilter,
boolean pExclude,
boolean pEndsWidth)
public static final java.util.List<java.io.FileInputStream> loadInputStreams(java.util.List<java.io.File> pFiles)
throws CoreException
pFiles - The files.
CoreException
public static final void closeFileInputStreams(java.util.List<java.io.FileInputStream> pInputStreams)
throws CoreException
pInputStreams - The input streams.
CoreException
public static final void closeFileInputStream(java.io.FileInputStream pInputStream)
throws CoreException
pInputStream - The input stream.
CoreException
public static final void closeFileOutputStream(java.io.FileOutputStream pOutputStream)
throws FileException
pOutputStream - The file.
FileException
public static final java.io.FileInputStream createFileInputStream(java.lang.String pFileName,
boolean pExists)
throws CoreException
pFileName - The file name.pExists - The flag that indicates if an error should be
thrown if the file doesn't exist.
CoreExceptionpublic static final java.util.List<java.nio.channels.FileChannel> loadChannels(java.util.List<java.io.FileInputStream> pInputStreams)
pInputStreams - The input streams.
java.io.FileNotFoundException
public static final java.util.List<java.io.File> loadFiles(java.lang.String pDataDir,
java.lang.String pFilter,
int pMax)
pDataDir - The data dir.pFilter - The filter.pMax - The maximum number of files to process.
public static final java.util.List<java.io.File> loadFiles(java.lang.String pDataDir,
java.lang.String pFilter,
int pMax,
boolean pEndsWidth)
pDataDir - The data dir.pFilter - The filter.pMax - The maximum number of files to process.
public static final java.lang.String[] loadFileNames(java.lang.String pDataDir,
java.lang.String pFilter,
int pMax,
boolean pEndsWidth)
pDataDir - The data dir.pFilter - The filter.pMax - The maximum number of files to process.
public static final java.nio.ByteBuffer readFileBuffer(java.io.File pFile)
throws CoreException
pFile - The file.
CoreException
public static final java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter,
boolean pExclude)
pFilter - The filter.pExclude - The exclude flag.
public static final java.io.FilenameFilter getFilenameFilter(java.lang.String pFilter,
boolean pExclude,
boolean pEndsWith)
pFilter - The filter.pExclude - The exclude flag.pEndsWith - Make sure the suffix is there (in the filter).
public static final java.io.File createUuidFile(java.lang.String pFilePath)
throws FileException
pFilePath - The file path. This must end with a slash ( / or \ ).
FileException
public static final java.lang.String createUuidFileName(java.lang.String pFilePath)
throws FileException
pFilePath - The file path. This must end with a slash ( / or \ ).
FileException
public static final java.io.File createFile(java.lang.String pFileName)
throws FileException
pFileName - The file name.
FileException
public static final void createDir(java.lang.String pDir)
throws FileException
pDir - The directory we're looking for.
CoreException
FileException
public static final void renameFile(java.lang.String pBefore,
java.lang.String pAfter)
throws CoreException
pBefore - The current name.pAfter - THe new name.
CoreException
public static final void renameFile(java.io.File pBefore,
java.io.File pAfter)
throws CoreException
pBefore - The current name.pAfter - THe new name.
CoreException
public static final void renameFile(java.io.File pFrom,
java.io.File pTo,
long pRetrySleep)
throws CoreException
pFrom - The from file.pTo - The to file.pRetrySleep - The retry sleep on failure. Set to zero for
no retry.
CoreException
public static final long lastModifiedTime(java.io.File pFile)
throws CoreException
pFile - The file.
CoreException
public static final void storeXmlProperties(java.lang.String pFileName,
java.util.Properties pProperties)
throws CoreException
pFileName - The file name.pProperties - The properties.
CoreException
public static final void storeProperties(java.lang.String pFileName,
java.util.Properties pProperties)
throws CoreException
pFileName - The file name.pProperties - The properties.
CoreException
public static final void storeProperties(java.lang.String pFileName,
java.util.Properties pProperties,
boolean pUseXml)
throws CoreException
pFileName - The file name.pProperties - The properties.pUseXml - The xml flag.
CoreException
public static final void loadProperties(java.io.File pFile,
java.util.Properties pProperties)
throws CoreException
pFile - The file.pProperties - The properties.
CoreException
public static final void loadProperties(java.lang.String pFileName,
java.util.Properties pProperties)
throws CoreException
pFileName - The file name.pProperties - The properties.
CoreException
public static final void loadXmlProperties(java.lang.String pFileName,
java.util.Properties pProperties)
throws CoreException
pFileName - The file name.pProperties - The properties.
CoreException
public static final void loadXmlProperties(java.io.File pFile,
java.util.Properties pProperties)
throws CoreException
pFile - The file.pProperties - The properties.
CoreException
public static final void loadProperties(java.io.File pFile,
java.util.Properties pProperties,
boolean mIsXml)
throws CoreException
pFile - The file name.pProperties - The properties.
CoreException
public static final java.util.Properties loadXmlProperties(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreExceptionpublic static final boolean fileExists(java.lang.String pFileName)
pFileName - The file name.
public static final boolean fileExists(java.io.File pFile)
pFile - The file.
public static final void isFile(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreException
public static final void isFile(java.io.File pFile)
throws CoreException
pFile - The file.
CoreException
public static final void checkCanReadOrWrite(java.io.File pFile,
boolean pReadCheck)
throws CoreException
pFile - The file.pReadCheck - The read check flag.
CoreException
public static final void writableFile(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreException
public static final void writableFile(java.io.File pFile)
throws CoreException
pFile - The file.
CoreException
public static final void readableFile(java.io.File pFile)
throws CoreException
pFile - The file.
CoreException
public static final void readableFile(java.lang.String pFileName)
throws CoreException
pFileName - The file name.
CoreException
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)
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||