public abstract class VirtualFileSystemEntry extends NewVirtualFile
VirtualFile.PropName| Modifier and Type | Field and Description |
|---|---|
static VirtualFileSystemEntry[] |
EMPTY_ARRAY |
PROP_ENCODING, PROP_HIDDEN, PROP_NAME, PROP_SYMLINK_TARGET, PROP_WRITABLEEVER_CHANGED, NEVER_CHANGED| Modifier and Type | Method and Description |
|---|---|
protected char [] |
appendPathOnFileSystem(int accumulatedPathLength,
int[] positionRef) |
VirtualFile |
copy(java.lang.Object requestor,
VirtualFile newParent,
java.lang.String copyName) |
VirtualFile |
createChildData(java.lang.Object requestor,
java.lang.String name)
Creates a new file in this directory.
|
VirtualFile |
createChildDirectory(java.lang.Object requestor,
java.lang.String name)
Creates a subdirectory in this directory.
|
void |
delete(java.lang.Object requestor)
Deletes this file.
|
boolean |
equals(java.lang.Object o) |
boolean |
exists() |
NewVirtualFile |
getCanonicalFile()
Resolves all symbolic links containing in a path to this file and returns a link target.
|
java.lang.String |
getCanonicalPath()
Resolves all symbolic links containing in a path to this file and returns a path to a link target (in platform-independent format).
|
java.nio.charset.Charset |
getCharset() |
FileType |
getFileType()
Returns the
FileType of this file, or FileTypes.UNKNOWN if a type cannot be determined
(i.e. |
int |
getId() |
long |
getLength()
File length in bytes.
|
long |
getModificationStamp()
Gets modification stamp value.
|
java.lang.String |
getName()
Gets the name of this file.
|
int |
getNameId() |
java.lang.CharSequence |
getNameSequence() |
VirtualDirectoryImpl |
getParent()
Gets the parent
VirtualFile. |
java.lang.String |
getPath()
Gets the path of this file.
|
java.lang.String |
getPresentableName() |
long |
getTimeStamp()
Gets the timestamp for this file.
|
java.lang.String |
getUrl()
Returns the URL of this file.
|
int |
hashCode() |
void |
invalidate() |
boolean |
is(VFileProperty property)
Checks whether this file has a specific property.
|
boolean |
isDirty() |
boolean |
isFileIndexed() |
boolean |
isInLocalFileSystem() |
boolean |
isRecursiveOrCircularSymLink()
Returns
true if this file is a symlink that is either recursive (i.e. |
boolean |
isValid()
Checks whether this
VirtualFile is valid. |
boolean |
isWritable()
Checks whether this file could be modified.
|
void |
markClean() |
void |
markDirty() |
void |
markDirtyRecursively() |
void |
move(java.lang.Object requestor,
VirtualFile newParent)
Moves this file to another directory.
|
void |
rename(java.lang.Object requestor,
java.lang.String newName)
Renames this file to the
newName. |
void |
setFileIndexed(boolean indexed) |
void |
setModificationStamp(long modificationStamp) |
void |
setNewName(java.lang.String newName) |
void |
setParent(VirtualFile newParent) |
void |
setTimeStamp(long time) |
void |
setWritable(boolean writable) |
java.lang.String |
toString() |
void |
updateProperty(java.lang.String property,
boolean value) |
contentsToByteArray, findChild, findChildIfCached, getCachedChildren, getFileSystem, iterInDbChildren, iterInDbChildrenWithoutLoadingVfsFromOtherProjects, refresh, refreshAndFindChildcontentsToByteArray, findFileByRelativePath, findOrCreateChildData, getBOM, getChildren, getDetectedLineSeparator, getExtension, getInputStream, getModificationCount, getNameWithoutExtension, getOutputStream, getOutputStream, getPresentableUrl, isCharsetSet, isDirectory, isValidName, nameEquals, refresh, setBinaryContent, setBinaryContent, setBinaryContent, setBOM, setCharset, setCharset, setCharset, setDetectedLineSeparator, setPreloadedContentHint, storeCharsetchangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMappublic static final VirtualFileSystemEntry[] EMPTY_ARRAY
public java.lang.String getName()
VirtualFilegetName in class VirtualFileVirtualFile.getNameSequence()public java.lang.CharSequence getNameSequence()
getNameSequence in class NewVirtualFilepublic final int getNameId()
public VirtualDirectoryImpl getParent()
VirtualFileVirtualFile.getParent in class NewVirtualFilenull if this file is a root directorypublic boolean isDirty()
isDirty in class NewVirtualFilepublic long getModificationStamp()
VirtualFilegetModificationStamp in class VirtualFileVirtualFile.getTimeStamp()public void setModificationStamp(long modificationStamp)
public boolean isFileIndexed()
public void setFileIndexed(boolean indexed)
public void markClean()
markClean in class NewVirtualFilepublic void markDirty()
markDirty in class NewVirtualFilepublic void markDirtyRecursively()
markDirtyRecursively in class NewVirtualFileprotected char [] appendPathOnFileSystem(int accumulatedPathLength,
int[] positionRef)
public java.lang.String getUrl()
VirtualFileReturns the URL of this file. The URL is a string that uniquely identifies a file in all file systems.
It has the following format: <protocol>://<path>.
File can be found by its URL using VirtualFileManager.findFileByUrl(java.lang.String) method.
Please note these URLs are intended for use withing VFS - meaning they are not necessarily RFC-compliant.
getUrl in class VirtualFileVirtualFileManager.findFileByUrl(java.lang.String),
VirtualFile.getPath(),
VirtualFileSystem.getProtocol()public java.lang.String getPath()
VirtualFileVirtualFileSystem. Format of the path depends on the concrete file system.
For LocalFileSystem it is an absolute file path with file separator characters
(File.separatorChar) replaced to the forward slash ('/').getPath in class VirtualFilepublic void delete(java.lang.Object requestor)
throws java.io.IOException
VirtualFileApplication.runWriteAction(java.lang.Runnable).delete in class VirtualFilerequestor - any object to control who called this method. Note that
it is considered to be an external change if requestor is null.
See VirtualFileEvent.getRequestor()java.io.IOException - if file failed to be deletedpublic void rename(java.lang.Object requestor,
java.lang.String newName)
throws java.io.IOException
VirtualFileRenames this file to the newName.
This method should only be called within write action.
rename in class VirtualFilerequestor - any object to control who called this method. Note that
it is considered to be an external change if requestor is null.
See VirtualFileEvent.getRequestor()newName - the new file namejava.io.IOException - if file failed to be renamedpublic VirtualFile createChildData(java.lang.Object requestor, java.lang.String name) throws java.io.IOException
VirtualFileApplication.runWriteAction(java.lang.Runnable).createChildData in class VirtualFilerequestor - any object to control who called this method. Note that
it is considered to be an external change if requestor is null.
See VirtualFileEvent.getRequestor()VirtualFile representing the created filejava.io.IOException - if file failed to be createdpublic boolean isWritable()
VirtualFileisWritable in class VirtualFiletrue if this file is writable, false otherwisepublic void setWritable(boolean writable)
throws java.io.IOException
setWritable in class NewVirtualFilejava.io.IOExceptionpublic long getTimeStamp()
VirtualFilegetTimeStamp in class VirtualFileFile.lastModified()public void setTimeStamp(long time)
throws java.io.IOException
setTimeStamp in class NewVirtualFilejava.io.IOExceptionpublic long getLength()
VirtualFilegetLength in class VirtualFilepublic VirtualFile copy(java.lang.Object requestor, VirtualFile newParent, java.lang.String copyName) throws java.io.IOException
copy in class VirtualFilejava.io.IOExceptionpublic void move(java.lang.Object requestor,
VirtualFile newParent)
throws java.io.IOException
VirtualFileApplication.runWriteAction(java.lang.Runnable).move in class NewVirtualFilerequestor - any object to control who called this method. Note that
it is considered to be an external change if requestor is null.
See VirtualFileEvent.getRequestor()newParent - the directory to move this file tojava.io.IOException - if file failed to be movedpublic int getId()
getId in interface VirtualFileWithIdgetId in class NewVirtualFilepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic VirtualFile createChildDirectory(java.lang.Object requestor, java.lang.String name) throws java.io.IOException
VirtualFileApplication.runWriteAction(java.lang.Runnable).createChildDirectory in class VirtualFilerequestor - any object to control who called this method. Note that
it is considered to be an external change if requestor is null.
See VirtualFileEvent.getRequestor()name - directory nameVirtualFile representing the created directoryjava.io.IOException - if directory failed to be createdpublic boolean exists()
exists in class VirtualFilepublic boolean isValid()
VirtualFileVirtualFile is valid. File can be invalidated either by deleting it or one of its
parents with VirtualFile.delete(java.lang.Object) method or by an external change.
If file is not valid only Object.equals(java.lang.Object), Object.hashCode(),
VirtualFile.getName(), VirtualFile.getPath(), VirtualFile.getUrl(), VirtualFile.getPresentableUrl() and methods from
UserDataHolder can be called for it. Using any other methods for an invalid VirtualFile instance
produce unpredictable results.isValid in class NewVirtualFiletrue if this is a valid file, false otherwisepublic java.lang.String toString()
toString in class VirtualFilepublic void setNewName(java.lang.String newName)
public void setParent(VirtualFile newParent)
public boolean isInLocalFileSystem()
isInLocalFileSystem in class VirtualFilepublic void invalidate()
public java.nio.charset.Charset getCharset()
getCharset in class VirtualFilepublic java.lang.String getPresentableName()
getPresentableName in class VirtualFilepublic boolean is(VFileProperty property)
VirtualFileis in class VirtualFiletrue if the file has a specific property, false otherwisepublic void updateProperty(java.lang.String property,
boolean value)
public java.lang.String getCanonicalPath()
VirtualFileResolves all symbolic links containing in a path to this file and returns a path to a link target (in platform-independent format).
Note: please use this method judiciously. In most cases VFS clients don't need to resolve links in paths and should work with those provided by a user.
getCanonicalPath in class VirtualFilegetPath() if there are no symbolic links in a file's path;
getCanonicalFile().getPath() if the link was successfully resolved;
null otherwisepublic NewVirtualFile getCanonicalFile()
VirtualFileResolves all symbolic links containing in a path to this file and returns a link target.
Note: please use this method judiciously. In most cases VFS clients don't need to resolve links in paths and should work with those provided by a user.
getCanonicalFile in class NewVirtualFilethis if there are no symbolic links in a file's path;
instance of VirtualFile if the link was successfully resolved;
null otherwisepublic boolean isRecursiveOrCircularSymLink()
VirtualFiletrue if this file is a symlink that is either recursive (i.e. points to this file' parent) or
circular (i.e. its path has a form of "/.../linkX/.../linkX").isRecursiveOrCircularSymLink in class VirtualFilepublic FileType getFileType()
VirtualFileFileType of this file, or FileTypes.UNKNOWN if a type cannot be determined
(i.e. file type is not registered via FileTypeRegistry).
Performance notice: consider using FileTypeRegistry.isFileOfType(com.intellij.openapi.vfs.VirtualFile, com.intellij.openapi.fileTypes.FileType) or FileTypeRegistry.getFileTypeByFileName(java.lang.CharSequence)
if this method is to be called for massive file collections, e.g. in BulkFileListener. See FileTypeRegistry javadoc
for the details.
getFileType in class VirtualFileFileTypeRegistry