|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tools.ant.util.FileUtils
public class FileUtils
This class also encapsulates methods which allow Files to be referred to using abstract path names which are translated to native system file paths at runtime as well as copying files or setting their last modification time.
Field Summary | |
---|---|
static long |
FAT_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under FAT. |
static long |
NTFS_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under the NT File System. |
static long |
UNIX_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under Unix. |
Constructor Summary | |
---|---|
protected |
FileUtils()
Empty constructor. |
Method Summary | |
---|---|
static void |
close(java.io.InputStream device)
Close a stream without throwing any exception if something went wrong. |
static void |
close(java.io.OutputStream device)
Close a stream without throwing any exception if something went wrong. |
static void |
close(java.io.Reader device)
Close a stream without throwing any exception if something went wrong. |
static void |
close(java.io.Writer device)
Close a Writer without throwing any exception if something went wrong. |
boolean |
contentEquals(java.io.File f1,
java.io.File f2)
Compares the contents of two files. |
boolean |
contentEquals(java.io.File f1,
java.io.File f2,
boolean textfile)
Compares the contents of two files. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile)
Convenience method to copy a file from a source to a destination. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters,
boolean overwrite)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used and if source files may overwrite newer destination files. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified,
java.lang.String encoding)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if source files may overwrite newer destination files, the last modified time of destFile file should be made
equal to the last modified time of sourceFile and
which character encoding to assume. |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters,
java.util.Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
java.lang.String encoding,
Project project)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if filter chains must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.io.File sourceFile,
java.io.File destFile,
FilterSetCollection filters,
java.util.Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
java.lang.String inputEncoding,
java.lang.String outputEncoding,
Project project)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if filter chains must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile)
Convenience method to copy a file from a source to a destination. |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used. |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters,
boolean overwrite)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used and if source files may overwrite newer destination files. |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified,
java.lang.String encoding)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters,
java.util.Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
java.lang.String encoding,
Project project)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if filter chains must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(java.lang.String sourceFile,
java.lang.String destFile,
FilterSetCollection filters,
java.util.Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
java.lang.String inputEncoding,
java.lang.String outputEncoding,
Project project)
Convenience method to copy a file from a source to a destination specifying if token filtering must be used, if filter chains must be used, if source files may overwrite newer destination files and the last modified time of destFile file should be made equal
to the last modified time of sourceFile . |
boolean |
createNewFile(java.io.File f)
This was originally an emulation of File.createNewFile for JDK 1.1, but it is now implemented using that method (Ant 1.6.3 onwards). |
boolean |
createNewFile(java.io.File f,
boolean mkdirs)
Create a new file, optionally creating parent directories. |
java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File parentDir)
Create a temporary file in a given directory. |
java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix,
java.io.File parentDir,
boolean deleteOnExit)
Create a temporary file in a given directory. |
static void |
delete(java.io.File file)
Delete the file with File.delete() if the argument is not null. |
java.lang.String[] |
dissect(java.lang.String path)
Dissect the specified absolute path. |
boolean |
fileNameEquals(java.io.File f1,
java.io.File f2)
Compares two filenames. |
java.lang.String |
fromURI(java.lang.String uri)
Constructs a file path from a file: URI. |
java.lang.String |
getDefaultEncoding()
Get the default encoding. |
long |
getFileTimestampGranularity()
Get the granularity of file timestamps. |
java.net.URL |
getFileURL(java.io.File file)
Get the URL for a file taking into account # characters. |
static FileUtils |
getFileUtils()
Method to retrieve The FileUtils, which is shared by all users of this method. |
java.io.File |
getParentFile(java.io.File f)
Deprecated. since 1.7. Just use File.getParentFile() directly. |
static java.lang.String |
getPath(java.util.List pathStack)
Gets path from a List of String s. |
static java.lang.String |
getPath(java.util.List pathStack,
char separatorChar)
Gets path from a List of String s. |
static java.lang.String[] |
getPathStack(java.lang.String path)
Gets all names of the path as an array of String s. |
static java.lang.String |
getRelativePath(java.io.File fromFile,
java.io.File toFile)
Calculates the relative path between two files. |
static boolean |
isAbsolutePath(java.lang.String filename)
Verifies that the specified filename represents an absolute path. |
static boolean |
isContextRelativePath(java.lang.String filename)
On DOS and NetWare, the evaluation of certain file specifications is context-dependent. |
boolean |
isLeadingPath(java.io.File leading,
java.io.File path)
Learn whether one path "leads" another. |
boolean |
isSymbolicLink(java.io.File parent,
java.lang.String name)
Checks whether a given file is a symbolic link. |
boolean |
isUpToDate(java.io.File source,
java.io.File dest)
Returns true if the source is older than the dest. |
boolean |
isUpToDate(java.io.File source,
java.io.File dest,
long granularity)
Returns true if the source is older than the dest. |
boolean |
isUpToDate(long sourceTime,
long destTime)
Compare two timestamps for being up to date using the current granularity. |
boolean |
isUpToDate(long sourceTime,
long destTime,
long granularity)
Compare two timestamps for being up to date using the specified granularity. |
static FileUtils |
newFileUtils()
Deprecated. since 1.7. Use getFileUtils instead, FileUtils do not have state. |
java.io.File |
normalize(java.lang.String path)
"Normalize" the given absolute path. |
static java.lang.String |
readFully(java.io.Reader rdr)
Read from reader till EOF. |
static java.lang.String |
readFully(java.io.Reader rdr,
int bufferSize)
Read from reader till EOF. |
java.lang.String |
removeLeadingPath(java.io.File leading,
java.io.File path)
Removes a leading path from a second path. |
void |
rename(java.io.File from,
java.io.File to)
Renames a file, even if that involves crossing file system boundaries. |
java.io.File |
resolveFile(java.io.File file,
java.lang.String filename)
Interpret the filename as a file relative to the given file unless the filename already represents an absolute filename. |
void |
setFileLastModified(java.io.File file,
long time)
Calls File.setLastModified(long time). |
java.lang.String |
toURI(java.lang.String path)
Constructs a file: URI that represents the
external form of the given pathname. |
java.lang.String |
toVMSPath(java.io.File f)
Returns a VMS String representation of a File object. |
static java.lang.String |
translatePath(java.lang.String toProcess)
Translate a path into its native (platform specific) format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long FAT_FILE_TIMESTAMP_GRANULARITY
public static final long UNIX_FILE_TIMESTAMP_GRANULARITY
public static final long NTFS_FILE_TIMESTAMP_GRANULARITY
Constructor Detail |
---|
protected FileUtils()
Method Detail |
---|
public static FileUtils newFileUtils()
public static FileUtils getFileUtils()
public java.net.URL getFileURL(java.io.File file) throws java.net.MalformedURLException
file
- the file whose URL representation is required.
java.net.MalformedURLException
- if the URL representation cannot be
formed.public void copyFile(java.lang.String sourceFile, java.lang.String destFile) throws java.io.IOException
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters) throws java.io.IOException
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters, boolean overwrite) throws java.io.IOException
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, java.lang.String encoding) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.encoding
- the encoding used to read and write the files.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters, java.util.Vector filterChains, boolean overwrite, boolean preserveLastModified, java.lang.String encoding, Project project) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.filterChains
- filterChains to apply during the copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.encoding
- the encoding used to read and write the files.project
- the project instance.
java.io.IOException
- if the copying fails.public void copyFile(java.lang.String sourceFile, java.lang.String destFile, FilterSetCollection filters, java.util.Vector filterChains, boolean overwrite, boolean preserveLastModified, java.lang.String inputEncoding, java.lang.String outputEncoding, Project project) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.filterChains
- filterChains to apply during the copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.inputEncoding
- the encoding used to read the files.outputEncoding
- the encoding used to write the files.project
- the project instance.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile) throws java.io.IOException
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters) throws java.io.IOException
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters, boolean overwrite) throws java.io.IOException
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, java.lang.String encoding) throws java.io.IOException
destFile
file should be made
equal to the last modified time of sourceFile
and
which character encoding to assume.
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.encoding
- the encoding used to read and write the files.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters, java.util.Vector filterChains, boolean overwrite, boolean preserveLastModified, java.lang.String encoding, Project project) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.filterChains
- filterChains to apply during the copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.encoding
- the encoding used to read and write the files.project
- the project instance.
java.io.IOException
- if the copying fails.public void copyFile(java.io.File sourceFile, java.io.File destFile, FilterSetCollection filters, java.util.Vector filterChains, boolean overwrite, boolean preserveLastModified, java.lang.String inputEncoding, java.lang.String outputEncoding, Project project) throws java.io.IOException
destFile
file should be made equal
to the last modified time of sourceFile
.
sourceFile
- the file to copy from.
Must not be null
.destFile
- the file to copy to.
Must not be null
.filters
- the collection of filters to apply to this copy.filterChains
- filterChains to apply during the copy.overwrite
- Whether or not the destination file should be
overwritten if it already exists.preserveLastModified
- Whether or not the last modified time of
the resulting file should be set to that
of the source file.inputEncoding
- the encoding used to read the files.outputEncoding
- the encoding used to write the files.project
- the project instance.
java.io.IOException
- if the copying fails.public void setFileLastModified(java.io.File file, long time)
file
- the file whose modified time is to be settime
- the time to which the last modified time is to be set.
if this is -1, the current time is used.public java.io.File resolveFile(java.io.File file, java.lang.String filename)
new File(file, filename)
in that
the resulting File's path will always be a normalized,
absolute pathname. Also, if it is determined that
filename
is context-relative, file
will be discarded and the reference will be resolved using
available context/state information about the filesystem.
file
- the "reference" file for relative paths. This
instance must be an absolute file and must not contain
"./" or "../" sequences (same for \ instead
of /). If it is null, this call is equivalent to
new java.io.File(filename).getAbsoluteFile()
.filename
- a file name.
java.lang.NullPointerException
- if filename is null.public static boolean isContextRelativePath(java.lang.String filename)
filename
- the filename to evaluate.
java.lang.NullPointerException
- if filename is null.public static boolean isAbsolutePath(java.lang.String filename)
filename
- the filename to be checked.
java.lang.NullPointerException
- if filename is null.public static java.lang.String translatePath(java.lang.String toProcess)
This method uses PathTokenizer to separate the input path into its components. This handles DOS style paths in a relatively sensible way. The file separators are then converted to their platform specific versions.
toProcess
- The path to be translated.
May be null
.
null
or empty.PathTokenizer
public java.io.File normalize(java.lang.String path)
This includes:
File.getCanonicalPath()
this method
specifically does not resolve symbolic links.
path
- the path to be normalized.
java.lang.NullPointerException
- if path is null.public java.lang.String[] dissect(java.lang.String path)
path
- the path to dissect.
java.lang.NullPointerException
- if path is null.public java.lang.String toVMSPath(java.io.File f)
File
object.
This is useful since the JVM by default internally converts VMS paths
to Unix style.
The returned String is always an absolute path.
f
- The File
to get the VMS path for.
f
.public java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File parentDir)
The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.
The filename is prefixNNNNNsuffix where NNNN is a random number.
This method is different from File.createTempFile() of JDK 1.2 as it doesn't create the file itself. It uses the location pointed to by java.io.tmpdir when the parentDir attribute is null.
prefix
- prefix before the random number.suffix
- file extension; include the '.'.parentDir
- Directory to create the temporary file in;
java.io.tmpdir used if not specified.
public java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File parentDir, boolean deleteOnExit)
The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.
The filename is prefixNNNNNsuffix where NNNN is a random number.
This method is different from File.createTempFile() of JDK 1.2 as it doesn't create the file itself. It uses the location pointed to by java.io.tmpdir when the parentDir attribute is null.
prefix
- prefix before the random number.suffix
- file extension; include the '.'.parentDir
- Directory to create the temporary file in;deleteOnExit
- whether to set the tempfile for deletion on
normal VM exit.
java.io.tmpdir used if not specified.
public boolean contentEquals(java.io.File f1, java.io.File f2) throws java.io.IOException
f1
- the file whose content is to be compared.f2
- the other file whose content is to be compared.
java.io.IOException
- if the files cannot be read.public boolean contentEquals(java.io.File f1, java.io.File f2, boolean textfile) throws java.io.IOException
f1
- the file whose content is to be compared.f2
- the other file whose content is to be compared.textfile
- true if the file is to be treated as a text file and
differences in kind of line break are to be ignored.
java.io.IOException
- if the files cannot be read.public java.io.File getParentFile(java.io.File f)
File.getParentFile()
directly.
File.getParentFile()
for JDK 1.1,
but it is now implemented using that method (Ant 1.6.3 onwards).
f
- the file whose parent is required.
public static final java.lang.String readFully(java.io.Reader rdr) throws java.io.IOException
rdr
- the reader from which to read.
java.io.IOException
- if the contents could not be read out from the
reader.public static final java.lang.String readFully(java.io.Reader rdr, int bufferSize) throws java.io.IOException
rdr
- the reader from which to read.bufferSize
- the buffer size to use when reading.
java.io.IOException
- if the contents could not be read out from the
reader.public boolean createNewFile(java.io.File f) throws java.io.IOException
This method has historically not guaranteed that the operation was atomic. In its current implementation it is.
f
- the file to be created.
java.io.IOException
- on error.public boolean createNewFile(java.io.File f, boolean mkdirs) throws java.io.IOException
f
- the file to be created.mkdirs
- boolean
whether to create parent directories.
java.io.IOException
- on error.public boolean isSymbolicLink(java.io.File parent, java.lang.String name) throws java.io.IOException
It doesn't really test for symbolic links but whether the canonical and absolute paths of the file are identical--this may lead to false positives on some platforms.
parent
- the parent directory of the file to testname
- the name of the file to test.
java.io.IOException
- on error.public java.lang.String removeLeadingPath(java.io.File leading, java.io.File path)
leading
- The leading path, must not be null, must be absolute.path
- The path to remove from, must not be null, must be absolute.
public boolean isLeadingPath(java.io.File leading, java.io.File path)
leading
- The leading path, must not be null, must be absolute.path
- The path to remove from, must not be null, must be absolute.
public java.lang.String toURI(java.lang.String path)
file:
URI that represents the
external form of the given pathname.
Will be an absolute URI if the given path is absolute.
This code encodes non ASCII characters too.
The coding of the output is the same as what File.toURI().toASCIIString() produces
See dt-sysid which makes some mention of how characters not supported by URI Reference syntax should be escaped.
path
- the path in the local file system.
public java.lang.String fromURI(java.lang.String uri)
file:
URI.
Will be an absolute path if the given URI is absolute.
Swallows '%' that are not followed by two characters, doesn't deal with non-ASCII characters.
uri
- the URI designating a file in the local filesystem.
public boolean fileNameEquals(java.io.File f1, java.io.File f2)
Unlike java.io.File#equals this method will try to compare the absolute paths and "normalize" the filenames before comparing them.
f1
- the file whose name is to be compared.f2
- the other file whose name is to be compared.
public void rename(java.io.File from, java.io.File to) throws java.io.IOException
This will remove to
(if it exists), ensure that
to
's parent directory exists and move
from
, which involves deleting from
as
well.
from
- the file to move.to
- the new file name.
java.io.IOException
- if anything bad happens during this
process. Note that to
may have been deleted
already when this happens.public long getFileTimestampGranularity()
public boolean isUpToDate(java.io.File source, java.io.File dest, long granularity)
source
- source file (should be the older).dest
- dest file (should be the newer).granularity
- an offset added to the source time.
public boolean isUpToDate(java.io.File source, java.io.File dest)
source
- source file (should be the older).dest
- dest file (should be the newer).
public boolean isUpToDate(long sourceTime, long destTime, long granularity)
sourceTime
- timestamp of source file.destTime
- timestamp of dest file.granularity
- os/filesys granularity.
public boolean isUpToDate(long sourceTime, long destTime)
sourceTime
- timestamp of source file.destTime
- timestamp of dest file.
public static void close(java.io.Writer device)
device
- output writer, can be null.public static void close(java.io.Reader device)
device
- Reader, can be null.public static void close(java.io.OutputStream device)
device
- stream, can be null.public static void close(java.io.InputStream device)
device
- stream, can be null.public static void delete(java.io.File file)
File.delete()
if the argument is not null.
Do nothing on a null argument.
file
- file to delete.public static java.lang.String getRelativePath(java.io.File fromFile, java.io.File toFile) throws java.lang.Exception
Implementation note:
This function my throw an IOException if an
I/O error occurs because its use of the canonical pathname may require
filesystem queries.
fromFile
- the File
to calculate the path fromtoFile
- the File
to calculate the path to
java.lang.Exception
- for undocumented reasonsFile.getCanonicalPath()
public static java.lang.String[] getPathStack(java.lang.String path)
String
s.
path
- to get names from
String
s, never null
public static java.lang.String getPath(java.util.List pathStack)
List
of String
s.
pathStack
- List
of String
s to be concated
as a path.
String
, never null
public static java.lang.String getPath(java.util.List pathStack, char separatorChar)
List
of String
s.
pathStack
- List
of String
s to be concated
as a path.separatorChar
- char
to be used as separator between names in
path
String
, never null
public java.lang.String getDefaultEncoding()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |