org.mockftpserver.fake.filesystem
Class WindowsFakeFileSystem

java.lang.Object
  extended by org.mockftpserver.fake.filesystem.AbstractFakeFileSystem
      extended by org.mockftpserver.fake.filesystem.WindowsFakeFileSystem
All Implemented Interfaces:
FileSystem

public class WindowsFakeFileSystem
extends AbstractFakeFileSystem

Implementation of the FileSystem interface that simulates a Microsoft Windows file system. The rules for file and directory names include:

The directoryListingFormatter property is automatically initialized to an instance of WindowsDirectoryListingFormatter.

Version:
$Revision: 182 $ - $Date: 2008-11-30 21:37:49 -0500 (Sun, 30 Nov 2008) $
Author:
Chris Mair

Field Summary
static char SEPARATOR
           
 
Constructor Summary
WindowsFakeFileSystem()
          Construct a new instance and initialize the directoryListingFormatter to a WindowsDirectoryListingFormatter.
 
Method Summary
protected  String getFileSystemEntryKey(String path)
          Return the normalized and unique key used to access the file system entry.
protected  char getSeparatorChar()
           
protected  boolean isRoot(String pathComponent)
           
protected  boolean isSeparator(char c)
          Return true if the specified char is a separator character ('\' or '/')
protected  boolean isValidName(String path)
          Return true if the specified path designates a valid (absolute) file path.
 
Methods inherited from class org.mockftpserver.fake.filesystem.AbstractFakeFileSystem
add, checkForInvalidFilename, componentsToPath, delete, exists, formatDirectoryListing, getDirectoryListingFormatter, getEntry, getName, getParent, getRequiredEntry, getSeparator, isAbsolute, isCreateParentDirectoriesAutomatically, isDirectory, isFile, listFiles, listNames, normalize, normalizedComponents, path, rename, renamePath, setCreateParentDirectoriesAutomatically, setDirectoryListingFormatter, setEntries, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final char SEPARATOR
See Also:
Constant Field Values
Constructor Detail

WindowsFakeFileSystem

public WindowsFakeFileSystem()
Construct a new instance and initialize the directoryListingFormatter to a WindowsDirectoryListingFormatter.

Method Detail

getFileSystemEntryKey

protected String getFileSystemEntryKey(String path)
Return the normalized and unique key used to access the file system entry. Windows is case-insensitive, so normalize all paths to lower-case.

Overrides:
getFileSystemEntryKey in class AbstractFakeFileSystem
Parameters:
path - - the path
Returns:
the corresponding normalized key

getSeparatorChar

protected char getSeparatorChar()
Specified by:
getSeparatorChar in class AbstractFakeFileSystem
Returns:
the file system-specific file separator as a char

isValidName

protected boolean isValidName(String path)
Return true if the specified path designates a valid (absolute) file path. For Windows paths, a path is valid if it starts with a drive specifier followed by '\' or '/', or if it starts with "\\".

Specified by:
isValidName in class AbstractFakeFileSystem
Parameters:
path - - the path
Returns:
true if path is valid, false otherwise
Throws:
AssertionError - - if path is null

isSeparator

protected boolean isSeparator(char c)
Return true if the specified char is a separator character ('\' or '/')

Specified by:
isSeparator in class AbstractFakeFileSystem
Parameters:
c - - the character to test
Returns:
true if the specified char is a separator character ('\' or '/')

isRoot

protected boolean isRoot(String pathComponent)
Specified by:
isRoot in class AbstractFakeFileSystem
Parameters:
pathComponent - - the component (piece) of the path to check
Returns:
true if the specified path component is a root for this filesystem


Copyright © 2014. All rights reserved.