|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.java.plugin.util.IoUtil
public final class IoUtil
Input/Output, File and URL/URI related utilities.
Method Summary | |
---|---|
static boolean |
compareFileDates(java.util.Date date1,
java.util.Date date2)
For some reason modification milliseconds for some files are unstable, use this function to compare file dates ignoring milliseconds. |
static boolean |
compareFiles(java.io.File file1,
java.io.File file2)
Compares two files for directories/files synchronization purposes. |
static void |
copyFile(java.io.File src,
java.io.File dest)
Copies one file, existing file will be overridden. |
static void |
copyFolder(java.io.File src,
java.io.File dest)
Copies folder recursively, existing files will be overridden |
static void |
copyFolder(java.io.File src,
java.io.File dest,
boolean recursive)
Copies folder, existing files will be overridden |
static void |
copyFolder(java.io.File src,
java.io.File dest,
boolean recursive,
boolean onlyNew)
Copies folder. |
static void |
copyFolder(java.io.File src,
java.io.File dest,
boolean recursive,
boolean onlyNew,
java.io.FileFilter filter)
Copies folder. |
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out,
int bufferSize)
Copies streams. |
static boolean |
emptyFolder(java.io.File folder)
Recursively deletes whole content of the given folder. |
static java.net.URL |
file2url(java.io.File file)
Utility method to convert a File object to a local URL. |
static java.io.InputStream |
getResourceInputStream(java.net.URL url)
Opens input stream for given resource. |
static boolean |
isResourceExists(java.net.URL url)
Checks if resource exist and can be opened. |
static void |
synchronizeFolders(java.io.File src,
java.io.File dest)
Performs one-way directories synchronization comparing files only, not folders. |
static void |
synchronizeFolders(java.io.File src,
java.io.File dest,
java.io.FileFilter filter)
Performs one-way directories synchronization comparing files only, not folders. |
static java.io.File |
url2file(java.net.URL url)
Utility method to convert local URL to a File object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void copyFile(java.io.File src, java.io.File dest) throws java.io.IOException
src
- source file to copy FROMdest
- destination file to copy TO
java.io.IOException
- if any I/O error has occurredpublic static void copyFolder(java.io.File src, java.io.File dest) throws java.io.IOException
src
- source folderdest
- target folder
java.io.IOException
- if any I/O error has occurredpublic static void copyFolder(java.io.File src, java.io.File dest, boolean recursive) throws java.io.IOException
src
- source folderdest
- target folderrecursive
- if true
, processes folder recursively
java.io.IOException
- if any I/O error has occurredpublic static void copyFolder(java.io.File src, java.io.File dest, boolean recursive, boolean onlyNew) throws java.io.IOException
src
- source folderdest
- target folderrecursive
- if true
, processes folder recursivelyonlyNew
- if true
, target file will be overridden if it
is older than source file only
java.io.IOException
- if any I/O error has occurredpublic static void copyFolder(java.io.File src, java.io.File dest, boolean recursive, boolean onlyNew, java.io.FileFilter filter) throws java.io.IOException
src
- source folderdest
- target folderrecursive
- if true
, processes folder recursivelyonlyNew
- if true
, target file will be overridden if it
is older than source file onlyfilter
- file filter, optional, if null
all files will
be copied
java.io.IOException
- if any I/O error has occurredpublic static void copyStream(java.io.InputStream in, java.io.OutputStream out, int bufferSize) throws java.io.IOException
in
- source streamout
- destination streambufferSize
- buffer size to use
java.io.IOException
- if any I/O error has occurredpublic static boolean emptyFolder(java.io.File folder)
folder
- folder to be emptied
true
if given folder becomes empty or not existspublic static boolean compareFiles(java.io.File file1, java.io.File file2)
file1
- one file to comparefile2
- another file to compare
true
if file names are equal (case sensitive), files
have equal lengths and modification dates (milliseconds ignored)synchronizeFolders(File, File)
,
compareFileDates(Date, Date)
public static boolean compareFileDates(java.util.Date date1, java.util.Date date2)
date1
- first file modification datedate2
- second file modification date
true
if files modification dates are equal ignoring
millisecondspublic static void synchronizeFolders(java.io.File src, java.io.File dest) throws java.io.IOException
src
- source folderdest
- target folder
java.io.IOException
- if any I/O error has occurredsynchronizeFolders(File, File, FileFilter)
,
compareFiles(File, File)
public static void synchronizeFolders(java.io.File src, java.io.File dest, java.io.FileFilter filter) throws java.io.IOException
src
- source folderdest
- target folderfilter
- file filter, optional, if null
all files will
be included into synchronization process
java.io.IOException
- if any I/O error has occurredcompareFiles(File, File)
public static boolean isResourceExists(java.net.URL url)
url
- absolute URL which points to a resource to be checked
true
if given URL points to an existing resourcepublic static java.io.InputStream getResourceInputStream(java.net.URL url) throws java.io.IOException
url
- resource URL
java.io.IOException
- if any I/O error has occurredpublic static java.io.File url2file(java.net.URL url)
File
object.
url
- an URL
null
if URL is not
localpublic static java.net.URL file2url(java.io.File file) throws java.net.MalformedURLException
File
object to a local URL.
file
- a file object
java.net.MalformedURLException
- if file can't be represented as URL for
some reason
|
JPF 1.5.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |