Package spoon.support.compiler
Class VirtualFile
- java.lang.Object
-
- spoon.support.compiler.VirtualFile
-
- All Implemented Interfaces:
SpoonFile
,SpoonResource
public class VirtualFile extends Object implements SpoonFile
-
-
Field Summary
Fields Modifier and Type Field Description static String
VIRTUAL_FILE_NAME
-
Constructor Summary
Constructors Constructor Description VirtualFile(String content)
VirtualFile(String contents, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getContent()
Gets the file content as a stream.char[]
getContentChars(Environment env)
Gets the file content as a char array, considering encoding or encoding provider.File
getFileSystemParent()
Gets the parent of this resource on the file system.String
getName()
Gets the name of this resource.SpoonFolder
getParent()
Gets the folder that contains this resource.String
getPath()
Gets this resource path.boolean
isActualFile()
Tells if this file is an actual file (not a virtual file that holds in-memory contents).boolean
isArchive()
Tells if this resource is an archive.boolean
isFile()
Tells if this resource is a file.boolean
isJava()
True if a Java source code file.File
toFile()
Gets the corresponding file if possible (returns null if this resource does not correspond to any file on the filesystem).
-
-
-
Field Detail
-
VIRTUAL_FILE_NAME
public static final String VIRTUAL_FILE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getContent
public InputStream getContent()
Description copied from interface:SpoonFile
Gets the file content as a stream.- Specified by:
getContent
in interfaceSpoonFile
-
getContentChars
public char[] getContentChars(Environment env)
Description copied from interface:SpoonFile
Gets the file content as a char array, considering encoding or encoding provider.- Specified by:
getContentChars
in interfaceSpoonFile
-
isJava
public boolean isJava()
Description copied from interface:SpoonFile
True if a Java source code file.
-
getName
public String getName()
Description copied from interface:SpoonResource
Gets the name of this resource.- Specified by:
getName
in interfaceSpoonResource
-
getParent
public SpoonFolder getParent()
Description copied from interface:SpoonResource
Gets the folder that contains this resource.- Specified by:
getParent
in interfaceSpoonResource
-
getFileSystemParent
public File getFileSystemParent()
Description copied from interface:SpoonResource
Gets the parent of this resource on the file system.- Specified by:
getFileSystemParent
in interfaceSpoonResource
-
getPath
public String getPath()
Description copied from interface:SpoonResource
Gets this resource path.- Specified by:
getPath
in interfaceSpoonResource
-
isFile
public boolean isFile()
Description copied from interface:SpoonResource
Tells if this resource is a file.- Specified by:
isFile
in interfaceSpoonResource
-
isArchive
public boolean isArchive()
Description copied from interface:SpoonResource
Tells if this resource is an archive.- Specified by:
isArchive
in interfaceSpoonResource
-
toFile
public File toFile()
Description copied from interface:SpoonResource
Gets the corresponding file if possible (returns null if this resource does not correspond to any file on the filesystem).- Specified by:
toFile
in interfaceSpoonResource
-
isActualFile
public boolean isActualFile()
Description copied from interface:SpoonFile
Tells if this file is an actual file (not a virtual file that holds in-memory contents).- Specified by:
isActualFile
in interfaceSpoonFile
- Returns:
-
-