Package jetbrains.mps.vfs.iofs.jar
Class JarEntryFile
- java.lang.Object
 - 
- jetbrains.mps.vfs.iofs.jar.JarEntryFile
 
 
- 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancreateNewFile()creates a physical filebooleandelete()FIXME document what happens if one deletes non-empty folder.booleanequals(Object o)booleanexists()IFilefindChild(String name)Immediate child only.IFilegetBundleHome()List<IFile>getChildren()IFilegetDescendant(String suffix)FileSystemgetFileSystem()Use getFS() instead Note the IFileSystem is per-protocol, in which it differs from FileSystem.IFileSystemgetFS()StringgetName()IFilegetParent()StringgetPath()Returns a path of this file in a file system.QualifiedPathgetQualifiedPath()URLgetUrl()The problem here is with jar URLs.inthashCode()booleanisArchive()booleanisDirectory()booleanisInArchive()booleanisReadOnly()longlastModified()fixme if it is the same as in java.io.File then we need to enforce itlonglength()booleanmkdirs()booleanmove(IFile newParent)moves/renames the file at which the instance of thisIFilepointsInputStreamopenInputStream()OutputStreamopenOutputStream()booleanrename(String newName)renames the file at which the instance of thisIFilepoints (if it exists) the file stays under the same directory and changes its name to thenewNamebooleansetTimeStamp(long time)StringtoString()- 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait 
- 
Methods inherited from interface jetbrains.mps.vfs.IFile
addListener, isDescendant, isPackaged, refresh, removeListener 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getFS
@NotNull public IFileSystem getFS()
 
- 
getFileSystem
@NotNull public FileSystem getFileSystem()
Description copied from interface:IFileUse getFS() instead Note the IFileSystem is per-protocol, in which it differs from FileSystem.- Specified by:
 getFileSystemin interfaceIFile
 
- 
getParent
public IFile getParent()
 
- 
getChildren
public List<IFile> getChildren()
- Specified by:
 getChildrenin interfaceIFile- Returns:
 - the children of this file in case when it is a folder, null iff it is a file and therefore has no children
 
 
- 
isInArchive
public boolean isInArchive()
- Specified by:
 isInArchivein interfaceIFile- Returns:
 - whether the underlying pathname points to an archive file or some of its contents
 
 
- 
getDescendant
@NotNull public IFile getDescendant(@NotNull String suffix)
- Specified by:
 getDescendantin interfaceIFile
 
- 
findChild
@NotNull public IFile findChild(@NotNull String name)
Description copied from interface:IFileImmediate child only. Empty name is forbidden. Neither path separators nor archive separators can't present in name 
- 
isDirectory
public boolean isDirectory()
- Specified by:
 isDirectoryin interfaceIFile
 
- 
getPath
@NotNull public String getPath()
Description copied from interface:IFileReturns a path of this file in a file system. 
- 
getQualifiedPath
public QualifiedPath getQualifiedPath()
- Specified by:
 getQualifiedPathin interfaceIFile
 
- 
lastModified
public long lastModified()
Description copied from interface:IFilefixme if it is the same as in java.io.File then we need to enforce it- Specified by:
 lastModifiedin interfaceIFile
 
- 
createNewFile
public boolean createNewFile()
Description copied from interface:IFilecreates a physical file- Specified by:
 createNewFilein interfaceIFile- Returns:
 - whether it is a success
 
 
- 
delete
public boolean delete()
Description copied from interface:IFileFIXME document what happens if one deletes non-empty folder. IoFile seems to force deletion. Is it the contract? 
- 
rename
public boolean rename(@NotNull String newName)
Description copied from interface:IFilerenames the file at which the instance of thisIFilepoints (if it exists) the file stays under the same directory and changes its name to thenewName- Specified by:
 renamein interfaceIFile- Returns:
 - true iff success
//   * @deprecated use 
IFile.move(IFile) 
 
- 
move
public boolean move(@NotNull IFile newParent)
Description copied from interface:IFilemoves/renames the file at which the instance of thisIFilepoints 
- 
openInputStream
public InputStream openInputStream() throws IOException
- Specified by:
 openInputStreamin interfaceIFile- Throws:
 IOException
 
- 
openOutputStream
public OutputStream openOutputStream() throws IOException
- Specified by:
 openOutputStreamin interfaceIFile- Throws:
 IOException
 
- 
isReadOnly
public boolean isReadOnly()
- Specified by:
 isReadOnlyin interfaceIFile
 
- 
getBundleHome
public IFile getBundleHome()
- Specified by:
 getBundleHomein interfaceIFile- Returns:
 - the jar or folder which contains this file
 
 
- 
setTimeStamp
public boolean setTimeStamp(long time)
- Specified by:
 setTimeStampin interfaceIFile
 
- 
getUrl
public URL getUrl() throws MalformedURLException
The problem here is with jar URLs. JDK does not allow us to work efficiently with jar files via URI. 0. I want to create URL which can be converted to URI. 1. Unfortunately that means that we need to escape space characters. (unescaped URL cannot be converted to the URI due to the #toURI method contract) 2. We are urged to use multi-argumentURIconstructor in order to properly escape all characters (spaces for instance). Moreover it is a recommended way to comply to all URI protocol conventions. 3. URI multi-arg constructor also asks for its path to be absolute (which -- in his understanding -- means a path starting with '/') 4. In jdk a default URL for a jar-file looks like 'jar:file://a.jar!/b.txt' and calling URL#getPath returns 'file://a.jar!/b.txt' which does not start with the slash and hence is not absolute and therefore cannot be simply passed to the URI constructor. 5. That is why we are compelled to use such a hack in constructor arguments which namely passes a jar:file scheme and passes an honest absolute path '/a.jar!/b.txt'.[AP: I would rather return URLs which can be converted to URIs than the ones which can not] Hopefully this hell will be replaced by the upcoming
vfs.Pathfeatures.- Specified by:
 getUrlin interfaceIFile- Throws:
 MalformedURLException
 
 - 
 
 -