public abstract class FileHandleStream extends FileHandle
read() and/or write(boolean). Methods
that would manipulate the file instead throw UnsupportedOperationException.file, type| Constructor and Description |
|---|
FileHandleStream(java.lang.String path)
Create an
Files.FileType.Absolute file at the given location. |
| Modifier and Type | Method and Description |
|---|---|
FileHandle |
child(java.lang.String name)
Returns a handle to the child with the specified name.
|
void |
copyTo(FileHandle dest)
Copies this file or directory to the specified file or directory.
|
boolean |
delete()
Deletes this file or empty directory and returns success.
|
boolean |
deleteDirectory()
Deletes this file or directory and all children, recursively.
|
boolean |
exists()
Returns true if the file exists.
|
boolean |
isDirectory()
Returns true if this file is a directory.
|
long |
length()
Returns the length in bytes of this file, or 0 if this file is a directory, does not exist, or the size cannot otherwise be
determined.
|
FileHandle[] |
list()
Returns the paths to the children of this directory.
|
void |
mkdirs() |
void |
moveTo(FileHandle dest)
Moves this file to the specified file, overwriting the file if it already exists.
|
FileHandle |
parent() |
java.io.InputStream |
read()
Returns a stream for reading this file as bytes.
|
FileHandle |
sibling(java.lang.String name)
Returns a handle to the sibling with the specified name.
|
java.io.OutputStream |
write(boolean overwrite)
Returns a stream for writing to this file.
|
emptyDirectory, emptyDirectory, equals, extension, file, hashCode, lastModified, list, list, list, name, nameWithoutExtension, path, pathWithoutExtension, read, readBytes, readBytes, reader, reader, reader, reader, readString, readString, tempDirectory, tempFile, toString, type, write, write, writeBytes, writeBytes, writer, writer, writeString, writeStringpublic FileHandleStream(java.lang.String path)
Files.FileType.Absolute file at the given location.public boolean isDirectory()
FileHandleFiles.FileType.Internal handle to an empty directory will return false. On the desktop, an Files.FileType.Internal
handle to a directory on the classpath will return false.isDirectory in class FileHandlepublic long length()
FileHandlelength in class FileHandlepublic boolean exists()
FileHandleFiles.FileType.Classpath or Files.FileType.Internal handle to a
directory will always return false. Note that this can be very slow for internal files on Android!exists in class FileHandlepublic FileHandle child(java.lang.String name)
FileHandlechild in class FileHandlepublic FileHandle sibling(java.lang.String name)
FileHandlesibling in class FileHandlepublic FileHandle parent()
parent in class FileHandlepublic java.io.InputStream read()
FileHandleread in class FileHandlepublic java.io.OutputStream write(boolean overwrite)
FileHandlewrite in class FileHandleoverwrite - If false, this file will be overwritten if it exists, otherwise it will be appended.public FileHandle[] list()
FileHandleFiles.FileType.Internal handle to a directory on the classpath will return a zero length
array.list in class FileHandlepublic void mkdirs()
mkdirs in class FileHandlepublic boolean delete()
FileHandledelete in class FileHandlepublic boolean deleteDirectory()
FileHandledeleteDirectory in class FileHandlepublic void copyTo(FileHandle dest)
FileHandleFileHandle.mkdirs() is called on the destination's parent and this file is copied into it with a new name. If
this handle is a directory, then 1) if the destination is a file, GdxRuntimeException is thrown, or 2) if the destination is
a directory, this directory is copied into it recursively, overwriting existing files, or 3) if the destination doesn't
exist, FileHandle.mkdirs() is called on the destination and this directory is copied into it recursively.copyTo in class FileHandlepublic void moveTo(FileHandle dest)
FileHandlemoveTo in class FileHandle