public class FilePath extends FilesystemPath
Path.FileChannelFactory
Modifier and Type | Field and Description |
---|---|
protected boolean |
_isWindows |
_bindRoot, _pathname, _root, _userPath
_pathSeparatorChar, _schemeMap, _separatorChar, L
Modifier | Constructor and Description |
---|---|
protected |
FilePath(FilesystemPath root,
java.lang.String userPath,
java.lang.String path) |
|
FilePath(java.lang.String path) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Tests if the file can be read.
|
boolean |
canWrite()
Tests if the file can be written.
|
Path |
copy() |
boolean |
equals(java.lang.Object b) |
boolean |
exists()
Tests if the file exists.
|
Path.FileChannelFactory |
fileChannelFactory() |
Path |
fsWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String path)
Lookup the actual path relative to the filesystem root.
|
long |
getDiskSpaceFree() |
long |
getDiskSpaceTotal() |
java.io.File |
getFile()
Lazily returns the native File object.
|
long |
getLastModified()
Returns the last modified time of the file.
|
long |
getLength()
Returns the length of the file in bytes.
|
int |
getMode()
Returns equivalent of struct stat.st_mode if appropriate.
|
java.lang.String |
getNativePath()
Returns the native path.
|
static java.lang.String |
getPwd()
Gets the system's user dir (pwd) and convert it to the Resin format.
|
java.lang.String |
getScheme()
Returns the url scheme
|
java.lang.String |
getURL()
Returns the full url for the given path.
|
int |
hashCode() |
protected static java.lang.String |
initialPath(java.lang.String path) |
protected boolean |
isAux()
Special case for the evil windows special
|
boolean |
isDirectory()
Tests if the path refers to a directory.
|
boolean |
isFile()
Tests if the path refers to a file.
|
boolean |
isLink()
Tests if the path refers to a symbolic link.
|
protected boolean |
isPathCacheable()
Returns true if the path itself is cacheable
|
java.lang.String[] |
list()
Returns a list of files in the directory.
|
boolean |
mkdir()
Creates the directory named by this path.
|
boolean |
mkdirs()
Creates the directory named by this path and any parent directories.
|
StreamImpl |
openAppendImpl() |
RandomAccessStream |
openFileRandomAccess()
Returns the stream implementation for a random-access stream.
|
RandomAccessStream |
openMemoryMappedFile(long fileSize)
Opens a random-access stream.
|
StreamImpl |
openReadImpl()
Returns the stream implementation for a read stream.
|
StreamImpl |
openReadWriteImpl() |
StreamImpl |
openWriteImpl() |
boolean |
remove()
Removes the file or directory named by this path.
|
boolean |
renameTo(Path path)
Renames the file or directory to the name given by the path.
|
Path |
schemeWalk(java.lang.String userPath,
java.util.Map<java.lang.String,java.lang.Object> attributes,
java.lang.String filePath,
int offset)
Lookup the path, handling windows weirdness
|
void |
setLastModified(long time) |
boolean |
truncate(long length)
Sets the length of the file.
|
bind, createRoot, getFullPath, getParent, getPath, getRoot, getTail, getUserPath, init, normalizePath, normalizePath, setUserPath
cacheCopy, canExecute, changeGroup, changeGroup, changeOwner, changeOwner, chmod, clearStatusCache, compareTo, createDepend, createLink, createNewFile, createRoot, createTempFile, escapeURL, getAttribute, getAttributeNames, getBlockCount, getBlockSize, getCache, getCertificates, getContentType, getCrc64, getCreateTime, getDevice, getDeviceId, getFileSeparatorChar, getGroup, getHost, getInode, getLastAccessTime, getLastStatusChangeTime, getNewlineString, getNumberOfLinks, getObject, getOwner, getPathSeparatorChar, getPort, getQuery, getRelativePath, getResources, getResources, getSchemeMap, getSeparatorChar, getUser, getUserDir, getValue, isBlockDevice, isCharacterDevice, isExecutable, isFIFO, isHardLink, isObject, isSocket, isSymbolicLink, isWindows, isWindowsInsecure, iterator, lookup, lookup, lookup, lookupChild, lookupImpl, lookupNative, lookupNative, lookupRelativeNativePath, openAppend, openRandomAccess, openRead, openReadWrite, openReadWrite, openReadWrite, openWrite, putCache, readLink, realPath, removeAll, renameTo, scanScheme, sendfile, setDefaultSchemeMap, setExecutable, setObject, setTestWindows, setValue, toString, truncate, unbind, unwrap, writeToStream, writeToStream
protected FilePath(FilesystemPath root, java.lang.String userPath, java.lang.String path)
path
- canonical pathpublic FilePath(java.lang.String path)
protected static java.lang.String initialPath(java.lang.String path)
public static java.lang.String getPwd()
public long getDiskSpaceFree()
getDiskSpaceFree
in class Path
public long getDiskSpaceTotal()
getDiskSpaceTotal
in class Path
public Path schemeWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String filePath, int offset)
schemeWalk
in class FilesystemPath
userPath
- the user's lookup() pathattributes
- the user's attributesfilePath
- the actual lookup() pathoffset
- offset into filePathpublic Path fsWalk(java.lang.String userPath, java.util.Map<java.lang.String,java.lang.Object> attributes, java.lang.String path)
fsWalk
in class FilesystemPath
userPath
- the user's path to lookup()attributes
- the user's attributes to lookup()path
- the normalized pathprotected boolean isPathCacheable()
isPathCacheable
in class Path
public java.lang.String getScheme()
Path
public java.lang.String getURL()
public java.lang.String getNativePath()
getNativePath
in class Path
public boolean exists()
Path
public int getMode()
Path
public boolean isDirectory()
Path
isDirectory
in class Path
public boolean isFile()
Path
public boolean isLink()
Path
public long getLength()
Path
public long getLastModified()
Path
getLastModified
in class Path
public void setLastModified(long time)
setLastModified
in class Path
public boolean canRead()
Path
public boolean canWrite()
Path
public java.lang.String[] list() throws java.io.IOException
public boolean mkdir() throws java.io.IOException
Path
public boolean mkdirs() throws java.io.IOException
Path
public boolean remove()
Path
public boolean truncate(long length) throws java.io.IOException
Path
public boolean renameTo(Path path)
Path
public StreamImpl openReadImpl() throws java.io.IOException
openReadImpl
in class Path
java.io.IOException
public StreamImpl openWriteImpl() throws java.io.IOException
openWriteImpl
in class Path
java.io.IOException
public StreamImpl openAppendImpl() throws java.io.IOException
openAppendImpl
in class Path
java.io.IOException
public StreamImpl openReadWriteImpl() throws java.io.IOException
openReadWriteImpl
in class Path
java.io.IOException
public RandomAccessStream openFileRandomAccess() throws java.io.IOException
openFileRandomAccess
in class Path
java.io.IOException
public RandomAccessStream openMemoryMappedFile(long fileSize) throws java.io.IOException
Path
openMemoryMappedFile
in class Path
java.io.IOException
public Path.FileChannelFactory fileChannelFactory()
fileChannelFactory
in class Path
public int hashCode()
hashCode
in class FilesystemPath
public boolean equals(java.lang.Object b)
equals
in class FilesystemPath
public java.io.File getFile()
protected boolean isAux()