public abstract class LightVirtualFileBase extends VirtualFile
VirtualFile
.VirtualFile.PropName
EMPTY_ARRAY, PROP_ENCODING, PROP_HIDDEN, PROP_NAME, PROP_SYMLINK_TARGET, PROP_WRITABLE
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
LightVirtualFileBase(java.lang.String name,
FileType fileType,
long modificationStamp) |
Modifier and Type | Method and Description |
---|---|
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.
|
FileType |
getAssignedFileType() |
VirtualFile[] |
getChildren()
Gets the child files.
|
VirtualFileSystem |
getFileSystem()
Gets the
VirtualFileSystem this file belongs to. |
long |
getLength()
File length in bytes.
|
long |
getModificationStamp()
Gets modification stamp value.
|
java.lang.String |
getName()
Gets the name of this file.
|
VirtualFile |
getOriginalFile() |
VirtualFile |
getParent()
Gets the parent
VirtualFile . |
java.lang.String |
getPath()
Gets the path of this file.
|
long |
getTimeStamp()
Gets the timestamp for this file.
|
boolean |
isDirectory()
Checks whether this file is a directory.
|
boolean |
isValid()
Checks whether this
VirtualFile is valid. |
boolean |
isWritable()
Checks whether this file could be modified.
|
void |
move(java.lang.Object requestor,
VirtualFile newParent)
Moves this file to another directory.
|
void |
refresh(boolean asynchronous,
boolean recursive,
java.lang.Runnable postRunnable)
The same as
VirtualFile.refresh(boolean, boolean) but also runs postRunnable
after the operation is completed. |
void |
rename(java.lang.Object requestor,
java.lang.String newName)
Renames this file to the
newName . |
void |
setBinaryContent(byte [] content,
long newModificationStamp,
long newTimeStamp) |
void |
setBinaryContent(byte [] content,
long newModificationStamp,
long newTimeStamp,
java.lang.Object requestor) |
void |
setFileType(FileType fileType) |
protected void |
setModificationStamp(long stamp) |
void |
setOriginalFile(VirtualFile originalFile) |
void |
setValid(boolean valid) |
void |
setWritable(boolean writable) |
contentsToByteArray, contentsToByteArray, copy, exists, findChild, findFileByRelativePath, findOrCreateChildData, getBOM, getCanonicalFile, getCanonicalPath, getCharset, getDetectedLineSeparator, getExtension, getFileType, getInputStream, getModificationCount, getNameSequence, getNameWithoutExtension, getOutputStream, getOutputStream, getPresentableName, getPresentableUrl, getUrl, is, isCharsetSet, isInLocalFileSystem, isRecursiveOrCircularSymLink, isValidName, nameEquals, refresh, setBinaryContent, setBOM, setCharset, setCharset, setCharset, setDetectedLineSeparator, setPreloadedContentHint, storeCharset, toString
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
public LightVirtualFileBase(java.lang.String name, FileType fileType, long modificationStamp)
public void setFileType(FileType fileType)
public VirtualFile getOriginalFile()
public void setOriginalFile(VirtualFile originalFile)
public VirtualFileSystem getFileSystem()
VirtualFile
VirtualFileSystem
this file belongs to.getFileSystem
in class VirtualFile
VirtualFileSystem
public FileType getAssignedFileType()
public java.lang.String getPath()
VirtualFile
VirtualFileSystem
. 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 VirtualFile
public java.lang.String getName()
VirtualFile
getName
in class VirtualFile
VirtualFile.getNameSequence()
public boolean isWritable()
VirtualFile
isWritable
in class VirtualFile
true
if this file is writable, false
otherwisepublic boolean isDirectory()
VirtualFile
isDirectory
in class VirtualFile
true
if this file is a directory, false
otherwisepublic boolean isValid()
VirtualFile
VirtualFile
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 VirtualFile
true
if this is a valid file, false
otherwisepublic void setValid(boolean valid)
public VirtualFile getParent()
VirtualFile
VirtualFile
.getParent
in class VirtualFile
null
if this file is a root directorypublic VirtualFile[] getChildren()
VirtualFile
getChildren
in class VirtualFile
null
if this file is not a directorypublic long getModificationStamp()
VirtualFile
getModificationStamp
in class VirtualFile
VirtualFile.getTimeStamp()
protected void setModificationStamp(long stamp)
public long getTimeStamp()
VirtualFile
getTimeStamp
in class VirtualFile
File.lastModified()
public long getLength()
VirtualFile
getLength
in class VirtualFile
public void refresh(boolean asynchronous, boolean recursive, java.lang.Runnable postRunnable)
VirtualFile
VirtualFile.refresh(boolean, boolean)
but also runs postRunnable
after the operation is completed. The runnable is executed on event dispatch thread inside write action.refresh
in class VirtualFile
public void setWritable(boolean writable)
setWritable
in class VirtualFile
public void rename(java.lang.Object requestor, java.lang.String newName) throws java.io.IOException
VirtualFile
Renames this file to the newName
.
This method should only be called within write action
.
rename
in class VirtualFile
requestor
- 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 createChildDirectory(java.lang.Object requestor, java.lang.String name) throws java.io.IOException
VirtualFile
Application.runWriteAction(java.lang.Runnable)
.createChildDirectory
in class VirtualFile
requestor
- 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 VirtualFile createChildData(java.lang.Object requestor, java.lang.String name) throws java.io.IOException
VirtualFile
Application.runWriteAction(java.lang.Runnable)
.createChildData
in class VirtualFile
requestor
- 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 void delete(java.lang.Object requestor) throws java.io.IOException
VirtualFile
Application.runWriteAction(java.lang.Runnable)
.delete
in class VirtualFile
requestor
- 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 move(java.lang.Object requestor, VirtualFile newParent) throws java.io.IOException
VirtualFile
Application.runWriteAction(java.lang.Runnable)
.move
in class VirtualFile
requestor
- 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 void setBinaryContent(byte [] content, long newModificationStamp, long newTimeStamp) throws java.io.IOException
setBinaryContent
in class VirtualFile
java.io.IOException
public void setBinaryContent(byte [] content, long newModificationStamp, long newTimeStamp, java.lang.Object requestor) throws java.io.IOException
setBinaryContent
in class VirtualFile
java.io.IOException