public abstract class LocalFileSystemBase extends LocalFileSystem
LocalFileSystem.WatchRequest| Modifier and Type | Field and Description |
|---|---|
protected static Logger |
LOG |
PROTOCOL, PROTOCOL_PREFIXDEFAULT_LENGTH, DEFAULT_TIMESTAMP| Constructor and Description |
|---|
LocalFileSystemBase() |
| Modifier and Type | Method and Description |
|---|---|
byte [] |
contentsToByteArray(VirtualFile file) |
VirtualFile |
copyFile(java.lang.Object requestor,
VirtualFile file,
VirtualFile newParent,
java.lang.String copyName)
Implementation of copying files in this file system
|
VirtualFile |
createChildDirectory(java.lang.Object requestor,
VirtualFile parent,
java.lang.String dir)
Implementation of adding directories in this file system
|
VirtualFile |
createChildFile(java.lang.Object requestor,
VirtualFile parent,
java.lang.String file)
Implementation of adding files in this file system
|
void |
deleteFile(java.lang.Object requestor,
VirtualFile file)
Implementation of deleting files in this file system
|
boolean |
exists(VirtualFile 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 |
findFileByIoFile(java.io.File file) |
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).
|
java.lang.String |
getCanonicallyCasedName(VirtualFile file) |
java.io.InputStream |
getInputStream(VirtualFile file)
Does NOT strip the BOM from the beginning of the stream, unlike the
VirtualFile.getInputStream() |
long |
getLength(VirtualFile file) |
java.io.OutputStream |
getOutputStream(VirtualFile file,
java.lang.Object requestor,
long modStamp,
long timeStamp)
Does NOT add the BOM to the beginning of the stream, unlike the
VirtualFile.getOutputStream(Object) |
java.lang.String |
getProtocol()
Gets the protocol for this file system.
|
int |
getRank() |
long |
getTimeStamp(VirtualFile file) |
boolean |
hasChildren(VirtualFile file)
Returns
true if path represents a directory with at least one child. |
boolean |
isCaseSensitive() |
boolean |
isDirectory(VirtualFile file) |
boolean |
isReadOnly() |
boolean |
isSymLink(VirtualFile file) |
boolean |
isValidName(java.lang.String name) |
boolean |
isWritable(VirtualFile file) |
java.lang.String [] |
list(VirtualFile file) |
boolean |
markNewFilesAsDirty() |
void |
moveFile(java.lang.Object requestor,
VirtualFile file,
VirtualFile newParent)
Implementation of moving files in this file system
|
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 |
refreshAndFindFileByIoFile(java.io.File file) |
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. |
void |
refreshFiles(java.lang.Iterable<? extends VirtualFile> files)
Performs a non-recursive synchronous refresh of specified files.
|
void |
refreshFiles(java.lang.Iterable<? extends VirtualFile> files,
boolean async,
boolean recursive,
java.lang.Runnable onFinish) |
void |
refreshIoFiles(java.lang.Iterable<? extends java.io.File> files)
Performs a non-recursive synchronous refresh of specified files.
|
void |
refreshIoFiles(java.lang.Iterable<? extends java.io.File> files,
boolean async,
boolean recursive,
java.lang.Runnable onFinish)
Performs the refresh of the specified files based on filesystem events that have already been received.
|
void |
registerAuxiliaryFileOperationsHandler(LocalFileOperationsHandler handler)
Registers a handler that allows a version control system plugin to intercept file operations in the local file system
and to perform them through the VCS tool.
|
void |
renameFile(java.lang.Object requestor,
VirtualFile file,
java.lang.String newName)
Implementation of renaming files in this file system
|
java.lang.String |
resolveSymLink(VirtualFile file) |
void |
setTimeStamp(VirtualFile file,
long timeStamp) |
void |
setWritable(VirtualFile file,
boolean writableFlag) |
void |
unregisterAuxiliaryFileOperationsHandler(LocalFileOperationsHandler handler)
Unregisters a handler that allows a version control system plugin to intercept file operations in the local file system
and to perform them through the VCS tool.
|
addRootsToWatch, addRootToWatch, getInstance, removeWatchedRoot, removeWatchedRoots, replaceWatchedRoot, replaceWatchedRootsaddVirtualFileListener, refreshWithoutFileWatcher, removeVirtualFileListenerextractPresentableUrlprotected static final Logger LOG
public VirtualFile findFileByPath(java.lang.String path)
VirtualFileSystemVirtualFileSystem. 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 VirtualFileSystempath - the path to find file bynull otherwisepublic VirtualFile findFileByPathIfCached(java.lang.String path)
findFileByPathIfCached in class NewVirtualFileSystempublic VirtualFile refreshAndFindFileByPath(java.lang.String path)
VirtualFileSystemVirtualFile
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 VirtualFileSystempath - the pathVirtualFile if the file was found, null otherwisepublic VirtualFile findFileByIoFile(java.io.File file)
findFileByIoFile in class LocalFileSystempublic boolean exists(VirtualFile file)
public long getLength(VirtualFile file)
public long getTimeStamp(VirtualFile file)
public boolean isDirectory(VirtualFile file)
public boolean isWritable(VirtualFile file)
public boolean isSymLink(VirtualFile file)
isSymLink in interface FileSystemInterfaceisSymLink in class NewVirtualFileSystempublic java.lang.String resolveSymLink(VirtualFile file)
resolveSymLink in interface FileSystemInterfaceresolveSymLink in class NewVirtualFileSystempublic java.lang.String [] list(VirtualFile file)
public java.lang.String getProtocol()
VirtualFileSystemKeyedLazyInstanceEP.key.getProtocol in class VirtualFileSystemVirtualFile.getUrl(),
VirtualFileManager.getFileSystem(java.lang.String)public boolean isReadOnly()
isReadOnly in class NewVirtualFileSystemprotected java.lang.String normalize(java.lang.String path)
NewVirtualFileSystemImplementations 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 NewVirtualFileSystemnull when a path is invalid for this FS.public VirtualFile refreshAndFindFileByIoFile(java.io.File file)
refreshAndFindFileByIoFile in class LocalFileSystempublic void refreshIoFiles(java.lang.Iterable<? extends java.io.File> files)
LocalFileSystemrefreshIoFiles in class LocalFileSystemfiles - files to refresh.LocalFileSystem.refreshIoFiles(Iterable, boolean, boolean, Runnable)public void refreshIoFiles(java.lang.Iterable<? extends java.io.File> files,
boolean async,
boolean recursive,
java.lang.Runnable onFinish)
LocalFileSystemVfsUtil.markDirtyAndRefresh(boolean, boolean, boolean, File...) instead.refreshIoFiles in class LocalFileSystempublic void refreshFiles(java.lang.Iterable<? extends VirtualFile> files)
LocalFileSystemrefreshFiles in class LocalFileSystemfiles - files to refresh.public void refreshFiles(java.lang.Iterable<? extends VirtualFile> files, boolean async, boolean recursive, java.lang.Runnable onFinish)
refreshFiles in class LocalFileSystempublic void registerAuxiliaryFileOperationsHandler(LocalFileOperationsHandler handler)
LocalFileSystemregisterAuxiliaryFileOperationsHandler in class LocalFileSystemhandler - the handler instance.public void unregisterAuxiliaryFileOperationsHandler(LocalFileOperationsHandler handler)
LocalFileSystemunregisterAuxiliaryFileOperationsHandler in class LocalFileSystemhandler - the handler instance.public VirtualFile createChildDirectory(java.lang.Object requestor, VirtualFile parent, java.lang.String dir) throws java.io.IOException
VirtualFileSystemcreateChildDirectory in interface FileSystemInterfacecreateChildDirectory in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.createChildDirectory(Object,String)public VirtualFile createChildFile(java.lang.Object requestor, VirtualFile parent, java.lang.String file) throws java.io.IOException
VirtualFileSystemcreateChildFile in interface FileSystemInterfacecreateChildFile in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.createChildData(Object,String)public void deleteFile(java.lang.Object requestor,
VirtualFile file)
throws java.io.IOException
VirtualFileSystemdeleteFile in interface FileSystemInterfacedeleteFile in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.delete(Object)public boolean isCaseSensitive()
isCaseSensitive in class VirtualFileSystempublic boolean isValidName(java.lang.String name)
isValidName in class VirtualFileSystempublic java.io.InputStream getInputStream(VirtualFile file) throws java.io.IOException
FileSystemInterfaceVirtualFile.getInputStream()java.io.IOExceptionpublic byte [] contentsToByteArray(VirtualFile file) throws java.io.IOException
java.io.IOExceptionpublic java.io.OutputStream getOutputStream(VirtualFile file, java.lang.Object requestor, long modStamp, long timeStamp) throws java.io.IOException
FileSystemInterfaceVirtualFile.getOutputStream(Object)java.io.IOExceptionpublic void moveFile(java.lang.Object requestor,
VirtualFile file,
VirtualFile newParent)
throws java.io.IOException
VirtualFileSystemmoveFile in interface FileSystemInterfacemoveFile in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.move(Object,VirtualFile)public void renameFile(java.lang.Object requestor,
VirtualFile file,
java.lang.String newName)
throws java.io.IOException
VirtualFileSystemrenameFile in interface FileSystemInterfacerenameFile in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.rename(Object,String)public VirtualFile copyFile(java.lang.Object requestor, VirtualFile file, VirtualFile newParent, java.lang.String copyName) throws java.io.IOException
VirtualFileSystemcopyFile in interface FileSystemInterfacecopyFile in class NewVirtualFileSystemjava.io.IOExceptionVirtualFile.copy(Object,VirtualFile,String)public void setTimeStamp(VirtualFile file, long timeStamp)
public void setWritable(VirtualFile file, boolean writableFlag) throws java.io.IOException
java.io.IOExceptionprotected java.lang.String extractRootPath(java.lang.String normalizedPath)
NewVirtualFileSystemNewVirtualFileSystem.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 NewVirtualFileSystempublic int getRank()
getRank in class NewVirtualFileSystempublic boolean markNewFilesAsDirty()
markNewFilesAsDirty in class NewVirtualFileSystempublic java.lang.String getCanonicallyCasedName(VirtualFile file)
getCanonicallyCasedName in class NewVirtualFileSystempublic FileAttributes getAttributes(VirtualFile file)
NewVirtualFileSystemgetAttributes in class NewVirtualFileSystemfile - file to get attributes of.null if the file doesn't exist.public void refresh(boolean asynchronous)
VirtualFileSystemIf
asynchronous is false this method should be only called within write-action.
See Application.runWriteAction(java.lang.Runnable).refresh in class VirtualFileSystemasynchronous - 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)public boolean hasChildren(VirtualFile file)
NewVirtualFileSystemtrue if path represents a directory with at least one child.
Override if your file system can answer this question more efficiently (e.g. without enumerating all children).hasChildren in class NewVirtualFileSystem