org.mockftpserver.fake.filesystem
Class UnixFakeFileSystem

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

public class UnixFakeFileSystem
extends AbstractFakeFileSystem

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

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

Version:
$Revision: 233 $ - $Date: 2009-06-13 20:31:02 -0400 (Sat, 13 Jun 2009) $
Author:
Chris Mair

Field Summary
static char SEPARATOR
           
 
Constructor Summary
UnixFakeFileSystem()
          Construct a new instance and initialize the directoryListingFormatter to a UnixDirectoryListingFormatter.
 
Method Summary
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, getFileSystemEntryKey, 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

UnixFakeFileSystem

public UnixFakeFileSystem()
Construct a new instance and initialize the directoryListingFormatter to a UnixDirectoryListingFormatter.

Method Detail

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 Unix, a path is valid if it starts with the '/' character, followed by zero or more names (a sequence of any characters except '/'), delimited by '/'. The path may optionally contain a terminating '/'.

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.