public class JrtFileSystemImpl extends JrtFileSystem
PROTOCOL, PROTOCOL_PREFIX, SEPARATOR
DEFAULT_LENGTH, DEFAULT_TIMESTAMP
Constructor and Description |
---|
JrtFileSystemImpl() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
composeRootPath(java.lang.String localPath)
A reverse to
ArchiveFileSystem.extractLocalPath(String) - i.e. |
protected java.lang.String |
extractLocalPath(java.lang.String rootPath)
Strips any separator chars from a root (obtained via
VfsUtilCore.getRootFile(com.intellij.openapi.vfs.VirtualFile) path to obtain a path to a local file. |
protected java.lang.String |
extractRootPath(java.lang.String normalizedPath)
IntelliJ platform calls this method with non-null value returned by
NewVirtualFileSystem.normalize(java.lang.String) , but if something went wrong
and an implementation can't extract a valid root path nevertheless, it should return an empty string. |
VirtualFile |
findFileByPath(java.lang.String path)
Searches for the file specified by given path.
|
VirtualFile |
findFileByPathIfCached(java.lang.String path) |
FileAttributes |
getAttributes(VirtualFile file)
Reads various file attributes in one shot (to reduce the number of native I/O calls).
|
protected ArchiveHandler |
getHandler(VirtualFile entryFile) |
java.lang.String |
getProtocol()
Gets the protocol for this file system.
|
protected boolean |
isCorrectFileType(VirtualFile local)
Implementations should return
false if the given file may not host this file system. |
java.lang.String [] |
list(VirtualFile file) |
protected java.lang.String |
normalize(java.lang.String path)
Implementations should convert separator chars to forward slashes and remove duplicates ones,
and convert paths to "absolute" form (so that they start from a root that is valid for this FS and
could be later extracted with
NewVirtualFileSystem.extractRootPath(java.lang.String) ). |
void |
refresh(boolean asynchronous)
Refreshes the cached information for all files in this file system from the physical file system.
|
VirtualFile |
refreshAndFindFileByPath(java.lang.String path)
Refreshes only the part of the file system needed for searching the file by the given path and finds file
by the given path.
This method is useful when the file was created externally and you need to find
corresponding to it. |
isModuleRoot, isRoot
contentsToByteArray, copyFile, createChildDirectory, createChildFile, deleteFile, exists, findLocalByRootPath, getInputStream, getLength, getLocalByEntry, getOutputStream, getRank, getRelativePath, getRootByEntry, getRootByLocal, getRootPathByLocal, getTimeStamp, isDirectory, isWritable, moveFile, renameFile, setTimeStamp, setWritable
addVirtualFileListener, getCanonicallyCasedName, hasChildren, isReadOnly, isSymLink, markNewFilesAsDirty, refreshWithoutFileWatcher, removeVirtualFileListener, resolveSymLink
extractPresentableUrl, isCaseSensitive, isValidName
public FileAttributes getAttributes(VirtualFile file)
NewVirtualFileSystem
getAttributes
in class ArchiveFileSystem
file
- file to get attributes of.null
if the file doesn't exist.public java.lang.String [] list(VirtualFile file)
list
in interface FileSystemInterface
list
in class ArchiveFileSystem
public java.lang.String getProtocol()
VirtualFileSystem
KeyedLazyInstanceEP.key
.getProtocol
in class VirtualFileSystem
VirtualFile.getUrl()
,
VirtualFileManager.getFileSystem(java.lang.String)
protected java.lang.String normalize(java.lang.String path)
NewVirtualFileSystem
Implementations should convert separator chars to forward slashes and remove duplicates ones,
and convert paths to "absolute" form (so that they start from a root that is valid for this FS and
could be later extracted with NewVirtualFileSystem.extractRootPath(java.lang.String)
).
Implementations should not normalize paths by eliminating directory traversals or other indirections.
normalize
in class NewVirtualFileSystem
null
when a path is invalid for this FS.protected java.lang.String extractLocalPath(java.lang.String rootPath)
ArchiveFileSystem
VfsUtilCore.getRootFile(com.intellij.openapi.vfs.VirtualFile)
path to obtain a path to a local file.extractLocalPath
in class ArchiveFileSystem
protected java.lang.String composeRootPath(java.lang.String localPath)
ArchiveFileSystem
ArchiveFileSystem.extractLocalPath(String)
- i.e. dresses a local file path to make it a suitable root path for this filesystem.
E.g. "/x/y.jar" -> "/x/y.jar!/"composeRootPath
in class ArchiveFileSystem
protected java.lang.String extractRootPath(java.lang.String normalizedPath)
NewVirtualFileSystem
NewVirtualFileSystem.normalize(java.lang.String)
, but if something went wrong
and an implementation can't extract a valid root path nevertheless, it should return an empty string.extractRootPath
in class NewVirtualFileSystem
protected ArchiveHandler getHandler(VirtualFile entryFile)
getHandler
in class ArchiveFileSystem
public VirtualFile findFileByPath(java.lang.String path)
VirtualFileSystem
VirtualFileSystem
. Format of the path depends on the concrete file system.
For LocalFileSystem
it is an absolute path (both Unix- and Windows-style separator chars are allowed).findFileByPath
in class VirtualFileSystem
path
- the path to find file bynull
otherwisepublic VirtualFile findFileByPathIfCached(java.lang.String path)
findFileByPathIfCached
in class NewVirtualFileSystem
public VirtualFile refreshAndFindFileByPath(java.lang.String path)
VirtualFileSystem
VirtualFile
corresponding to it.If this method is invoked not from Swing event dispatch thread, then it must not happen inside a read action. The reason is that then the method call won't return until proper VFS events are fired, which happens on Swing thread and in write action. So invoking this method in a read action would result in a deadlock.
refreshAndFindFileByPath
in class VirtualFileSystem
path
- the pathVirtualFile
if the file was found, null
otherwisepublic void refresh(boolean asynchronous)
VirtualFileSystem
If
asynchronous
is false
this method should be only called within write-action.
See Application.runWriteAction(java.lang.Runnable)
.refresh
in class VirtualFileSystem
asynchronous
- if true
then the operation will be performed in a separate thread,
otherwise will be performed immediatelyVirtualFile.refresh(boolean, boolean)
,
VirtualFileManager.syncRefresh()
,
VirtualFileManager.asyncRefresh(java.lang.Runnable)
protected boolean isCorrectFileType(VirtualFile local)
ArchiveFileSystem
false
if the given file may not host this file system.isCorrectFileType
in class ArchiveFileSystem