|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.FileUtils
Class FileUtils contains various static utility methods for handling files.
Field Summary | |
protected static java.applet.Applet |
appletObj
|
protected static boolean |
DEBUG_FLAG
|
protected static FileUtils |
fileUtilsObj
|
protected static java.lang.String |
lastCreateUnusedFileNameStr
|
protected static java.lang.Object |
lastCreateUnusedFNSyncObj
|
static long |
MS_PER_DAY
Number of milliseconds in a day. |
static long |
MS_PER_HOUR
Number of milliseconds in an hour. |
protected static int |
STREAM_TRANSFER_BUFFER_SIZE
|
Method Summary | |
static java.lang.String |
addStrToFileName(java.lang.String fileNameStr,
java.lang.String s)
Add a string to the end of a file name (before the extension if present.) |
static java.io.BufferedReader |
appletResourceOpen(java.applet.Applet appletObj,
java.lang.String nameStr)
Attempts to open the given name as a file in the codebase of the given applet. |
static java.io.InputStream |
appletResourceOpenInputStream(java.applet.Applet appletObj,
java.lang.String nameStr)
Attempts to open the given name as a file in the codebase of the given applet. |
static java.io.BufferedInputStream |
appletResourceOpenStream(java.applet.Applet appletObj,
java.lang.String nameStr)
Attempts to open the given name as a file in the codebase of the given applet. |
static java.io.BufferedReader |
appResourceOpen(java.lang.String nameStr)
Attempts to open the given name via either the applet or application method, depending on if an Applet object has been setup via 'setAppletObj()'. |
static java.io.InputStream |
appResourceOpenInputStream(java.lang.String nameStr)
Attempts to open the given name via either the applet or application method, depending on if an Applet object has been setup via 'setAppletObj()'. |
static java.io.BufferedInputStream |
appResourceOpenStream(java.lang.String nameStr)
Attempts to open the given name via either the applet or application method, depending on if an Applet object has been setup via 'setAppletObj()'. |
static java.lang.String |
buildPathName(java.lang.String dirStr,
java.lang.String fileStr)
Combines the given directory and file names. |
static java.lang.String |
buildPathName(java.lang.String dirStr,
java.lang.String fileStr,
boolean forwardSlashFlag)
Combines the given directory and file names. |
static boolean |
closeStream(java.io.InputStream inputStreamObj)
Closes the given input stream. |
static boolean |
closeStream(java.io.OutputStream outputStreamObj)
Closes the given output stream. |
static void |
copyFile(java.io.File sourceFileObj,
java.io.File destFileObj)
Copies one file to another. |
static void |
copyFile(java.lang.String sourceFileNameStr,
java.lang.String destFileNameStr)
Copies one file to another. |
static java.lang.String |
createBackupFileName(java.lang.String fileNameStr)
Creates a backup file name for the specified file name. |
static java.lang.String |
createBackupFileName(java.lang.String fileNameStr,
java.lang.String backupStr)
Creates a backup file name for the specified file name. |
static boolean |
createParentDirs(java.io.File fileObj)
Creates any needed parent directories needed for the given file object. |
static boolean |
createParentDirs(java.lang.String nameStr)
Creates any needed parent directories needed for the given file/path name. |
static java.io.File |
createUnusedFileNameObj(java.lang.String tmplStr,
java.io.File parentDirFileObj,
boolean useTimeFlag)
Creates a new 'File' object that references an unused file name. |
static java.io.File |
createUnusedFileNameObj(java.lang.String tmplStr,
java.io.File parentDirFileObj,
boolean useTimeFlag,
boolean fileExtFlag)
Creates a new 'File' object that references an unused file name. |
static java.io.File |
createUnusedFileNameObj(java.lang.String tmplStr,
java.lang.String parentDirStr,
boolean useTimeFlag)
Creates a new 'File' object that references an unused file name. |
static java.io.File |
createUnusedFileNameObj(java.lang.String tmplStr,
java.lang.String parentDirStr,
boolean useTimeFlag,
boolean fileExtFlag)
Creates a new 'File' object that references an unused file name. |
static void |
deleteFiles(java.io.File file)
Deletes the specified file or if a directory is specified deletes the directory and any subdirectories. |
static void |
deleteFiles(java.io.File[] fileList,
int maxAgeDays)
Deletes files in the specified list that are older than the given age. |
static void |
deleteFiles(java.io.File[] fileList,
long maxAgeMs)
Deletes files in the specified list that are older than the given age. |
static void |
deleteOldFiles(java.io.File directoryObj,
int maxAgeDays)
Deletes files older than the given age from the specified directory. |
static void |
deleteOldFiles(java.io.File directoryObj,
int maxAgeDays,
java.lang.String filterStr)
Deletes files older than the given age from the specified directory. |
static void |
deleteOldFiles(java.io.File directoryObj,
long maxAgeMs)
Deletes files older than the given age from the specified directory. |
static void |
deleteOldFiles(java.io.File directoryObj,
long maxAgeMs,
java.lang.String filterStr)
Deletes files older than the given age from the specified directory. |
protected static java.io.InputStream |
doFileMultiOpenInputStream(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
protected static java.net.URL |
doFileMultiOpenInputURL(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
protected static java.net.URL |
doGetURL(java.lang.String nameStr)
Attempts to get a URL from the given name as a URL, as a local file, and as a system resource (whichever works first). |
static boolean |
endsWithDirSepChar(java.lang.String str)
Returns an indicator of whether or not the given string ends with a directory separator character. |
static boolean |
existsMultiOpen(java.lang.String nameStr)
Determines if the given name denotes an existing local file or a URL or 'jar'-file resource that may be accessed. |
static java.io.BufferedReader |
fileMultiOpen(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
static java.io.InputStream |
fileMultiOpenInputStream(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
static java.net.URL |
fileMultiOpenInputURL(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
static java.io.BufferedInputStream |
fileMultiOpenStream(java.lang.String nameStr)
Attempts to open the given name as a local file, as a URL, as a resource and as an entry in a 'jar' file (whichever works first). |
static java.io.BufferedReader |
getBufferedReader(java.io.InputStream stmObj)
Gets a buffered reader for the specified input stream. |
static long |
getFileAge(java.io.File f,
long currentTime)
|
static java.lang.String |
getFileExtension(java.lang.String fileNameStr)
Returns the extension portion of the file name string or null if none (does not include the ".".) |
static int |
getFileExtensionIndex(java.lang.String fileNameStr)
Returns the index of the extension portion of the file name string. |
static long |
getFileLength(java.lang.String nameStr)
Returns the file-length value for the file denoted by the given name. |
static java.lang.String |
getFileNameWithoutExtension(java.lang.String fileNameStr)
Returns the file name string without the extension portion. |
static long |
getLastModifiedTime(java.lang.String nameStr)
Returns the last-modified time value for the file denoted by the given name. |
static java.net.URL |
getURL(java.lang.String nameStr)
Attempts to get a URL from the given name as a URL, as a local file, and as a system resource (whichever works first). |
static boolean |
isDirSepChar(char ch)
Returns an indicator of whether or not the given character is a directory separator character. |
static java.io.File[] |
listAllFiles(java.io.File dirFileObj,
java.io.FileFilter filterObj)
Returns an array of abstract pathnames denoting the requested files in the specified directory and all subdirectories. |
static java.io.File[] |
listFiles(java.io.File directoryObj)
Returns an array of abstract pathnames denoting the files in the specified directory. |
static java.io.File[] |
listFiles(java.io.File directoryObj,
java.io.FileFilter filter)
Returns an array of abstract pathnames denoting the files in the specified directory. |
static void |
readFileTail(java.lang.String sourceFileNameStr,
long numberOfLines,
java.io.OutputStream outputStreamObj)
Reads given number of lines from tail end of given file. |
static byte[] |
readFileToBuffer(java.io.File fileObj)
Reads data from a file into a buffer. |
static byte[] |
readFileToBuffer(java.lang.String fileNameStr)
Reads data from a file into a buffer. |
static java.lang.String |
readFileToString(java.io.File fileObj)
Reads data from a file into a string. |
static java.lang.String |
readFileToString(java.lang.String fileNameStr)
Reads data from a file into a string. |
static byte[] |
readMultiOpenFileToBuffer(java.lang.String fileNameStr)
Reads data from a file into a byte array, where the given name may specify a local file, a URL, a resource or an entry in a 'jar' file (whichever works first). |
static java.lang.String |
readMultiOpenFileToString(java.lang.String fileNameStr)
Reads data from a file into a string, where the given name may specify a local file, a URL, a resource or an entry in a 'jar' file (whichever works first). |
static byte[] |
readStreamToBuffer(java.io.InputStream stmObj)
Reads data from an input stream into a byte array. |
static java.lang.String |
readStreamToString(java.io.BufferedReader rdrObj)
Reads data from an input stream into a string. |
static java.lang.String |
readStreamToString(java.io.InputStream stmObj)
Reads data from an input stream into a string. |
static java.lang.String |
removeLeadingDotDir(java.lang.String fileNameStr)
Removes leading "dot" directory from given filename. |
static void |
setAppletObj(java.applet.Applet appletObj)
Used to set Applet object to be used by the "appResourceOpen" methods. |
static void |
transferStream(java.io.InputStream inputStreamObj,
java.io.OutputStream outputStreamObj)
Transfers data from the input stream to the output stream. |
static void |
transferStream(java.io.InputStream inputStreamObj,
java.io.OutputStream outputStreamObj,
CallBackCompletion callBack)
Transfers data from the input stream to the output stream. |
static void |
transferStream(java.io.InputStream inputStreamObj,
java.io.OutputStream outputStreamObj,
long maxBytesLimit)
Transfers data from the input stream to the output stream. |
static boolean |
urlExists(java.net.URL urlObj)
Tests whether the specified URL exists. |
static void |
writeStringToFile(java.io.File fileObj,
java.lang.String dataStr)
Writes a data string to a file. |
static void |
writeStringToFile(java.io.File fileObj,
java.lang.String dataStr,
boolean appendFlag)
Writes a data string to a file. |
static void |
writeStringToFile(java.lang.String fileNameStr,
java.lang.String dataStr)
Writes a data string to a file. |
static void |
writeStringToFile(java.lang.String fileNameStr,
java.lang.String dataStr,
boolean appendFlag)
Writes a data string to a file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final boolean DEBUG_FLAG
protected static java.applet.Applet appletObj
protected static FileUtils fileUtilsObj
protected static int STREAM_TRANSFER_BUFFER_SIZE
public static final long MS_PER_HOUR
public static final long MS_PER_DAY
protected static java.lang.String lastCreateUnusedFileNameStr
protected static final java.lang.Object lastCreateUnusedFNSyncObj
Method Detail |
public static java.io.InputStream fileMultiOpenInputStream(java.lang.String nameStr)
nameStr
- file name string.
protected static java.io.InputStream doFileMultiOpenInputStream(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.BufferedInputStream fileMultiOpenStream(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.BufferedReader fileMultiOpen(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.InputStream appletResourceOpenInputStream(java.applet.Applet appletObj, java.lang.String nameStr)
appletObj
- Applet object.nameStr
- file name string.
public static java.io.BufferedInputStream appletResourceOpenStream(java.applet.Applet appletObj, java.lang.String nameStr)
appletObj
- Applet object.nameStr
- file name string.
public static java.io.BufferedReader appletResourceOpen(java.applet.Applet appletObj, java.lang.String nameStr)
appletObj
- Applet object.nameStr
- file name string.
public static void setAppletObj(java.applet.Applet appletObj)
appletObj
- Applet object.public static java.io.InputStream appResourceOpenInputStream(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.BufferedInputStream appResourceOpenStream(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.BufferedReader appResourceOpen(java.lang.String nameStr)
nameStr
- file name string.
public static java.net.URL fileMultiOpenInputURL(java.lang.String nameStr)
nameStr
- file name string.
protected static java.net.URL doFileMultiOpenInputURL(java.lang.String nameStr)
nameStr
- file name string.
public static void writeStringToFile(java.lang.String fileNameStr, java.lang.String dataStr, boolean appendFlag) throws java.io.IOException
fileNameStr
- the name of the output file.dataStr
- the data to be written.appendFlag
- true to append to current contents of file, false
to overwrite.
java.io.IOException
- if an error occurred while opening or writing to
the output file.public static void writeStringToFile(java.lang.String fileNameStr, java.lang.String dataStr) throws java.io.IOException
fileNameStr
- the name of the output file.dataStr
- the data to be written.
java.io.IOException
- if an error occurred while opening or writing to
the output file.public static void writeStringToFile(java.io.File fileObj, java.lang.String dataStr, boolean appendFlag) throws java.io.IOException
fileObj
- the output file object to use.dataStr
- the data to be written.appendFlag
- true to append to current contents of file, false
to overwrite.
java.io.IOException
- if an error occurred while opening or writing to
the output file.public static void writeStringToFile(java.io.File fileObj, java.lang.String dataStr) throws java.io.IOException
fileObj
- the output file object to use.dataStr
- the data to be written.
java.io.IOException
- if an error occurred while opening or writing to
the output file.public static java.lang.String readStreamToString(java.io.BufferedReader rdrObj) throws java.io.IOException
rdrObj
- the input stream to use.
java.io.IOException
- if an error occurred while reading from the
input stream.public static java.lang.String readStreamToString(java.io.InputStream stmObj) throws java.io.IOException
stmObj
- the input stream to use.
java.io.IOException
- if an error occurred while reading from the
input stream.public static java.lang.String readFileToString(java.lang.String fileNameStr) throws java.io.FileNotFoundException, java.io.IOException
fileNameStr
- the name of the input file.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static java.lang.String readFileToString(java.io.File fileObj) throws java.io.FileNotFoundException, java.io.IOException
fileObj
- the input file object.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static java.lang.String readMultiOpenFileToString(java.lang.String fileNameStr) throws java.io.FileNotFoundException, java.io.IOException
fileNameStr
- the name of the input file.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static byte[] readStreamToBuffer(java.io.InputStream stmObj) throws java.io.IOException
stmObj
- the input stream to use.
java.io.IOException
- if an error occurred while reading from the
input stream.public static byte[] readFileToBuffer(java.lang.String fileNameStr) throws java.io.FileNotFoundException, java.io.IOException
fileNameStr
- the name of the input file.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static byte[] readFileToBuffer(java.io.File fileObj) throws java.io.FileNotFoundException, java.io.IOException
fileObj
- the 'File' object for the input file.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static byte[] readMultiOpenFileToBuffer(java.lang.String fileNameStr) throws java.io.FileNotFoundException, java.io.IOException
fileNameStr
- the name of the input file.
java.io.FileNotFoundException
- if the specified file is not found.
java.io.IOException
- if an error occurred while opening or reading from
the input file.public static boolean createParentDirs(java.io.File fileObj)
fileObj
- the file object to use.
public static boolean createParentDirs(java.lang.String nameStr)
nameStr
- file name string.
public static java.io.File[] listFiles(java.io.File directoryObj)
directoryObj
- directory object.
If the file does is not a directory, then this
method returns null
. Otherwise an array of
File
objects is returned, one for each file or directory in
the directory. Pathnames denoting the directory itself and the
directory's parent directory are not included in the result. Each
resulting abstract pathname is constructed from this abstract pathname
using the
constructor. Therefore if this pathname
is absolute then each resulting pathname is absolute; if this pathname
is relative then each resulting pathname will be relative to the same
directory.
File(File, String)
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
null
if this abstract pathname
does not denote a directory, or if an I/O error occurs.public static java.io.File[] listFiles(java.io.File directoryObj, java.io.FileFilter filter)
directoryObj
- directory objectfilter
- The filename filter to use, or null for none.
null
if this abstract pathname
does not denote a directory, or if an I/O error occurs. If the file does is not a directory, then this
method returns null
. Otherwise an array of
File
objects is returned, one for each file or directory in
the directory. Pathnames denoting the directory itself and the
directory's parent directory are not included in the result. Each
resulting abstract pathname is constructed from this abstract pathname
using the {@link #File(java.io.File, java.lang.String)
File(File, String)}
constructor. Therefore if this pathname
is absolute then each resulting pathname is absolute; if this pathname
is relative then each resulting pathname will be relative to the same
directory.
There is no guarantee that the name strings in the resulting array
will appear in any specific order; they are not, in particular,
guaranteed to appear in alphabetical order.
public static java.io.File[] listAllFiles(java.io.File dirFileObj, java.io.FileFilter filterObj)
dirFileObj
- directory object to use.filterObj
- filename filter to use, or null for none.
public static java.io.BufferedReader getBufferedReader(java.io.InputStream stmObj)
stmObj
- the input stream.
public static long getFileAge(java.io.File f, long currentTime)
f
- filecurrentTime
- current time
public static void deleteFiles(java.io.File file)
file
- the 'File' object to delete.public static void deleteFiles(java.io.File[] fileList, long maxAgeMs)
fileList
- the array of 'File' objects to delete.maxAgeMs
- the maximum number of milliseconds to keep files.listFiles
public static void deleteFiles(java.io.File[] fileList, int maxAgeDays)
fileList
- the array of 'File' objects to delete.maxAgeDays
- the maximum number of days to keep files.listFiles
public static void deleteOldFiles(java.io.File directoryObj, long maxAgeMs, java.lang.String filterStr)
directoryObj
- the directory to use.maxAgeMs
- the maximum number of milliseconds to keep files, or
0 to delete no files.filterStr
- the file filter string to use (i.e.: "*.txt",
"temp.*", "temp.txt", "*bak*"), or null for none.IstiFileFilter.createFileFilter(java.lang.String)
public static void deleteOldFiles(java.io.File directoryObj, long maxAgeMs)
directoryObj
- the directory to use.maxAgeMs
- the maximum number of milliseconds to keep files, or
0 to delete no files.public static void deleteOldFiles(java.io.File directoryObj, int maxAgeDays, java.lang.String filterStr)
directoryObj
- the directory to use.maxAgeDays
- the maximum number of days to keep files, or 0
to delete no files.filterStr
- the file filter string to use (i.e.: "*.txt",
"temp.*", "temp.txt", "*bak*"), or null for none.IstiFileFilter.createFileFilter(java.lang.String)
public static void deleteOldFiles(java.io.File directoryObj, int maxAgeDays)
directoryObj
- the directory to use.maxAgeDays
- the maximum number of days to keep files, or 0
to delete no files.public static int getFileExtensionIndex(java.lang.String fileNameStr)
fileNameStr
- the name of the file.
FileFilter.accept(java.io.File)
public static java.lang.String getFileExtension(java.lang.String fileNameStr)
fileNameStr
- the name of the file.
public static java.lang.String getFileNameWithoutExtension(java.lang.String fileNameStr)
fileNameStr
- the name of the file.
public static java.lang.String removeLeadingDotDir(java.lang.String fileNameStr)
fileNameStr
- filename to process.
public static long getLastModifiedTime(java.lang.String nameStr)
nameStr
- file name string.
public static long getFileLength(java.lang.String nameStr)
nameStr
- file name string.
public static boolean urlExists(java.net.URL urlObj) throws java.io.IOException
urlObj
- the URL.
java.io.IOException
- if an I/O exception occurs.public static java.net.URL getURL(java.lang.String nameStr)
nameStr
- file name string.
protected static java.net.URL doGetURL(java.lang.String nameStr)
nameStr
- file name string.
public static boolean existsMultiOpen(java.lang.String nameStr)
nameStr
- file name string.
public static boolean isDirSepChar(char ch)
ch
- the character to test.
public static boolean endsWithDirSepChar(java.lang.String str)
str
- the string to test.
public static java.lang.String buildPathName(java.lang.String dirStr, java.lang.String fileStr, boolean forwardSlashFlag)
dirStr
- the directory name to use.fileStr
- the file name to use.forwardSlashFlag
- true to replace all backslash characters ('\')
in the path with forward-slash characters ('/').
public static java.lang.String buildPathName(java.lang.String dirStr, java.lang.String fileStr)
dirStr
- the directory name to use.fileStr
- the file name to use.
public static java.lang.String addStrToFileName(java.lang.String fileNameStr, java.lang.String s)
fileNameStr
- the name of the file.s
- string to add.
public static java.lang.String createBackupFileName(java.lang.String fileNameStr)
fileNameStr
- the name of the file.
public static java.lang.String createBackupFileName(java.lang.String fileNameStr, java.lang.String backupStr)
fileNameStr
- the name of the file.backupStr
- backup string to be added (bak) or null for none.
public static java.io.File createUnusedFileNameObj(java.lang.String tmplStr, java.lang.String parentDirStr, boolean useTimeFlag, boolean fileExtFlag)
tmplStr
- the template to use when generating the file name,
or null for none.parentDirStr
- the name of the parent directory to use, or
null to use the current user directory.useTimeFlag
- if true then the current time value (in ms since
1/1/1970) is used in the file name, if false then an incrementing
value is used, starting at 1 (if the template string name itself
is already in use).fileExtFlag
- true to insert numeric value before the filename
extension (if present); false to always append numeric value to end.
public static java.io.File createUnusedFileNameObj(java.lang.String tmplStr, java.lang.String parentDirStr, boolean useTimeFlag)
tmplStr
- the template to use when generating the file name,
or null for none.parentDirStr
- the name of the parent directory to use, or
null to use the current user directory.useTimeFlag
- if true then the current time value (in ms since
1/1/1970) is used in the file name, if false then an incrementing
value is used, starting at 1 (if the template string name itself
is already in use).
public static java.io.File createUnusedFileNameObj(java.lang.String tmplStr, java.io.File parentDirFileObj, boolean useTimeFlag, boolean fileExtFlag)
tmplStr
- the template to use when generating the file name,
or null for none.parentDirFileObj
- the File object for the parent directory to
use, or null to use the current user directory.useTimeFlag
- if true then the current time value (in ms since
1/1/1970) is used in the file name, if false then an incrementing
value is used, starting at 1 (if the template string name itself
is already in use).fileExtFlag
- true to insert numeric value before the filename
extension (if present); false to always append numeric value to end.
public static java.io.File createUnusedFileNameObj(java.lang.String tmplStr, java.io.File parentDirFileObj, boolean useTimeFlag)
tmplStr
- the template to use when generating the file name,
or null for none.parentDirFileObj
- the File object for the parent directory to
use, or null to use the current user directory.useTimeFlag
- if true then the current time value (in ms since
1/1/1970) is used in the file name, if false then an incrementing
value is used, starting at 1 (if the template string name itself
is already in use).
public static void transferStream(java.io.InputStream inputStreamObj, java.io.OutputStream outputStreamObj) throws java.io.IOException
inputStreamObj
- the input stream.outputStreamObj
- the output stream.
java.io.IOException
- if an I/O error occurs.public static void transferStream(java.io.InputStream inputStreamObj, java.io.OutputStream outputStreamObj, long maxBytesLimit) throws java.io.IOException
inputStreamObj
- the input stream.outputStreamObj
- the output stream.maxBytesLimit
- the maximum number of bytes to be transferred,
or 0 for no limit.
java.io.IOException
- if an I/O error occurs.public static void transferStream(java.io.InputStream inputStreamObj, java.io.OutputStream outputStreamObj, CallBackCompletion callBack) throws java.io.IOException
inputStreamObj
- the input stream.outputStreamObj
- the output stream.callBack
- callBack method or null to execute on the current thread.
java.io.IOException
- if an I/O error occurs.public static void copyFile(java.lang.String sourceFileNameStr, java.lang.String destFileNameStr) throws java.io.FileNotFoundException, java.io.IOException
sourceFileNameStr
- name of source file.destFileNameStr
- name of destination file.
java.io.FileNotFoundException
- if the source file is not found.
java.io.IOException
- if an I/O error occurs.public static void copyFile(java.io.File sourceFileObj, java.io.File destFileObj) throws java.io.FileNotFoundException, java.io.IOException
sourceFileObj
- source file object.destFileObj
- destination file object.
java.io.FileNotFoundException
- if the source file is not found.
java.io.IOException
- if an I/O error occurs.public static void readFileTail(java.lang.String sourceFileNameStr, long numberOfLines, java.io.OutputStream outputStreamObj) throws java.io.FileNotFoundException, java.io.IOException
sourceFileNameStr
- name of source file.numberOfLines
- number of lines to read.outputStreamObj
- output stream to send read data into.
java.io.FileNotFoundException
- if the source file is not found.
java.io.IOException
- if an I/O error occurs.public static boolean closeStream(java.io.InputStream inputStreamObj)
inputStreamObj
- the input stream.
public static boolean closeStream(java.io.OutputStream outputStreamObj)
outputStreamObj
- the output stream.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |