Module org.eclipse.xtend.lib.macro
Package org.eclipse.xtend.lib.macro.file
Interface FileSystemSupport
- All Known Subinterfaces:
CodeGenerationContext,MutableFileSystemSupport,RegisterGlobalsContext,TransformationContext,ValidationContext
@Beta
public interface FileSystemSupport
Support for accessing the file system.
- Author:
- Anton Kosyakov, Sven Efftinge
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetCharset(Path path) Returns the name of a charset to be used when decoding the contents of this file into characters.getChildren(Path path) getContents(Path path) Returns the contents of this file as a char sequence.getContentsAsStream(Path path) Returns an open input stream on the contents of this file.longgetLastModification(Path path) booleanbooleanReturns the URI representing the given path.
-
Method Details
-
getChildren
- Parameters:
path-- Returns:
- the children of the folder the given path points to; empty iterable if the path points to a non existent file or folder
- Throws:
IllegalArgumentException- if it is not possible to get children of a given path for some reason
-
exists
- Parameters:
path- the path- Returns:
- whether the given path points to an existent file.
-
isFolder
- Parameters:
path-- Returns:
- whether the given path points to an existent folder
-
isFile
- Parameters:
path-- Returns:
- whether the given path points to an existent file
-
getLastModification
- Parameters:
path-- Returns:
- A
longvalue representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or0Lif the file does not exist.
-
getCharset
Returns the name of a charset to be used when decoding the contents of this file into characters.- Parameters:
path- the path- Returns:
- the name of a charset
- Throws:
IllegalArgumentException- if it is not possible to get charset of a given path for some reason
-
getContents
Returns the contents of this file as a char sequence.- Parameters:
path- the path- Returns:
- an input stream containing the contents of the file
- Throws:
IllegalArgumentException- if the path points to a non existent file
-
getContentsAsStream
Returns an open input stream on the contents of this file.- Parameters:
path- the path- Returns:
- an input stream containing the contents of the file
- Throws:
IllegalArgumentException- if the path points to a non existent file
-
toURI
Returns the URI representing the given path.
Warning: Don't use this method to get write access.
- Parameters:
path- the path- Returns:
- the URI representing the given path or
nullif the path points to a non existent file or a folder.
-