java.io
Class Win32FileSystem

java.lang.Object
  extended byjava.io.FileSystem
      extended byjava.io.Win32FileSystem
Direct Known Subclasses:
WinNTFileSystem

class Win32FileSystem
extends FileSystem


Field Summary
private  char altSlash
           
static int BA_DIRECTORY
           
static int BA_EXISTS
           
static int BA_HIDDEN
           
static int BA_REGULAR
           
private  ExpiringCache cache
           
private static String[] driveDirCache
           
private  ExpiringCache prefixCache
           
private  char semicolon
           
private  char slash
           
(package private) static boolean useCanonCaches
           
(package private) static boolean useCanonPrefixCache
           
 
Constructor Summary
Win32FileSystem()
           
 
Method Summary
private  boolean access(String path)
           
 String canonicalize(String path)
           
protected  String canonicalize0(String path)
           
protected  String canonicalizeWithPrefix(String canonicalPrefix, String filename)
           
protected  String canonicalizeWithPrefix0(String canonicalPrefix, String pathWithCanonicalPrefix)
           
 boolean checkAccess(File f, boolean write)
          Check whether the file or directory denoted by the given abstract pathname may be accessed by this process.
 int compare(File f1, File f2)
          Compare two abstract pathnames lexicographically.
 boolean createDirectory(File f)
          Create a new directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.
 boolean createFileExclusively(String path)
          Create a new empty file with the given pathname.
 boolean delete(File f)
          Delete the file or directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.
private  boolean delete0(File f)
           
 boolean deleteOnExit(File f)
          Arrange for the file or directory denoted by the given abstract pathname to be deleted when the VM exits, returning true if and only if the operation succeeds.
private static int driveIndex(char d)
           
 String fromURIPath(String path)
          Post-process the given URI path string if necessary.
 int getBooleanAttributes(File f)
          Return the simple boolean attributes for the file or directory denoted by the given abstract pathname, or zero if it does not exist or some other I/O error occurs.
 String getDefaultParent()
          Return the parent pathname string to be used when the parent-directory argument in one of the two-argument File constructors is the empty pathname.
private  String getDrive(String path)
           
private  String getDriveDirectory(char drive)
           
(package private)  String getDriveDirectory(int drive)
           
static FileSystem getFileSystem()
          Return the FileSystem object representing this platform's local filesystem.
 long getLastModifiedTime(File f)
          Return the time at which the file or directory denoted by the given abstract pathname was last modified, or zero if it does not exist or some other I/O error occurs.
 long getLength(File f)
          Return the length in bytes of the file denoted by the given abstract pathname, or zero if it does not exist, is a directory, or some other I/O error occurs.
 char getPathSeparator()
          Return the local filesystem's path-separator character.
 char getSeparator()
          Return the local filesystem's name-separator character.
private  String getUserPath()
           
 int hashCode(File f)
          Compute the hash code of an abstract pathname.
private static void initIDs()
           
 boolean isAbsolute(File f)
          Tell whether or not the given abstract pathname is absolute.
private  boolean isLetter(char c)
           
private  boolean isSlash(char c)
           
 String[] list(File f)
          List the elements of the directory denoted by the given abstract pathname.
 File[] listRoots()
          List the available filesystem roots.
private static int listRoots0()
           
 String normalize(String path)
          Convert the given pathname string to normal form.
private  String normalize(String path, int len, int off)
           
private  int normalizePrefix(String path, int len, StringBuffer sb)
           
(package private) static String parentOrNull(String path)
           
 int prefixLength(String path)
          Compute the length of this pathname string's prefix.
 boolean rename(File f1, File f2)
          Rename the file or directory denoted by the first abstract pathname to the second abstract pathname, returning true if and only if the operation succeeds.
private  boolean rename0(File f1, File f2)
           
 String resolve(File f)
          Resolve the given abstract pathname into absolute form.
 String resolve(String parent, String child)
          Resolve the child pathname string against the parent.
 boolean setLastModifiedTime(File f, long time)
          Set the last-modified time of the file or directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.
 boolean setReadOnly(File f)
          Mark the file or directory denoted by the given abstract pathname as read-only, returning true if and only if the operation succeeds.
private  String slashify(String p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

slash

private final char slash

altSlash

private final char altSlash

semicolon

private final char semicolon

driveDirCache

private static String[] driveDirCache

cache

private ExpiringCache cache

prefixCache

private ExpiringCache prefixCache

BA_EXISTS

public static final int BA_EXISTS
See Also:
Constant Field Values

BA_REGULAR

public static final int BA_REGULAR
See Also:
Constant Field Values

BA_DIRECTORY

public static final int BA_DIRECTORY
See Also:
Constant Field Values

BA_HIDDEN

public static final int BA_HIDDEN
See Also:
Constant Field Values

useCanonCaches

static boolean useCanonCaches

useCanonPrefixCache

static boolean useCanonPrefixCache
Constructor Detail

Win32FileSystem

public Win32FileSystem()
Method Detail

isSlash

private boolean isSlash(char c)

isLetter

private boolean isLetter(char c)

slashify

private String slashify(String p)

getSeparator

public char getSeparator()
Description copied from class: FileSystem
Return the local filesystem's name-separator character.

Specified by:
getSeparator in class FileSystem

getPathSeparator

public char getPathSeparator()
Description copied from class: FileSystem
Return the local filesystem's path-separator character.

Specified by:
getPathSeparator in class FileSystem

normalizePrefix

private int normalizePrefix(String path,
                            int len,
                            StringBuffer sb)

normalize

private String normalize(String path,
                         int len,
                         int off)

normalize

public String normalize(String path)
Description copied from class: FileSystem
Convert the given pathname string to normal form. If the string is already in normal form then it is simply returned.

Specified by:
normalize in class FileSystem

prefixLength

public int prefixLength(String path)
Description copied from class: FileSystem
Compute the length of this pathname string's prefix. The pathname string must be in normal form.

Specified by:
prefixLength in class FileSystem

resolve

public String resolve(String parent,
                      String child)
Description copied from class: FileSystem
Resolve the child pathname string against the parent. Both strings must be in normal form, and the result will be in normal form.

Specified by:
resolve in class FileSystem

getDefaultParent

public String getDefaultParent()
Description copied from class: FileSystem
Return the parent pathname string to be used when the parent-directory argument in one of the two-argument File constructors is the empty pathname.

Specified by:
getDefaultParent in class FileSystem

fromURIPath

public String fromURIPath(String path)
Description copied from class: FileSystem
Post-process the given URI path string if necessary. This is used on win32, e.g., to transform "/c:/foo" into "c:/foo". The path string still has slash separators; code in the File class will translate them after this method returns.

Specified by:
fromURIPath in class FileSystem

isAbsolute

public boolean isAbsolute(File f)
Description copied from class: FileSystem
Tell whether or not the given abstract pathname is absolute.

Specified by:
isAbsolute in class FileSystem

getDriveDirectory

String getDriveDirectory(int drive)

driveIndex

private static int driveIndex(char d)

getDriveDirectory

private String getDriveDirectory(char drive)

getUserPath

private String getUserPath()

getDrive

private String getDrive(String path)

resolve

public String resolve(File f)
Description copied from class: FileSystem
Resolve the given abstract pathname into absolute form. Invoked by the getAbsolutePath and getCanonicalPath methods in the File class.

Specified by:
resolve in class FileSystem

canonicalize

public String canonicalize(String path)
                    throws IOException
Specified by:
canonicalize in class FileSystem
Throws:
IOException

canonicalize0

protected String canonicalize0(String path)
                        throws IOException
Throws:
IOException

canonicalizeWithPrefix

protected String canonicalizeWithPrefix(String canonicalPrefix,
                                        String filename)
                                 throws IOException
Throws:
IOException

canonicalizeWithPrefix0

protected String canonicalizeWithPrefix0(String canonicalPrefix,
                                         String pathWithCanonicalPrefix)
                                  throws IOException
Throws:
IOException

parentOrNull

static String parentOrNull(String path)

getBooleanAttributes

public int getBooleanAttributes(File f)
Description copied from class: FileSystem
Return the simple boolean attributes for the file or directory denoted by the given abstract pathname, or zero if it does not exist or some other I/O error occurs.

Specified by:
getBooleanAttributes in class FileSystem

checkAccess

public boolean checkAccess(File f,
                           boolean write)
Description copied from class: FileSystem
Check whether the file or directory denoted by the given abstract pathname may be accessed by this process. If the second argument is false, then a check for read access is made; if the second argument is true, then a check for write (not read-write) access is made. Return false if access is denied or an I/O error occurs.

Specified by:
checkAccess in class FileSystem

getLastModifiedTime

public long getLastModifiedTime(File f)
Description copied from class: FileSystem
Return the time at which the file or directory denoted by the given abstract pathname was last modified, or zero if it does not exist or some other I/O error occurs.

Specified by:
getLastModifiedTime in class FileSystem

getLength

public long getLength(File f)
Description copied from class: FileSystem
Return the length in bytes of the file denoted by the given abstract pathname, or zero if it does not exist, is a directory, or some other I/O error occurs.

Specified by:
getLength in class FileSystem

createFileExclusively

public boolean createFileExclusively(String path)
                              throws IOException
Description copied from class: FileSystem
Create a new empty file with the given pathname. Return true if the file was created and false if a file or directory with the given pathname already exists. Throw an IOException if an I/O error occurs.

Specified by:
createFileExclusively in class FileSystem
Throws:
IOException

delete

public boolean delete(File f)
Description copied from class: FileSystem
Delete the file or directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.

Specified by:
delete in class FileSystem

delete0

private boolean delete0(File f)

deleteOnExit

public boolean deleteOnExit(File f)
Description copied from class: FileSystem
Arrange for the file or directory denoted by the given abstract pathname to be deleted when the VM exits, returning true if and only if the operation succeeds.

Specified by:
deleteOnExit in class FileSystem

list

public String[] list(File f)
Description copied from class: FileSystem
List the elements of the directory denoted by the given abstract pathname. Return an array of strings naming the elements of the directory if successful; otherwise, return null.

Specified by:
list in class FileSystem

createDirectory

public boolean createDirectory(File f)
Description copied from class: FileSystem
Create a new directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.

Specified by:
createDirectory in class FileSystem

rename

public boolean rename(File f1,
                      File f2)
Description copied from class: FileSystem
Rename the file or directory denoted by the first abstract pathname to the second abstract pathname, returning true if and only if the operation succeeds.

Specified by:
rename in class FileSystem

rename0

private boolean rename0(File f1,
                        File f2)

setLastModifiedTime

public boolean setLastModifiedTime(File f,
                                   long time)
Description copied from class: FileSystem
Set the last-modified time of the file or directory denoted by the given abstract pathname, returning true if and only if the operation succeeds.

Specified by:
setLastModifiedTime in class FileSystem

setReadOnly

public boolean setReadOnly(File f)
Description copied from class: FileSystem
Mark the file or directory denoted by the given abstract pathname as read-only, returning true if and only if the operation succeeds.

Specified by:
setReadOnly in class FileSystem

access

private boolean access(String path)

listRoots0

private static int listRoots0()

listRoots

public File[] listRoots()
Description copied from class: FileSystem
List the available filesystem roots.

Specified by:
listRoots in class FileSystem

compare

public int compare(File f1,
                   File f2)
Description copied from class: FileSystem
Compare two abstract pathnames lexicographically.

Specified by:
compare in class FileSystem

hashCode

public int hashCode(File f)
Description copied from class: FileSystem
Compute the hash code of an abstract pathname.

Specified by:
hashCode in class FileSystem

initIDs

private static void initIDs()

getFileSystem

public static FileSystem getFileSystem()
Return the FileSystem object representing this platform's local filesystem.