public abstract class ArchiveFileSystem extends NewVirtualFileSystem
DEFAULT_LENGTH, DEFAULT_TIMESTAMP
Constructor and Description |
---|
ArchiveFileSystem() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
composeRootPath(java.lang.String localPath)
A reverse to
extractLocalPath(String) - i.e. |
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 abstract 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. |
VirtualFile |
findLocalByRootPath(java.lang.String rootPath)
Returns a local file of an archive which hosts a root with the given path
(i.e.: "jar:///path/to/jar.jar!/" => file:///path/to/jar.jar),
or
null if the local file is of incorrect type. |
FileAttributes |
getAttributes(VirtualFile file)
Reads various file attributes in one shot (to reduce the number of native I/O calls).
|
protected abstract ArchiveHandler |
getHandler(VirtualFile entryFile) |
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) |
VirtualFile |
getLocalByEntry(VirtualFile entry)
Returns a local file of an archive which hosts a given entry file
(i.e.: jar:///path/to/jar.jar!/resource.xml => file:///path/to/jar.jar),
or
null if the file does not belong to this file system. |
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) |
int |
getRank() |
protected java.lang.String |
getRelativePath(VirtualFile file) |
VirtualFile |
getRootByEntry(VirtualFile entry)
Returns a root entry of an archive which hosts a given entry file
(i.e.: jar:///path/to/jar.jar!/resource.xml => jar:///path/to/jar.jar!/),
or
null if the file does not belong to this file system. |
VirtualFile |
getRootByLocal(VirtualFile file)
Returns a root entry of an archive hosted by a given local file
(i.e.: file:///path/to/jar.jar => jar:///path/to/jar.jar!/),
or
null if the file does not host this file system. |
java.lang.String |
getRootPathByLocal(VirtualFile file) |
long |
getTimeStamp(VirtualFile file) |
protected boolean |
isCorrectFileType(VirtualFile local)
Implementations should return
false if the given file may not host this file system. |
boolean |
isDirectory(VirtualFile file) |
boolean |
isWritable(VirtualFile file) |
java.lang.String [] |
list(VirtualFile file) |
void |
moveFile(java.lang.Object requestor,
VirtualFile file,
VirtualFile newParent)
Implementation of moving files in this file system
|
void |
renameFile(java.lang.Object requestor,
VirtualFile file,
java.lang.String newName)
Implementation of renaming files in this file system
|
void |
setTimeStamp(VirtualFile file,
long timeStamp) |
void |
setWritable(VirtualFile file,
boolean writableFlag) |
addVirtualFileListener, extractRootPath, findFileByPathIfCached, getCanonicallyCasedName, hasChildren, isReadOnly, isSymLink, markNewFilesAsDirty, normalize, refreshWithoutFileWatcher, removeVirtualFileListener, resolveSymLink
extractPresentableUrl, findFileByPath, getProtocol, isCaseSensitive, isValidName, refresh, refreshAndFindFileByPath
public VirtualFile getRootByLocal(VirtualFile file)
null
if the file does not host this file system.public java.lang.String getRootPathByLocal(VirtualFile file)
public VirtualFile getRootByEntry(VirtualFile entry)
null
if the file does not belong to this file system.public VirtualFile getLocalByEntry(VirtualFile entry)
null
if the file does not belong to this file system.protected abstract java.lang.String extractLocalPath(java.lang.String rootPath)
VfsUtilCore.getRootFile(com.intellij.openapi.vfs.VirtualFile)
path to obtain a path to a local file.protected abstract java.lang.String composeRootPath(java.lang.String localPath)
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!/"protected abstract ArchiveHandler getHandler(VirtualFile entryFile)
public int getRank()
getRank
in class NewVirtualFileSystem
public VirtualFile copyFile(java.lang.Object requestor, VirtualFile file, VirtualFile newParent, java.lang.String copyName) throws java.io.IOException
VirtualFileSystem
copyFile
in interface FileSystemInterface
copyFile
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.copy(Object,VirtualFile,String)
public VirtualFile createChildDirectory(java.lang.Object requestor, VirtualFile parent, java.lang.String dir) throws java.io.IOException
VirtualFileSystem
createChildDirectory
in interface FileSystemInterface
createChildDirectory
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.createChildDirectory(Object,String)
public VirtualFile createChildFile(java.lang.Object requestor, VirtualFile parent, java.lang.String file) throws java.io.IOException
VirtualFileSystem
createChildFile
in interface FileSystemInterface
createChildFile
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.createChildData(Object,String)
public void deleteFile(java.lang.Object requestor, VirtualFile file) throws java.io.IOException
VirtualFileSystem
deleteFile
in interface FileSystemInterface
deleteFile
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.delete(Object)
public void moveFile(java.lang.Object requestor, VirtualFile file, VirtualFile newParent) throws java.io.IOException
VirtualFileSystem
moveFile
in interface FileSystemInterface
moveFile
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.move(Object,VirtualFile)
public void renameFile(java.lang.Object requestor, VirtualFile file, java.lang.String newName) throws java.io.IOException
VirtualFileSystem
renameFile
in interface FileSystemInterface
renameFile
in class NewVirtualFileSystem
java.io.IOException
VirtualFile.rename(Object,String)
protected java.lang.String getRelativePath(VirtualFile file)
public FileAttributes getAttributes(VirtualFile file)
NewVirtualFileSystem
getAttributes
in class NewVirtualFileSystem
file
- file to get attributes of.null
if the file doesn't exist.public java.lang.String [] list(VirtualFile file)
public boolean exists(VirtualFile file)
public boolean isDirectory(VirtualFile file)
public boolean isWritable(VirtualFile file)
public long getTimeStamp(VirtualFile file)
public long getLength(VirtualFile file)
public byte [] contentsToByteArray(VirtualFile file) throws java.io.IOException
java.io.IOException
public java.io.InputStream getInputStream(VirtualFile file) throws java.io.IOException
FileSystemInterface
VirtualFile.getInputStream()
java.io.IOException
public void setTimeStamp(VirtualFile file, long timeStamp) throws java.io.IOException
java.io.IOException
public void setWritable(VirtualFile file, boolean writableFlag) throws java.io.IOException
java.io.IOException
public java.io.OutputStream getOutputStream(VirtualFile file, java.lang.Object requestor, long modStamp, long timeStamp) throws java.io.IOException
FileSystemInterface
VirtualFile.getOutputStream(Object)
java.io.IOException
public VirtualFile findLocalByRootPath(java.lang.String rootPath)
null
if the local file is of incorrect type.protected boolean isCorrectFileType(VirtualFile local)
false
if the given file may not host this file system.