APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.files

public abstract Class FileHandleStream

extends FileHandle
Class Inheritance
Imports
java.io.File, .InputStream, .OutputStream, com.badlogic.gdx.Files.FileType

A FileHandle intended to be subclassed for the purpose of implementing read() and/or write(boolean). Methods that would manipulate the file instead throw UnsupportedOperationException.
Author
Nathan Sweet

Field Summary

Inherited from com.badlogic.gdx.files.FileHandle:
filetype

Constructor Summary

AccessConstructor and Description
public
FileHandleStream(String path)

Create an FileType#Absolute file at the given location.

Method Summary

Modifier and TypeMethod and Description
public FileHandle
child(String name)

Overrides com.badlogic.gdx.files.FileHandle.child.

Returns a handle to the child with the specified name.

public void
copyTo(FileHandle dest)

Overrides com.badlogic.gdx.files.FileHandle.copyTo.

Copies this file or directory to the specified file or directory.

public boolean
delete()

Overrides com.badlogic.gdx.files.FileHandle.delete.

Deletes this file or empty directory and returns success.

public boolean
deleteDirectory()

Overrides com.badlogic.gdx.files.FileHandle.deleteDirectory.

Deletes this file or directory and all children, recursively.

public void
emptyDirectory()

Overrides com.badlogic.gdx.files.FileHandle.emptyDirectory.

Deletes all children of this directory, recursively.

public void
emptyDirectory(boolean preserveTree)

Overrides com.badlogic.gdx.files.FileHandle.emptyDirectory.

Deletes all children of this directory, recursively.

public boolean
exists()

Overrides com.badlogic.gdx.files.FileHandle.exists.

Returns true if the file exists.

public boolean
isDirectory()

Overrides com.badlogic.gdx.files.FileHandle.isDirectory.

Returns true if this file is a directory.

public long
length()

Overrides com.badlogic.gdx.files.FileHandle.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.

public FileHandle[]
list()

Overrides com.badlogic.gdx.files.FileHandle.list.

Returns the paths to the children of this directory.

public void
public void
moveTo(FileHandle dest)

Overrides com.badlogic.gdx.files.FileHandle.moveTo.

Moves this file to the specified file, overwriting the file if it already exists.

public FileHandle
public InputStream
read()

Overrides com.badlogic.gdx.files.FileHandle.read.

Returns a stream for reading this file as bytes.

public FileHandle
sibling(String name)

Overrides com.badlogic.gdx.files.FileHandle.sibling.

Returns a handle to the sibling with the specified name.

public OutputStream
write(boolean overwrite)

Overrides com.badlogic.gdx.files.FileHandle.write.

Returns a stream for writing to this file.

Inherited from com.badlogic.gdx.files.FileHandle:
equalsextensionfilehashCodelastModifiedlistlistlistmapmapnamenameWithoutExtensionpathpathWithoutExtensionreadreadBytesreadBytesreaderreaderreaderreaderreadStringreadStringtempDirectorytempFiletoStringtypewritewritewriteByteswriteByteswriterwriterwriteStringwriteString

Constructor Detail

FileHandleStreamback to summary
public FileHandleStream(String path)

Create an FileType#Absolute file at the given location.

Method Detail

childback to summary
public FileHandle child(String name)

Overrides com.badlogic.gdx.files.FileHandle.child.

Doc from com.badlogic.gdx.files.FileHandle.child.

Returns a handle to the child with the specified name.

copyToback to summary
public void copyTo(FileHandle dest)

Overrides com.badlogic.gdx.files.FileHandle.copyTo.

Doc from com.badlogic.gdx.files.FileHandle.copyTo.

Copies this file or directory to the specified file or directory. If this handle is a file, then 1) if the destination is a file, it is overwritten, or 2) if the destination is a directory, this file is copied into it, or 3) if the destination doesn't exist, 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, mkdirs() is called on the destination and this directory is copied into it recursively.

deleteback to summary
public boolean delete()

Overrides com.badlogic.gdx.files.FileHandle.delete.

Doc from com.badlogic.gdx.files.FileHandle.delete.

Deletes this file or empty directory and returns success. Will not delete a directory that has children.

deleteDirectoryback to summary
public boolean deleteDirectory()

Overrides com.badlogic.gdx.files.FileHandle.deleteDirectory.

Doc from com.badlogic.gdx.files.FileHandle.deleteDirectory.

Deletes this file or directory and all children, recursively.

emptyDirectoryback to summary
public void emptyDirectory()

Overrides com.badlogic.gdx.files.FileHandle.emptyDirectory.

Doc from com.badlogic.gdx.files.FileHandle.emptyDirectory.

Deletes all children of this directory, recursively.

emptyDirectoryback to summary
public void emptyDirectory(boolean preserveTree)

Overrides com.badlogic.gdx.files.FileHandle.emptyDirectory.

Doc from com.badlogic.gdx.files.FileHandle.emptyDirectory.

Deletes all children of this directory, recursively. Optionally preserving the folder structure.

existsback to summary
public boolean exists()

Overrides com.badlogic.gdx.files.FileHandle.exists.

Doc from com.badlogic.gdx.files.FileHandle.exists.

Returns true if the file exists. On Android, a FileType#Classpath or FileType#Internal handle to a directory will always return false. Note that this can be very slow for internal files on Android!

isDirectoryback to summary
public boolean isDirectory()

Overrides com.badlogic.gdx.files.FileHandle.isDirectory.

Doc from com.badlogic.gdx.files.FileHandle.isDirectory.

Returns true if this file is a directory. Always returns false for classpath files. On Android, an FileType#Internal handle to an empty directory will return false. On the desktop, an FileType#Internal handle to a directory on the classpath will return false.

lengthback to summary
public long length()

Overrides com.badlogic.gdx.files.FileHandle.length.

Doc from com.badlogic.gdx.files.FileHandle.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.

listback to summary
public FileHandle[] list()

Overrides com.badlogic.gdx.files.FileHandle.list.

Doc from com.badlogic.gdx.files.FileHandle.list.

Returns the paths to the children of this directory. Returns an empty list if this file handle represents a file and not a directory. On the desktop, an FileType#Internal handle to a directory on the classpath will return a zero length array.

mkdirsback to summary
public void mkdirs()

Overrides com.badlogic.gdx.files.FileHandle.mkdirs.

moveToback to summary
public void moveTo(FileHandle dest)

Overrides com.badlogic.gdx.files.FileHandle.moveTo.

Doc from com.badlogic.gdx.files.FileHandle.moveTo.

Moves this file to the specified file, overwriting the file if it already exists.

parentback to summary
public FileHandle parent()

Overrides com.badlogic.gdx.files.FileHandle.parent.

readback to summary
public InputStream read()

Overrides com.badlogic.gdx.files.FileHandle.read.

Doc from com.badlogic.gdx.files.FileHandle.read.

Returns a stream for reading this file as bytes.

siblingback to summary
public FileHandle sibling(String name)

Overrides com.badlogic.gdx.files.FileHandle.sibling.

Doc from com.badlogic.gdx.files.FileHandle.sibling.

Returns a handle to the sibling with the specified name.

writeback to summary
public OutputStream write(boolean overwrite)

Overrides com.badlogic.gdx.files.FileHandle.write.

Doc from com.badlogic.gdx.files.FileHandle.write.

Returns a stream for writing to this file. Parent directories will be created if necessary.