public class CoreJarVirtualFile extends VirtualFile
VirtualFile.PropName
EMPTY_ARRAY, PROP_ENCODING, PROP_HIDDEN, PROP_NAME, PROP_SYMLINK_TARGET, PROP_WRITABLE
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
CoreJarVirtualFile(CoreJarHandler handler,
java.lang.CharSequence name,
long length,
long timestamp,
CoreJarVirtualFile parent) |
Modifier and Type | Method and Description |
---|---|
byte [] |
contentsToByteArray()
Returns file content as an array of bytes.
|
VirtualFile[] |
getChildren()
Gets the child files.
|
VirtualFileSystem |
getFileSystem()
Gets the
VirtualFileSystem this file belongs to. |
java.io.InputStream |
getInputStream()
Gets the
InputStream for this file. |
long |
getLength()
File length in bytes.
|
long |
getModificationStamp()
Gets modification stamp value.
|
java.lang.String |
getName()
Gets the name of this file.
|
java.lang.CharSequence |
getNameSequence() |
java.io.OutputStream |
getOutputStream(java.lang.Object requestor,
long newModificationStamp,
long newTimeStamp)
Gets the
OutputStream for this file and sets modification stamp and time stamp to the specified values
after closing the stream. |
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 |
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. |
contentsToByteArray, copy, createChildData, createChildDirectory, delete, exists, findChild, findFileByRelativePath, findOrCreateChildData, getBOM, getCanonicalFile, getCanonicalPath, getCharset, getDetectedLineSeparator, getExtension, getFileType, getModificationCount, getNameWithoutExtension, getOutputStream, getPresentableName, getPresentableUrl, getUrl, is, isCharsetSet, isInLocalFileSystem, isRecursiveOrCircularSymLink, isValidName, move, nameEquals, refresh, rename, setBinaryContent, setBinaryContent, setBinaryContent, setBOM, setCharset, setCharset, setCharset, setDetectedLineSeparator, setPreloadedContentHint, setWritable, storeCharset, toString
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
public CoreJarVirtualFile(CoreJarHandler handler, java.lang.CharSequence name, long length, long timestamp, CoreJarVirtualFile parent)
public java.lang.String getName()
VirtualFile
getName
in class VirtualFile
VirtualFile.getNameSequence()
public java.lang.CharSequence getNameSequence()
getNameSequence
in class VirtualFile
public VirtualFileSystem getFileSystem()
VirtualFile
VirtualFileSystem
this file belongs to.getFileSystem
in class VirtualFile
VirtualFileSystem
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 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 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 java.io.OutputStream getOutputStream(java.lang.Object requestor, long newModificationStamp, long newTimeStamp) throws java.io.IOException
VirtualFile
Gets the OutputStream
for this file and sets modification stamp and time stamp to the specified values
after closing the stream.
Normally, you should not use this method.
Writes BOM first, if there is any. See Unicode Byte Order Mark FAQ for an explanation.
getOutputStream
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()
and SafeWriteRequestor
.newModificationStamp
- new modification stamp or -1 if no special value should be setnewTimeStamp
- new time stamp or -1 if no special value should be setOutputStream
java.io.IOException
- if an I/O error occursVirtualFile.getModificationStamp()
public byte [] contentsToByteArray() throws java.io.IOException
VirtualFile
contentsToByteArray
in class VirtualFile
java.io.IOException
- if an I/O error occursVirtualFile.contentsToByteArray(boolean)
,
VirtualFile.getInputStream()
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 java.io.InputStream getInputStream() throws java.io.IOException
VirtualFile
InputStream
for this file.
Skips BOM if there is any. See Unicode Byte Order Mark FAQ for an explanation.getInputStream
in class VirtualFile
InputStream
java.io.IOException
- if an I/O error occursVirtualFile.contentsToByteArray()
public long getModificationStamp()
VirtualFile
getModificationStamp
in class VirtualFile
VirtualFile.getTimeStamp()