saker.build Documentation TaskDoc JavaDoc Packages
public interface FileHandle extends StreamWritable
Interface representing a reference to a file.

The interface specifies methods in addition to StreamWritable. Subclasses should override these to provide a more efficient implementation.

Methods
public default ByteArrayRegion
Gets the raw contents of the file as a byte array.
public default String
Gets the contents of the file as a String.
public String
Gets the name of the file.
public default ByteSource
Opens a ByteSource to the contents of the file.
public default InputStream
Opens an InputStream to the contents of the file.
Inherited methods
public default ByteArrayRegion getBytes() throws IOException
Gets the raw contents of the file as a byte array.
The raw contents of the file.
IOExceptionIn case of I/O error.
public default String getContent() throws IOException
Gets the contents of the file as a String.

The default implementation converts the raw byte contents of the file is to string by decoding it as UTF-8 encoded data.

The file contents as string.
IOExceptionIn case of I/O error.
public abstract String getName()
Gets the name of the file.

The name of the file should be considered final and not change during the lifetime of the object.

The name may not be null, empty, "." or "..", must not contain slash characters ('/', '\\'), and must not contain the colon (':') and semicolon (';') characters.

Note that in some cases the above restriction may be violated, when root directories need to be represented. They will have a name according to the root path name they represent. I.e. They can be "/", or drive names in "drive:" format. These root directories cannot be added to other directories.

The file name.
public default ByteSource openByteSource() throws IOException
Opens a ByteSource to the contents of the file.
The opened input.
IOExceptionIn caes of I/O error.
Opens an InputStream to the contents of the file.
The opened input.
IOExceptionIn case of I/O error.