public class FileUtils extends Object
Modifier and Type | Field and Description |
---|---|
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.
|
Modifier | Constructor and Description |
---|---|
protected |
FileUtils()
Empty constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areSame(File f1,
File f2)
Are the two File instances pointing to the same object on the
file system?
|
static void |
close(java.nio.channels.Channel device)
Close a Channel without throwing any exception if something went wrong.
|
static void |
close(InputStream device)
Close a stream without throwing any exception if something went wrong.
|
static void |
close(OutputStream device)
Close a stream without throwing any exception if something went wrong.
|
static void |
close(Reader device)
Close a Reader without throwing any exception if something went wrong.
|
static void |
close(URLConnection conn)
Closes an URLConnection if its concrete implementation provides
a way to close it that Ant knows of.
|
static void |
close(Writer device)
Close a Writer without throwing any exception if something went wrong.
|
boolean |
contentEquals(File f1,
File f2)
Compares the contents of two files.
|
boolean |
contentEquals(File f1,
File f2,
boolean textfile)
Compares the contents of two files.
|
void |
copyFile(File sourceFile,
File destFile)
Convenience method to copy a file from a source to a destination.
|
void |
copyFile(File sourceFile,
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(File sourceFile,
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(File sourceFile,
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(File sourceFile,
File destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified,
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(File sourceFile,
File destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
boolean append,
String inputEncoding,
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(File sourceFile,
File destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
boolean append,
String inputEncoding,
String outputEncoding,
Project project,
boolean 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
destFile file should be made equal
to the last modified time of sourceFile . |
void |
copyFile(File sourceFile,
File destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
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(File sourceFile,
File destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
String inputEncoding,
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(String sourceFile,
String destFile)
Convenience method to copy a file from a source to a destination.
|
void |
copyFile(String sourceFile,
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(String sourceFile,
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(String sourceFile,
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(String sourceFile,
String destFile,
FilterSetCollection filters,
boolean overwrite,
boolean preserveLastModified,
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(String sourceFile,
String destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
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(String sourceFile,
String destFile,
FilterSetCollection filters,
Vector filterChains,
boolean overwrite,
boolean preserveLastModified,
String inputEncoding,
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(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(File f,
boolean mkdirs)
Create a new file, optionally creating parent directories.
|
File |
createTempFile(String prefix,
String suffix,
File parentDir,
boolean deleteOnExit,
boolean createFile)
Create a temporary file in a given directory.
|
static void |
delete(File file)
Delete the file with
File.delete() if the argument is not null. |
String[] |
dissect(String path)
Dissect the specified absolute path.
|
boolean |
fileNameEquals(File f1,
File f2)
Compares two filenames.
|
String |
fromURI(String uri)
Constructs a file path from a
file: URI. |
String |
getDefaultEncoding()
Get the default encoding.
|
long |
getFileTimestampGranularity()
Get the granularity of file timestamps.
|
URL |
getFileURL(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.
|
static String |
getPath(List pathStack)
Gets path from a
List of String s. |
static String |
getPath(List pathStack,
char separatorChar)
Gets path from a
List of String s. |
static String[] |
getPathStack(String path)
Gets all names of the path as an array of
String s. |
static String |
getRelativePath(File fromFile,
File toFile)
Calculates the relative path between two files.
|
boolean |
hasErrorInCase(File localFile)
test whether a file or directory exists, with an error in the
upper/lower case spelling of the name.
|
static boolean |
isAbsolutePath(String filename)
Verifies that the specified filename represents an absolute path.
|
static boolean |
isContextRelativePath(String filename)
On DOS and NetWare, the evaluation of certain file
specifications is context-dependent.
|
boolean |
isLeadingPath(File leading,
File path)
Learn whether one path "leads" another.
|
boolean |
isUpToDate(File source,
File dest)
Returns true if the source is older than the dest.
|
boolean |
isUpToDate(File source,
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.
|
File |
normalize(String path)
"Normalize" the given absolute path.
|
static String |
readFully(Reader rdr)
Read from reader till EOF.
|
static String |
readFully(Reader rdr,
int bufferSize)
Read from reader till EOF.
|
String |
removeLeadingPath(File leading,
File path)
Removes a leading path from a second path.
|
void |
rename(File from,
File to)
Renames a file, even if that involves crossing file system boundaries.
|
File |
resolveFile(File file,
String filename)
Interpret the filename as a file relative to the given file
unless the filename already represents an absolute filename.
|
static String |
safeReadFully(Reader reader)
Safe read fully - do not return a null for an empty reader.
|
void |
setFileLastModified(File file,
long time)
Calls File.setLastModified(long time).
|
String |
toURI(String path)
Constructs a
file: URI that represents the
external form of the given pathname. |
String |
toVMSPath(File f)
Returns a VMS String representation of a
File object. |
static String |
translatePath(String toProcess)
Translate a path into its native (platform specific) format.
|
boolean |
tryHardToDelete(File f)
Accommodate Windows bug encountered in both Sun and IBM JDKs.
|
boolean |
tryHardToDelete(File f,
boolean runGC)
If delete does not work, call System.gc() if asked to, wait a
little and try again.
|
public static final long FAT_FILE_TIMESTAMP_GRANULARITY
public static final long NTFS_FILE_TIMESTAMP_GRANULARITY
public static final long UNIX_FILE_TIMESTAMP_GRANULARITY
public boolean areSame(File f1, File f2) throws IOException
IOException
public static void close(java.nio.channels.Channel device)
device
- channel, can be null.public static void close(InputStream device)
device
- stream, can be null.public static void close(OutputStream device)
device
- stream, can be null.public static void close(Reader device)
device
- Reader, can be null.public static void close(URLConnection conn)
conn
- connection, can be nullpublic static void close(Writer device)
device
- output writer, can be null.public boolean contentEquals(File f1, File f2) throws IOException
f1
- the file whose content is to be compared.f2
- the other file whose content is to be compared.IOException
- if the files cannot be read.public boolean contentEquals(File f1, File f2, boolean textfile) throws 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.IOException
- if the files cannot be read.public void copyFile(File sourceFile, File destFile) throws IOException
sourceFile
- the file to copy from. Must not be null
.destFile
- the file to copy to. Must not be null
.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters) throws 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.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite) throws 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.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws 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.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, String encoding) throws 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.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, boolean append, String inputEncoding, String outputEncoding, Project project) throws 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.append
- whether to append to the destination file.inputEncoding
- the encoding used to read the files.outputEncoding
- the encoding used to write the files.project
- the project instance.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, boolean append, String inputEncoding, String outputEncoding, Project project, boolean force) throws 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.append
- whether to append to the destination file.inputEncoding
- the encoding used to read the files.outputEncoding
- the encoding used to write the files.project
- the project instance.force
- whether to overwrite read-only destination files.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String encoding, Project project) throws 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.IOException
- if the copying fails.public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String inputEncoding, String outputEncoding, Project project) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile) throws IOException
sourceFile
- Name of file to copy from.
Must not be null
.destFile
- Name of file to copy to.
Must not be null
.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified, String encoding) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String encoding, Project project) throws 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.IOException
- if the copying fails.public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String inputEncoding, String outputEncoding, Project project) throws 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.IOException
- if the copying fails.public boolean createNewFile(File f) throws IOException
This method has historically not guaranteed that the operation was atomic. In its current implementation it is.
f
- the file to be created.IOException
- on error.public boolean createNewFile(File f, boolean mkdirs) throws IOException
f
- the file to be created.mkdirs
- boolean
whether to create parent directories.IOException
- on error.public File createTempFile(String prefix, String suffix, File parentDir, boolean deleteOnExit, boolean createFile)
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.
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.deleteOnExit
- whether to set the tempfile for deletion on
normal VM exit.createFile
- 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.public static void delete(File file)
File.delete()
if the argument is not null.
Do nothing on a null argument.file
- file to delete.public String[] dissect(String path)
path
- the path to dissect.NullPointerException
- if path is null.public boolean fileNameEquals(File f1, 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 String fromURI(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 String getDefaultEncoding()
public long getFileTimestampGranularity()
public URL getFileURL(File file) throws MalformedURLException
file
- the file whose URL representation is required.MalformedURLException
- if the URL representation cannot be
formed.public static FileUtils getFileUtils()
public static String getPath(List pathStack)
List
of String
s.pathStack
- List
of String
s to be concatenated as a path.String
, never null
public static String getPath(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 pathString
, never null
public static String[] getPathStack(String path)
String
s.path
- to get names fromString
s, never null
public static String getRelativePath(File fromFile, File toFile) throws Exception
Implementation note:
This function may 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 toException
- for undocumented reasonsFile.getCanonicalPath()
public boolean hasErrorInCase(File localFile)
localFile
- file to testpublic static boolean isAbsolutePath(String filename)
filename
- the filename to be checked.NullPointerException
- if filename is null.public static boolean isContextRelativePath(String filename)
filename
- the filename to evaluate.NullPointerException
- if filename is null.public boolean isLeadingPath(File leading, 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 isUpToDate(File source, File dest)
source
- source file (should be the older).dest
- dest file (should be the newer).public boolean isUpToDate(File source, 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(long sourceTime, long destTime)
sourceTime
- timestamp of source file.destTime
- timestamp of dest file.public boolean isUpToDate(long sourceTime, long destTime, long granularity)
sourceTime
- timestamp of source file.destTime
- timestamp of dest file.granularity
- os/filesys granularity.public File normalize(String path)
This includes:
File.getCanonicalPath()
this method
specifically does not resolve symbolic links.path
- the path to be normalized.NullPointerException
- if path is null.public static String readFully(Reader rdr) throws IOException
rdr
- the reader from which to read.IOException
- if the contents could not be read out from the
reader.public static String readFully(Reader rdr, int bufferSize) throws IOException
rdr
- the reader from which to read.bufferSize
- the buffer size to use when reading.IOException
- if the contents could not be read out from the
reader.public String removeLeadingPath(File leading, 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 void rename(File from, File to) throws 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.IOException
- if anything bad happens during this
process. Note that to
may have been deleted
already when this happens.public File resolveFile(File file, 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.NullPointerException
- if filename is null.public static String safeReadFully(Reader reader) throws IOException
reader
- the input to read from.IOException
- if unable to read from reader.public void setFileLastModified(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 String toURI(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 String toVMSPath(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 static String translatePath(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 boolean tryHardToDelete(File f)
public boolean tryHardToDelete(File f, boolean runGC)