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 Details

    • getChildren

      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:
      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 long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist.
    • getCharset

      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:
      IllegalArgumentException - if it is not possible to get charset of a given path for some reason
    • getContents

      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:
      IllegalArgumentException - if the path points to a non existent file
    • getContentsAsStream

      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:
      IllegalArgumentException - if the path points to a non existent file
    • toURI

      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 null if the path points to a non existent file or a folder.