Methods Summary |
---|
private java.lang.String | calculatePath(java.lang.String dirPath, java.lang.String name)
dirPath = fixSlashes(dirPath);
if (!name.equals("")) { //$NON-NLS-1$
// Remove all the proceeding separator chars from name
name = fixSlashes(name);
int separatorIndex = 0;
while ((separatorIndex < name.length())
&& (name.charAt(separatorIndex) == separatorChar)) {
separatorIndex++;
}
if (separatorIndex > 0) {
name = name.substring(separatorIndex, name.length());
}
// Ensure there is a separator char between dirPath and name
if (dirPath.length() > 0
&& (dirPath.charAt(dirPath.length() - 1) == separatorChar)) {
return dirPath + name;
}
return dirPath + separatorChar + name;
}
return dirPath;
|
public boolean | canRead()Indicates whether the current context is allowed to read from this file.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
// BEGIN android-changed
return exists() && isReadableImpl(properPath(true));
// END android-changed
|
public boolean | canWrite()Indicates whether the current context is allowed to write to this file.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
// Cannot use exists() since that does an unwanted read-check.
boolean exists = false;
if (path.length() > 0) {
exists = existsImpl(properPath(true));
}
// BEGIN android-changed
return exists && isWriteableImpl(properPath(true));
// END android-changed
|
private void | checkURI(java.net.URI uri)
if (!uri.isAbsolute()) {
throw new IllegalArgumentException(Msg.getString("K031a", uri)); //$NON-NLS-1$
} else if (!uri.getRawSchemeSpecificPart().startsWith("/")) { //$NON-NLS-1$
throw new IllegalArgumentException(Msg.getString("K031b", uri)); //$NON-NLS-1$
}
String temp = uri.getScheme();
if (temp == null || !temp.equals("file")) { //$NON-NLS-1$
throw new IllegalArgumentException(Msg.getString("K031c", uri)); //$NON-NLS-1$
}
temp = uri.getRawPath();
if (temp == null || temp.length() == 0) {
throw new IllegalArgumentException(Msg.getString("K031d", uri)); //$NON-NLS-1$
}
if (uri.getRawAuthority() != null) {
throw new IllegalArgumentException(Msg.getString(
"K031e", new String[] { "authority", uri.toString() })); //$NON-NLS-1$ //$NON-NLS-2$
}
if (uri.getRawQuery() != null) {
throw new IllegalArgumentException(Msg.getString(
"K031e", new String[] { "query", uri.toString() })); //$NON-NLS-1$//$NON-NLS-2$
}
if (uri.getRawFragment() != null) {
throw new IllegalArgumentException(Msg.getString(
"K031e", new String[] { "fragment", uri.toString() })); //$NON-NLS-1$ //$NON-NLS-2$
}
|
public int | compareTo(java.io.File another)Returns the relative sort ordering of the paths for this file and the
file {@code another}. The ordering is platform dependent.
if (caseSensitive) {
return this.getPath().compareTo(another.getPath());
}
return this.getPath().compareToIgnoreCase(another.getPath());
|
public boolean | createNewFile()Creates a new, empty file on the file system according to the path
information stored in this file.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
if (0 == path.length()) {
throw new IOException(Msg.getString("KA012")); //$NON-NLS-1$
}
int result = newFileImpl(properPath(true));
switch (result) {
case 0:
return true;
case 1:
return false;
// BEGIN android-changed
default: {
// Try to provide a reasonable explanation.
String msg = null;
try {
File parent = getAbsoluteFile().getParentFile();
if (parent == null) {
/*
* This shouldn't happen, unless the caller
* tried to create "/". We just use the
* generic message for this case.
*/
} else if (! parent.exists()) {
msg = "Parent directory of file does not exist";
} else if (! parent.isDirectory()) {
msg = "Parent of file is not a directory";
} else if (! parent.canWrite()) {
msg = "Parent directory of file is not writable";
}
} catch (RuntimeException ex) {
/*
* Ignore the exception, and just fall through to
* use a generic message.
*/
}
if (msg == null) {
msg = "Cannot create";
}
throw new IOException(msg + ": " + path); //$NON-NLS-1$
}
// END android-changed
}
|
public static java.io.File | createTempFile(java.lang.String prefix, java.lang.String suffix)Creates an empty temporary file using the given prefix and suffix as part
of the file name. If suffix is null, {@code .tmp} is used. This method
is a convenience method that calls {@link #createTempFile(String, String,
File)} with the third argument being {@code null}.
return createTempFile(prefix, suffix, null);
|
public static java.io.File | createTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File directory)Creates an empty temporary file in the given directory using the given
prefix and suffix as part of the file name.
// Force a prefix null check first
if (prefix.length() < 3) {
throw new IllegalArgumentException(Msg.getString("K006b")); //$NON-NLS-1$
}
String newSuffix = suffix == null ? ".tmp" : suffix; //$NON-NLS-1$
String tmpDir = "."; //$NON-NLS-1$
tmpDir = AccessController.doPrivileged(new PriviAction<String>(
"java.io.tmpdir", ".")); //$NON-NLS-1$//$NON-NLS-2$
File result, tmpDirFile = directory == null ? new File(tmpDir)
: directory;
do {
result = genTempFile(prefix, newSuffix, tmpDirFile);
} while (!result.createNewFile());
return result;
|
public boolean | delete()Deletes this file. Directories must be empty before they will be deleted.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkDelete(path);
}
byte[] propPath = properPath(true);
if ((path.length() != 0) && isDirectoryImpl(propPath)) {
return deleteDirImpl(propPath);
}
return deleteFileImpl(propPath);
|
private native boolean | deleteDirImpl(byte[] filePath)
|
private native boolean | deleteFileImpl(byte[] filePath)
|
public void | deleteOnExit()Schedules this file to be automatically deleted once the virtual machine
terminates. This will only happen when the virtual machine terminates
normally as described by the Java Language Specification section 12.9.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkDelete(path);
}
// BEGIN android-changed
DeleteOnExit.getInstance().addFile(getAbsoluteName());
// END android-changed
|
public boolean | equals(java.lang.Object obj)Compares {@code obj} to this file and returns {@code true} if they
represent the same object using a path specific comparison.
if (!(obj instanceof File)) {
return false;
}
if (!caseSensitive) {
return path.equalsIgnoreCase(((File) obj).getPath());
}
return path.equals(((File) obj).getPath());
|
public boolean | exists()Returns a boolean indicating whether this file can be found on the
underlying file system.
if (path.length() == 0) {
return false;
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
return existsImpl(properPath(true));
|
private native boolean | existsImpl(byte[] filePath)
|
private java.lang.String | fixSlashes(java.lang.String origPath)The purpose of this method is to take a path and fix the slashes up. This
includes changing them all to the current platforms fileSeparator and
removing duplicates.
int uncIndex = 1;
int length = origPath.length(), newLength = 0;
if (separatorChar == '/") {
uncIndex = 0;
} else if (length > 2 && origPath.charAt(1) == ':") {
uncIndex = 2;
}
boolean foundSlash = false;
char newPath[] = origPath.toCharArray();
for (int i = 0; i < length; i++) {
char pathChar = newPath[i];
if (pathChar == '\\" || pathChar == '/") {
/* UNC Name requires 2 leading slashes */
if ((foundSlash && i == uncIndex) || !foundSlash) {
newPath[newLength++] = separatorChar;
foundSlash = true;
}
} else {
// check for leading slashes before a drive
if (pathChar == ':"
&& uncIndex > 0
&& (newLength == 2 || (newLength == 3 && newPath[1] == separatorChar))
&& newPath[0] == separatorChar) {
newPath[0] = newPath[newLength - 1];
newLength = 1;
// allow trailing slash after drive letter
uncIndex = 2;
}
newPath[newLength++] = pathChar;
foundSlash = false;
}
}
// remove trailing slash
if (foundSlash
&& (newLength > (uncIndex + 1) || (newLength == 2 && newPath[0] != separatorChar))) {
newLength--;
}
String tempPath = new String(newPath, 0, newLength);
// If it's the same keep it identical for SecurityManager purposes
if (!tempPath.equals(origPath)) {
return tempPath;
}
return origPath;
|
private static java.io.File | genTempFile(java.lang.String prefix, java.lang.String suffix, java.io.File directory)
if (counter == 0) {
int newInt = new java.util.Random().nextInt();
counter = ((newInt / 65535) & 0xFFFF) + 0x2710;
}
StringBuilder newName = new StringBuilder();
newName.append(prefix);
newName.append(counter++);
newName.append(suffix);
return new File(directory, newName.toString());
|
public java.io.File | getAbsoluteFile()Returns a new file constructed using the absolute path of this file.
return new File(this.getAbsolutePath());
|
private java.lang.String | getAbsoluteName()
File f = getAbsoluteFile();
String name = f.getPath();
if (f.isDirectory() && name.charAt(name.length() - 1) != separatorChar) {
// Directories must end with a slash
name = new StringBuilder(name.length() + 1).append(name)
.append('/").toString();
}
if (separatorChar != '/") { // Must convert slashes.
name = name.replace(separatorChar, '/");
}
return name;
|
public java.lang.String | getAbsolutePath()Returns the absolute path of this file.
byte[] absolute = properPath(false);
return Util.toString(absolute);
|
private native byte[] | getCanonImpl(byte[] filePath)
|
public java.io.File | getCanonicalFile()Returns a new file created using the canonical path of this file.
Equivalent to {@code new File(this.getCanonicalPath())}.
return new File(getCanonicalPath());
|
public java.lang.String | getCanonicalPath()Returns the absolute path of this file with all references resolved. An
absolute path is one that begins at the root of the file
system. The canonical path is one in which all references have been
resolved. For the cases of '..' and '.', where the file system supports
parent and working directory respectively, these are removed and replaced
with a direct directory reference. If the file does not exist,
getCanonicalPath() may not resolve any references and simply returns an
absolute path name or throws an IOException.
byte[] result = properPath(false);
boolean exists = false;
byte[] pathBytes = result;
do {
byte[] linkBytes = getLinkImpl(pathBytes);
if (linkBytes == pathBytes) {
break;
}
if (linkBytes[0] == separatorChar) {
pathBytes = linkBytes;
} else {
int index = pathBytes.length - 1;
while (pathBytes[index] != separatorChar) {
index--;
}
byte[] temp = new byte[index + 1 + linkBytes.length];
System.arraycopy(pathBytes, 0, temp, 0, index + 1);
System.arraycopy(linkBytes, 0, temp, index + 1,
linkBytes.length);
pathBytes = temp;
}
exists = existsImpl(pathBytes);
} while (exists);
if (exists) {
result = pathBytes;
}
int numSeparators = 1;
for (int i = 0; i < result.length; i++) {
if (result[i] == separatorChar) {
numSeparators++;
}
}
int sepLocations[] = new int[numSeparators];
int rootLoc = 0;
if (separatorChar != '/") {
if (result[0] == '\\") {
rootLoc = (result.length > 1 && result[1] == '\\") ? 1 : 0;
} else {
rootLoc = 2; // skip drive i.e. c:
}
}
byte newResult[] = new byte[result.length + 1];
int newLength = 0, lastSlash = 0, foundDots = 0;
sepLocations[lastSlash] = rootLoc;
for (int i = 0; i <= result.length; i++) {
if (i < rootLoc) {
newResult[newLength++] = result[i];
} else {
if (i == result.length || result[i] == separatorChar) {
if (i == result.length && foundDots == 0) {
break;
}
if (foundDots == 1) {
/* Don't write anything, just reset and continue */
foundDots = 0;
continue;
}
if (foundDots > 1) {
/* Go back N levels */
lastSlash = lastSlash > (foundDots - 1) ? lastSlash
- (foundDots - 1) : 0;
newLength = sepLocations[lastSlash] + 1;
foundDots = 0;
continue;
}
sepLocations[++lastSlash] = newLength;
newResult[newLength++] = (byte) separatorChar;
continue;
}
if (result[i] == '.") {
foundDots++;
continue;
}
/* Found some dots within text, write them out */
if (foundDots > 0) {
for (int j = 0; j < foundDots; j++) {
newResult[newLength++] = (byte) '.";
}
}
newResult[newLength++] = result[i];
foundDots = 0;
}
}
// remove trailing slash
if (newLength > (rootLoc + 1)
&& newResult[newLength - 1] == separatorChar) {
newLength--;
}
newResult[newLength] = 0;
newResult = getCanonImpl(newResult);
newLength = newResult.length;
return Util.toString(newResult, 0, newLength);
|
private native byte[] | getLinkImpl(byte[] filePath)
|
public java.lang.String | getName()Returns the name of the file or directory represented by this file.
int separatorIndex = path.lastIndexOf(separator);
return (separatorIndex < 0) ? path : path.substring(separatorIndex + 1,
path.length());
|
public java.lang.String | getParent()Returns the pathname of the parent of this file. This is the path up to
but not including the last name. {@code null} is returned if there is no
parent.
int length = path.length(), firstInPath = 0;
if (separatorChar == '\\" && length > 2 && path.charAt(1) == ':") {
firstInPath = 2;
}
int index = path.lastIndexOf(separatorChar);
if (index == -1 && firstInPath > 0) {
index = 2;
}
if (index == -1 || path.charAt(length - 1) == separatorChar) {
return null;
}
if (path.indexOf(separatorChar) == index
&& path.charAt(firstInPath) == separatorChar) {
return path.substring(0, index + 1);
}
return path.substring(0, index);
|
public java.io.File | getParentFile()Returns a new file made from the pathname of the parent of this file.
This is the path up to but not including the last name. {@code null} is
returned when there is no parent.
String tempParent = getParent();
if (tempParent == null) {
return null;
}
return new File(tempParent);
|
public java.lang.String | getPath()Returns the path of this file.
return path;
|
public int | hashCode()Returns an integer hash code for the receiver. Any two objects for which
{@code equals} returns {@code true} must return the same hash code.
if (caseSensitive) {
return path.hashCode() ^ 1234321;
}
return path.toLowerCase().hashCode() ^ 1234321;
|
public boolean | isAbsolute()Indicates if this file's pathname is absolute. Whether a pathname is
absolute is platform specific. On UNIX, absolute paths must start with
the character '/'; on Windows it is absolute if either it starts with
'\', '/', '\\' (to represent a file server), or a letter followed by a
colon.
// BEGIN android-changed
// Removing platform independent code because we're always on linux.
return path.length() > 0 && path.charAt(0) == separatorChar;
// END android-changed
|
private static native boolean | isCaseSensitiveImpl()
|
public boolean | isDirectory()Indicates if this file represents a directory on the
underlying file system.
if (path.length() == 0) {
return false;
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
return isDirectoryImpl(properPath(true));
|
private native boolean | isDirectoryImpl(byte[] filePath)
|
public boolean | isFile()Indicates if this file represents a file on the underlying
file system.
if (path.length() == 0) {
return false;
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
return isFileImpl(properPath(true));
|
private native boolean | isFileImpl(byte[] filePath)
|
public boolean | isHidden()Returns whether or not this file is a hidden file as defined by the
operating system. The notion of "hidden" is system-dependent. For
Unix systems (like Android) a file is considered hidden if its name
starts with a ".". For Windows systems there is an explicit flag in the
file system for this purpose.
if (path.length() == 0) {
return false;
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
return isHiddenImpl(properPath(true));
|
private native boolean | isHiddenImpl(byte[] filePath)
|
private native boolean | isReadableImpl(byte[] filePath)
|
private native boolean | isWriteableImpl(byte[] filePath)
|
public long | lastModified()Returns the time when this file was last modified, measured in
milliseconds since January 1st, 1970, midnight.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
long result = lastModifiedImpl(properPath(true));
/* Temporary code to handle both return cases until natives fixed */
if (result == -1 || result == 0) {
return 0;
}
return result;
|
private native long | lastModifiedImpl(byte[] filePath)
|
public long | length()Returns the length of this file in bytes.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
return lengthImpl(properPath(true));
|
private native long | lengthImpl(byte[] filePath)
|
public java.lang.String[] | list()Returns an array of strings with the file names in the directory
represented by this file. The result is {@ null} if this file is not a
directory.
The entries {@code .} and {@code ..} representing the current and parent
directory are not returned as part of the list.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
if (!isDirectory()) {
return null;
}
byte[][] implList = listImpl(properPath(true));
if (implList == null) {
return new String[0];
}
String result[] = new String[implList.length];
for (int index = 0; index < implList.length; index++) {
result[index] = Util.toString(implList[index]);
}
return result;
|
public java.lang.String[] | list(java.io.FilenameFilter filter)Gets a list of the files in the directory represented by this file. This
list is then filtered through a FilenameFilter and the names of files
with matching names are returned as an array of strings. Returns
{@code null} if this file is not a directory. If {@code filter} is
{@code null} then all filenames match.
The entries {@code .} and {@code ..} representing the current and parent
directories are not returned as part of the list.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
if (!isDirectory()) {
return null;
}
byte[][] implList = listImpl(properPath(true));
if (implList == null) {
return new String[0];
}
java.util.Vector<String> tempResult = new java.util.Vector<String>();
for (int index = 0; index < implList.length; index++) {
String aName = Util.toString(implList[index]);
if (filter == null || filter.accept(this, aName)) {
tempResult.addElement(aName);
}
}
String[] result = new String[tempResult.size()];
tempResult.copyInto(result);
return result;
|
public java.io.File[] | listFiles()Returns an array of files contained in the directory represented by this
file. The result is {@code null} if this file is not a directory. The
paths of the files in the array are absolute if the path of this file is
absolute, they are relative otherwise.
String[] tempNames = list();
if (tempNames == null) {
return null;
}
int resultLength = tempNames.length;
File results[] = new File[resultLength];
for (int i = 0; i < resultLength; i++) {
results[i] = new File(this, tempNames[i]);
}
return results;
|
public java.io.File[] | listFiles(java.io.FilenameFilter filter)Gets a list of the files in the directory represented by this file. This
list is then filtered through a FilenameFilter and files with matching
names are returned as an array of files. Returns {@code null} if this
file is not a directory. If {@code filter} is {@code null} then all
filenames match.
The entries {@code .} and {@code ..} representing the current and parent
directories are not returned as part of the list.
String[] tempNames = list(filter);
if (tempNames == null) {
return null;
}
int resultLength = tempNames.length;
File results[] = new File[resultLength];
for (int i = 0; i < resultLength; i++) {
results[i] = new File(this, tempNames[i]);
}
return results;
|
public java.io.File[] | listFiles(java.io.FileFilter filter)Gets a list of the files in the directory represented by this file. This
list is then filtered through a FileFilter and matching files are
returned as an array of files. Returns {@code null} if this file is not a
directory. If {@code filter} is {@code null} then all files match.
The entries {@code .} and {@code ..} representing the current and parent
directories are not returned as part of the list.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(path);
}
if (!isDirectory()) {
return null;
}
byte[][] implList = listImpl(properPath(true));
if (implList == null) {
return new File[0];
}
List<File> tempResult = new ArrayList<File>();
for (int index = 0; index < implList.length; index++) {
String aName = Util.toString(implList[index]);
File aFile = new File(this, aName);
if (filter == null || filter.accept(aFile)) {
tempResult.add(aFile);
}
}
return tempResult.toArray(new File[tempResult.size()]);
|
private static native synchronized byte[][] | listImpl(byte[] path)
|
public static java.io.File[] | listRoots()Lists the file system roots. The Java platform may support zero or more
file systems, each with its own platform-dependent root. Further, the
canonical pathname of any file on the system will always begin with one
of the returned file system roots.
byte[][] rootsList = rootsImpl();
if (rootsList == null) {
return new File[0];
}
File result[] = new File[rootsList.length];
for (int i = 0; i < rootsList.length; i++) {
result[i] = new File(Util.toString(rootsList[i]));
}
return result;
|
public boolean | mkdir()Creates the directory named by the trailing filename of this file. Does
not create the complete path required to create this directory.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
return mkdirImpl(properPath(true));
|
private native boolean | mkdirImpl(byte[] filePath)
|
public boolean | mkdirs()Creates the directory named by the trailing filename of this file,
including the complete directory path required to create this directory.
/* If the terminal directory already exists, answer false */
if (exists()) {
return false;
}
/* If the receiver can be created, answer true */
if (mkdir()) {
return true;
}
String parentDir = getParent();
/* If there is no parent and we were not created, answer false */
if (parentDir == null) {
return false;
}
/* Otherwise, try to create a parent directory and then this directory */
return (new File(parentDir).mkdirs() && mkdir());
|
private native int | newFileImpl(byte[] filePath)
|
private static native void | oneTimeInitialization()
|
byte[] | properPath(boolean internal)Returns a string representing the proper path for this file. If this file
path is absolute, the user.dir property is not prepended, otherwise it
is.
if (properPath != null) {
return properPath;
}
if(path.length() > 0 && path.charAt(0) == separatorChar) {
return properPath = Util.getBytes(path);
}
// Check security by getting user.dir when the path is not absolute
String userdir;
if (internal) {
userdir = AccessController.doPrivileged(new PriviAction<String>(
"user.dir")); //$NON-NLS-1$
} else {
userdir = System.getProperty("user.dir"); //$NON-NLS-1$
}
if (path.length() == 0) {
return properPath = Util.getBytes(userdir);
}
int length = userdir.length();
if (length > 0 && userdir.charAt(length - 1) == separatorChar) {
return properPath = Util.getBytes(userdir + path);
}
return properPath = Util.getBytes(userdir + separator + path);
|
private void | readObject(java.io.ObjectInputStream stream)
stream.defaultReadObject();
char inSeparator = stream.readChar();
path = path.replace(inSeparator, separatorChar);
|
public boolean | renameTo(java.io.File dest)Renames this file to the name represented by the {@code dest} file. This
works for both normal files and directories.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
security.checkWrite(dest.path);
}
return renameToImpl(properPath(true), dest.properPath(true));
|
private native boolean | renameToImpl(byte[] pathExist, byte[] pathNew)
|
private static native byte[][] | rootsImpl()
|
public boolean | setLastModified(long time)Sets the time this file was last modified, measured in milliseconds since
January 1st, 1970, midnight.
if (time < 0) {
throw new IllegalArgumentException(Msg.getString("K006a")); //$NON-NLS-1$
}
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
return (setLastModifiedImpl(properPath(true), time));
|
private native boolean | setLastModifiedImpl(byte[] path, long time)
|
public boolean | setReadOnly()Marks this file or directory to be read-only as defined by the operating
system.
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkWrite(path);
}
return (setReadOnlyImpl(properPath(true)));
|
private native boolean | setReadOnlyImpl(byte[] path)
|
public java.lang.String | toString()Returns a string containing a concise, human-readable description of this
file.
return path;
|
public java.net.URI | toURI()Returns a Uniform Resource Identifier for this file. The URI is system
dependent and may not be transferable between different operating / file
systems.
String name = getAbsoluteName();
try {
if (!name.startsWith("/")) { //$NON-NLS-1$
// start with sep.
return new URI("file", null, //$NON-NLS-1$
new StringBuilder(name.length() + 1).append('/")
.append(name).toString(), null, null);
} else if (name.startsWith("//")) { //$NON-NLS-1$
return new URI("file", name, null); // UNC path //$NON-NLS-1$
}
return new URI("file", null, name, null, null); //$NON-NLS-1$
} catch (URISyntaxException e) {
// this should never happen
return null;
}
|
public java.net.URL | toURL()Returns a Uniform Resource Locator for this file. The URL is system
dependent and may not be transferable between different operating / file
systems.
String name = getAbsoluteName();
if (!name.startsWith("/")) { //$NON-NLS-1$
// start with sep.
return new URL("file", "", -1, new StringBuilder(name.length() + 1) //$NON-NLS-1$ //$NON-NLS-2$
.append('/").append(name).toString(), null);
} else if (name.startsWith("//")) { //$NON-NLS-1$
return new URL("file:" + name); // UNC path //$NON-NLS-1$
}
return new URL("file", "", -1, name, null); //$NON-NLS-1$ //$NON-NLS-2$
|
private void | writeObject(java.io.ObjectOutputStream stream)
stream.defaultWriteObject();
stream.writeChar(separatorChar);
|