Package jetbrains.mps.vfs
Interface IFile
- 
- All Known Subinterfaces:
 CachingFile
- All Known Implementing Classes:
 JarEntryFile,JrtIoFile
public interface IFileAn abstraction of path names similar to thePath. File may be obtained from a concrete file system or from VFSManager File.getPath() is os-independent. File.getPath() is absolute, do not store absolute paths in files. Instead, use MacroProcessor/QualifiedPath Path is not a global file identifier, seeQualifiedPathAlso it is an MPS abstraction around the IDEA platform file systemcom.intellij.openapi.vfs.VirtualFile. IDEA provides an intelligent caching mechanism which might boost up the file system traversal (comparing to theFile). See alsoCachingFileIFile must be immutable we define it as a pathname abstraction. That means that we cannot rename the IFile, we can only rename something that lies at this pathname on disk. The IFile itself must not be touched in any way. Otherwise it is cumbersome. The alternative is to reconsider the IFile contract. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default voidaddListener(FileListener listener)Deprecated.move to CachingFilebooleancreateNewFile()creates a physical filebooleandelete()FIXME document what happens if one deletes non-empty folder.booleanexists()IFilefindChild(String name)Immediate child only.IFilegetBundleHome()Deprecated.usegetPath()and extract the path you needList<IFile>getChildren()IFilegetDescendant(String suffix)Deprecated.use findChild() instead.FileSystemgetFileSystem()Deprecated.IFileSystemgetFS()StringgetName()IFilegetParent()StringgetPath()Returns a path of this file in a file system.QualifiedPathgetQualifiedPath()URLgetUrl()Deprecated.booleanisArchive()Deprecated.default booleanisDescendant(IFile file)booleanisDirectory()booleanisInArchive()default booleanisPackaged()Deprecated.useisArchive()orisInArchive()booleanisReadOnly()longlastModified()fixme if it is the same as in java.io.File then we need to enforce itlonglength()Deprecated.booleanmkdirs()booleanmove(IFile newParent)moves/renames the file at which the instance of thisIFilepointsInputStreamopenInputStream()OutputStreamopenOutputStream()default voidrefresh()Deprecated.default voidremoveListener(FileListener listener)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) 
 - 
 
- 
- 
Method Detail
- 
getFileSystem
@Deprecated @NotNull FileSystem getFileSystem()
Deprecated.Use getFS() instead Note the IFileSystem is per-protocol, in which it differs from FileSystem. 
- 
getFS
@NotNull IFileSystem getFS()
 
- 
getUrl
@Nullable @Deprecated URL getUrl() throws MalformedURLException
Deprecated.use getQualifiedPath()- Throws:
 MalformedURLException
 
- 
getQualifiedPath
QualifiedPath getQualifiedPath()
 
- 
getParent
@Nullable IFile getParent()
- Returns:
 - null iff the instance is root and has no parent, the parent folder otherwise
 
 
- 
isArchive
@Deprecated boolean isArchive()
Deprecated. 
- 
isInArchive
boolean isInArchive()
- Returns:
 - whether the underlying pathname points to an archive file or some of its contents
 
 
- 
isPackaged
@Deprecated default boolean isPackaged()
Deprecated.useisArchive()orisInArchive() 
- 
refresh
@Deprecated default void refresh()
Deprecated. 
- 
getBundleHome
@Deprecated IFile getBundleHome()
Deprecated.usegetPath()and extract the path you need- Returns:
 - the jar or folder which contains this file
 
 
- 
isDirectory
boolean isDirectory()
 
- 
isReadOnly
boolean isReadOnly()
 
- 
getDescendant
@Deprecated @NotNull IFile getDescendant(@NotNull String suffix)
Deprecated.use findChild() instead. The problem of findDescendant is that it's unclear, can we pass an empty string, string with path separators, string with archive separators 
- 
findChild
@NotNull IFile findChild(@NotNull String name)
Immediate child only. Empty name is forbidden. Neither path separators nor archive separators can't present in name 
- 
getChildren
@Nullable List<IFile> getChildren()
- Returns:
 - the children of this file in case when it is a folder, null iff it is a file and therefore has no children
 
 
- 
addListener
default void addListener(@NotNull FileListener listener)
Deprecated.move to CachingFile 
- 
removeListener
default void removeListener(@NotNull FileListener listener)
 
- 
lastModified
long lastModified()
fixme if it is the same as in java.io.File then we need to enforce it 
- 
length
@Deprecated long length()
Deprecated. 
- 
exists
boolean exists()
 
- 
setTimeStamp
boolean setTimeStamp(long time)
 
- 
createNewFile
boolean createNewFile()
creates a physical file- Returns:
 - whether it is a success
 
 
- 
mkdirs
boolean mkdirs()
 
- 
delete
boolean delete()
FIXME document what happens if one deletes non-empty folder. IoFile seems to force deletion. Is it the contract?- Returns:
 - true if the deletion went with a success
 
 
- 
rename
boolean rename(@NotNull 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 thenewName- Returns:
 - true iff success
//   * @deprecated use 
move(IFile) 
 
- 
move
boolean move(@NotNull IFile newParent)
moves/renames the file at which the instance of thisIFilepoints- Returns:
 - true iff success
 
 
- 
openInputStream
InputStream openInputStream() throws IOException
- Throws:
 IOException
 
- 
openOutputStream
OutputStream openOutputStream() throws IOException
- Throws:
 IOException
 
- 
isDescendant
default boolean isDescendant(IFile file)
 
 - 
 
 -