Modifier and Type | Field and Description |
---|---|
pack-priv static final int | |
private final Object | cacheFromUriLock
A one item cache for fromUri. |
private String | |
private String | |
private static final int | |
private static final int | |
public static final long | FAT_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under FAT. |
private static final FileAttribute | |
public static final long | NTFS_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under the NT File System. |
private static final boolean | |
private static final boolean | |
private static final boolean | |
private static final boolean | |
private static final FileUtils | |
private static Random | |
private static final FileAttribute | |
private static final FileAttribute | |
public static final long | UNIX_FILE_TIMESTAMP_GRANULARITY
The granularity of timestamps under Unix. |
Access | Constructor and Description |
---|---|
protected |
Modifier and Type | Method and Description |
---|---|
public boolean | |
public static void | |
public static void | |
public static void | close(OutputStream
stream, can be null. device)Close a stream without throwing any exception if something went wrong. |
public static void | close(InputStream
stream, can be null. device)Close a stream without throwing any exception if something went wrong. |
public static void | |
public static void | close(URLConnection
connection, can be null conn)Closes an URLConnection if its concrete implementation provides a way to close it that Ant knows of. |
public static void | close(AutoCloseable
AutoCloseable, can be null. ac)Close an |
public boolean | Returns: true if the content of the files is the same.the file whose content is to be compared. f1, File the other file whose content is to be compared. f2)Compares the contents of two files. |
public boolean | Returns: true if the content of the files is the same.the file whose content is to be compared. f1, File the other file whose content is to be compared. f2, boolean true if the file is to be treated as a text file and
differences in kind of line break are to be ignored. textfile)Compares the contents of two files. |
public void | |
public void | copyFile(String
Name of file to copy from.
Must not be sourceFile, String null .Name of file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters)Convenience method to copy a file from a source to a destination specifying if token filtering must be used. |
public void | copyFile(String
Name of file to copy from. Must not be sourceFile, String null .Name of file to copy to. Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be overwritten if it already
exists. 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. |
public void | copyFile(String
Name of file to copy from. Must not be sourceFile, String null .Name of file to copy to. Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file
should be set to that of the source file. 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 |
public void | copyFile(String
Name of file to copy from. Must not be sourceFile, String null .Name of file to copy to. Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be overwritten if it already
exists. overwrite, boolean Whether or not the last modified time of the resulting file
should be set to that of the source file. preserveLastModified, String the encoding used to read and write the files. 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 |
public void | copyFile(String
Name of file to copy from.
Must not be sourceFile, String null .Name of file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. preserveLastModified, String the encoding used to read and write the files. encoding, Project the project instance. 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
|
public void | copyFile(String
Name of file to copy from. Must not be sourceFile, String null .Name of file to copy to. Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be overwritten if it already
exists. overwrite, boolean Whether or not the last modified time of the resulting file
should be set to that of the source file. preserveLastModified, String the encoding used to read the files. inputEncoding, String the encoding used to write the files. outputEncoding, Project the project instance. 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 |
public void | |
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters)Convenience method to copy a file from a source to a destination specifying if token filtering must be used. |
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be
overwritten if it already exists. 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. |
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. 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 |
public void | copyFile(File
the file to copy from. Must not be sourceFile, File null .the file to copy to. Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, boolean Whether or not the destination file should be overwritten if it already
exists. overwrite, boolean Whether or not the last modified time of the resulting file
should be set to that of the source file. preserveLastModified, String the encoding used to read and write the files. 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 |
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. preserveLastModified, String the encoding used to read and write the files. encoding, Project the project instance. 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
|
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. preserveLastModified, String the encoding used to read the files. inputEncoding, String the encoding used to write the files. outputEncoding, Project the project instance. 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
|
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. preserveLastModified, boolean whether to append to the destination file. append, String the encoding used to read the files. inputEncoding, String the encoding used to write the files. outputEncoding, Project the project instance. 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
|
public void | copyFile(File
the file to copy from.
Must not be sourceFile, File null .the file to copy to.
Must not be destFile, FilterSetCollection null .the collection of filters to apply to this copy. filters, Vector<FilterChain> filterChains to apply during the copy. filterChains, boolean Whether or not the destination file should be
overwritten if it already exists. overwrite, boolean Whether or not the last modified time of
the resulting file should be set to that
of the source file. preserveLastModified, boolean whether to append to the destination file. append, String the encoding used to read the files. inputEncoding, String the encoding used to write the files. outputEncoding, Project the project instance. project, boolean whether to overwrite read-only destination files. force)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
|
public boolean | Returns: true if the file did not exist already.the file to be created. 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). |
public boolean | Returns: true if the file did not exist already.the file to be created. f, boolean boolean whether to create parent directories.Create a new file, optionally creating parent directories. |
public File | Returns: a File reference to the new, nonexistent temporary file.file name prefix. prefix, String file extension; include the '.'. suffix, File Directory to create the temporary file in; java.io.tmpdir used
if not specified. parentDir)
Deprecated
since ant 1.7.1 use createTempFile(Project, String, String, File,
boolean, boolean) instead.
Create a File object for a temporary file in a given directory.
|
public File | Returns: a File reference to the new temporary file.file name prefix. prefix, String file extension; include the '.'. suffix, File Directory to create the temporary file in;
java.io.tmpdir used if not specified. parentDir, boolean whether to set the tempfile for deletion on
normal VM exit. deleteOnExit, boolean true if the file must actually be created. If false
chances exist that a file with the same name is created in the time
between invoking this method and the moment the file is actually created.
If possible set to true. createFile)
Deprecated
since Ant 1.10.8 use createTempFile(Project, String, String, File,
boolean, boolean) instead.
Create a temporary file in a given directory.
|
public File | Returns: a File reference to the new temporary file.reference to the current Ant project. project, String file name prefix. prefix, String file extension; include the '.'. suffix, final File Directory to create the temporary file in;
if not specified and parentDir, final boolean project is not null then the value
of the property ant.tmpdir is used if set;
otherwise java.io.tmpdir is used.whether to set the tempfile for deletion on
normal VM exit. deleteOnExit, final boolean true if the file must actually be created. If false
chances exist that a file with the same name is created in the time
between invoking this method and the moment the file is actually created.
If possible set to true. createFile)Create a temporary file in a given directory. |
public File | Returns: a File reference to the new, nonexistent temporary file.file name prefix. prefix, String file extension; include the '.'. suffix, File Directory to create the temporary file in; java.io.tmpdir used
if not specified. parentDir, boolean whether to set the tempfile for deletion on normal VM exit. deleteOnExit)
Deprecated
since ant 1.7.1 use createTempFile(Project, String, String, File,
boolean, boolean) instead.
Create a File object for a temporary file in a given directory.
|
public static void | |
public String[] | |
public boolean | Returns: true if the file are for the same file.the file whose name is to be compared. f1, File the other file whose name is to be compared. f2)Compares two filenames. |
public String | |
public String | |
public long | Returns: the difference, in milliseconds, which two file timestamps must have in order for the two files to be considered to have different timestamps.Get the granularity of file timestamps. |
public URL | Returns: The FileURL value.the file whose URL representation is required. file)Get the URL for a file taking into account # characters. |
public static FileUtils | Returns: an instance of FileUtils.Method to retrieve The FileUtils, which is shared by all users of this method. |
public File | Returns: the given file's parent, or null if the file does not have a parent.the file whose parent is required. f)
Deprecated
since 1.7. Just use
This was originally an emulation of File#getParentFile directly.
File#getParentFile for JDK 1.1, but it is now
implemented using that method (Ant 1.6.3 onwards).
|
public static String | |
public static String | |
public static String[] | Returns: String s, never null to get names from path)Gets all names of the path as an array of |
public static String | Returns: the relative path between the filesthe fromFile, File File to calculate the path fromthe toFile)File to calculate the path toCalculates the relative path between two files. |
public boolean | Returns: true if the file exists and the case of the actual file is not the case of the parameterfile to test localFile)test whether a file or directory exists, with an error in the upper/lower case spelling of the name. |
public static boolean | Returns: true if the filename represents an absolute path.the filename to be checked. filename)Verifies that the specified filename represents an absolute path. |
public static Optional | Returns: Returns true if the filesystem corresponding to the passedpath
is case sensitive. Else returns false. If the case sensitivity
cannot be determined for whatever reason, this method returns an
Optional#empty() The path whose filesystem case sensitivity needs to be checked path)Tries to determine the case sensitivity of the filesystem corresponding to the
|
public static boolean | Returns: true if the filename is relative to system context.the filename to evaluate. filename)On DOS and NetWare, the evaluation of certain file specifications is context-dependent. |
public boolean | Returns: true if path starts with leading; false otherwise.The leading path, must not be null, must be absolute. leading, File The path to check, must not be null, must be absolute. path)Learn whether one path "leads" another. |
public boolean | Returns: true if path starts with leading; false otherwise.The leading path, must not be null, must be absolute. leading, File The path to check, must not be null, must be absolute. path, boolean whether symbolic links shall be resolved
prior to comparing the paths. resolveSymlinks)Learn whether one path "leads" another. |
private boolean | |
public boolean | Returns: true if the file is a symbolic link.the parent directory of the file to test parent, final String the name of the file to test. name)
Deprecated
use
Checks whether a given file is a symbolic link.
Files#isSymbolicLink(Path) instead
|
public boolean | Returns: true if the source is older than the dest after accounting for granularity.source file (should be the older). source, File dest file (should be the newer). dest, long an offset added to the source time. granularity)Returns true if the source is older than the dest. |
public boolean | Returns: true if the source is older than the dest, taking the granularity into account.source file (should be the older). source, File dest file (should be the newer). dest)Returns true if the source is older than the dest. |
public boolean | Returns: true if the dest file is considered up to date.timestamp of source file. sourceTime, long timestamp of dest file. destTime, long os/filesys granularity. granularity)Compare two timestamps for being up to date using the specified granularity. |
public boolean | Returns: true if the dest file is considered up to date.timestamp of source file. sourceTime, long timestamp of dest file. destTime)Compare two timestamps for being up to date using the current granularity. |
public static FileUtils | Returns: a new instance of FileUtils.
Deprecated
since 1.7.
Use getFileUtils instead,
FileUtils do not have state.
Factory method.
|
public static OutputStream | Returns: a stream ready to write to the filethe path of the file path, boolean whether to append to or a replace an existing file append)Opens a new OutputStream for the given Path. |
public File | |
public static String | |
public static String | |
public String | Returns: path's normalized absolute if it doesn't start with leading; path's path with leading's path removed otherwise.The leading path, must not be null, must be absolute. leading, File The path to remove from, must not be null, must be absolute. path)Removes a leading path from a second path. |
public void | |
public void | |
public File | Returns: an absolute 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
file, String new java.io.File(filename).getAbsoluteFile() .a file name. filename)Interpret the filename as a file relative to the given file unless the filename already represents an absolute filename. |
public static String | Returns: the string.the input to read from. reader)Safe read fully - do not return a null for an empty reader. |
public void | setFileLastModified(File
the file whose modified time is to be set file, long the time to which the last modified time is to be set.
if this is -1, the current time is used. time)Calls File.setLastModified(long time). |
public String | |
public String | |
public static String | Returns: the native version of the specified path or an empty string if the path isnull or empty.The path to be translated.
May be toProcess)null .Translate a path into its native (platform specific) format. |
public boolean | Returns: whether deletion was successfulFile f)Accommodate Windows bug encountered in both Sun and IBM JDKs. |
public boolean | Returns: whether deletion was successfulFile f, boolean boolean runGC)If delete does not work, call System.gc() if asked to, wait a little and try again. |