APIdia Launch Partner
Top Description Inners Methods
com.badlogic.gdx

public Interface Files

Imports
com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.utils.GdxRuntimeException

Provides standard access to the filesystem, classpath, Android app storage (internal and external), and Android assets directory.
Authors
mzechner, Nathan Sweet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Files.FileType

Indicates how to resolve a path to a file.

Method Summary

Modifier and TypeMethod and Description
public FileHandle
absolute(String path)

Convenience method that returns a FileType#Absolute file handle.

public FileHandle
classpath(String path)

Convenience method that returns a FileType#Classpath file handle.

public FileHandle
external(String path)

Convenience method that returns a FileType#External file handle.

public String
getExternalStoragePath()

Returns the external storage path directory.

public FileHandle
getFileHandle(String path, Files.FileType
Determines how the path is resolved.
type
)

Returns a handle representing a file or directory.

public String
getLocalStoragePath()

Returns the local storage path directory.

public FileHandle
internal(String path)

Convenience method that returns a FileType#Internal file handle.

public boolean
isExternalStorageAvailable()

Returns true if the external storage is ready for file IO.

public boolean
isLocalStorageAvailable()

Returns true if the local storage is ready for file IO.

public FileHandle
local(String path)

Convenience method that returns a FileType#Local file handle.

Method Detail

absoluteback to summary
public FileHandle absolute(String path)

Convenience method that returns a FileType#Absolute file handle.

classpathback to summary
public FileHandle classpath(String path)

Convenience method that returns a FileType#Classpath file handle.

externalback to summary
public FileHandle external(String path)

Convenience method that returns a FileType#External file handle.

getExternalStoragePathback to summary
public String getExternalStoragePath()

Returns the external storage path directory. This is the app external storage on Android and the home directory of the current user on the desktop.

getFileHandleback to summary
public FileHandle getFileHandle(String path, Files.FileType type)

Returns a handle representing a file or directory.

Parameters
type:Files.FileType

Determines how the path is resolved.

Exceptions
GdxRuntimeException:
if the type is classpath or internal and the file does not exist.
See Also
FileType
getLocalStoragePathback to summary
public String getLocalStoragePath()

Returns the local storage path directory. This is the private files directory on Android and the directory of the jar on the desktop.

internalback to summary
public FileHandle internal(String path)

Convenience method that returns a FileType#Internal file handle.

isExternalStorageAvailableback to summary
public boolean isExternalStorageAvailable()

Returns true if the external storage is ready for file IO.

isLocalStorageAvailableback to summary
public boolean isLocalStorageAvailable()

Returns true if the local storage is ready for file IO.

localback to summary
public FileHandle local(String path)

Convenience method that returns a FileType#Local file handle.

com.badlogic.gdx back to summary

public final Enum Files.FileType

extends Enum<Files.FileType>
Class Inheritance

Indicates how to resolve a path to a file.
Authors
mzechner, Nathan Sweet

Field Summary

Modifier and TypeField and Description
public static final Files.FileType
Absolute

Path that is a fully qualified, absolute filesystem path.

public static final Files.FileType
Classpath

Path relative to the root of the classpath.

public static final Files.FileType
External

Path relative to the root of the app external storage on Android and to the home directory of the current user on the desktop.

public static final Files.FileType
Internal

Path relative to the asset directory on Android and to the application's root directory on the desktop.

public static final Files.FileType
Local

Path relative to the private files directory on Android and to the application's root directory on the desktop.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Files.FileType
public static Files.FileType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Absoluteback to summary
public static final Files.FileType Absolute

Path that is a fully qualified, absolute filesystem path. To ensure portability across platforms use absolute files only when absolutely (heh) necessary.

Classpathback to summary
public static final Files.FileType Classpath

Path relative to the root of the classpath. Classpath files are always readonly. Note that classpath files are not compatible with some functionality on Android, such as Audio#newSound(FileHandle) and Audio#newMusic(FileHandle).

Externalback to summary
public static final Files.FileType External

Path relative to the root of the app external storage on Android and to the home directory of the current user on the desktop.

Internalback to summary
public static final Files.FileType Internal

Path relative to the asset directory on Android and to the application's root directory on the desktop. On the desktop, if the file is not found, then the classpath is checked. This enables files to be found when using JWS or applets. Internal files are always readonly.

Localback to summary
public static final Files.FileType Local

Path relative to the private files directory on Android and to the application's root directory on the desktop.

Constructor Detail

FileTypeback to summary
private FileType()

Method Detail

valueOfback to summary
public static Files.FileType valueOf(String name)
valuesback to summary
public static Files.FileType[] values()