Package org.eclipse.xtend.lib.macro.file
Interface FileSystemSupport
-
- All Known Subinterfaces:
CodeGenerationContext,MutableFileSystemSupport,RegisterGlobalsContext,TransformationContext,ValidationContext
@Beta public interface FileSystemSupportSupport for accessing the file system.- Noimplement:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanexists(Path path)java.lang.StringgetCharset(Path path)Returns the name of a charset to be used when decoding the contents of this file into characters.java.lang.Iterable<? extends Path>getChildren(Path path)java.lang.CharSequencegetContents(Path path)Returns the contents of this file as a char sequence.java.io.InputStreamgetContentsAsStream(Path path)Returns an open input stream on the contents of this file.longgetLastModification(Path path)booleanisFile(Path path)booleanisFolder(Path path)java.net.URItoURI(Path path)Returns the URI representing the given path.
-
-
-
Method Detail
-
getChildren
java.lang.Iterable<? extends Path> getChildren(Path path)
- 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:
java.lang.IllegalArgumentException- if it is not possible to get children of a given path for some reason
-
exists
boolean exists(Path path)
- Parameters:
path- the path- Returns:
- whether the given path points to an existent file.
-
isFolder
boolean isFolder(Path path)
- Parameters:
path-- Returns:
- whether the given path points to an existent folder
-
isFile
boolean isFile(Path path)
- Parameters:
path-- Returns:
- whether the given path points to an existent file
-
getLastModification
long getLastModification(Path path)
- 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
java.lang.String getCharset(Path path)
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:
java.lang.IllegalArgumentException- if it is not possible to get charset of a given path for some reason
-
getContents
java.lang.CharSequence getContents(Path path)
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:
java.lang.IllegalArgumentException- if the path points to a non existent file
-
getContentsAsStream
java.io.InputStream getContentsAsStream(Path path)
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:
java.lang.IllegalArgumentException- if the path points to a non existent file
-
toURI
java.net.URI toURI(Path path)
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.
-
-