libgdx API

com.badlogic.gdx
Interface Files


public interface Files

Provides standard access to the filesystem, classpath, Android SD card, and Android assets directory.

Author:
mzechner, Nathan Sweet

Nested Class Summary
static class Files.FileType
          Indicates how to resolve a path to a file.
 
Method Summary
 FileHandle absolute(java.lang.String path)
          Convenience method that returns a Files.FileType.Absolute file handle.
 FileHandle classpath(java.lang.String path)
          Convenience method that returns a Files.FileType.Classpath file handle.
 FileHandle external(java.lang.String path)
          Convenience method that returns a Files.FileType.External file handle.
 java.lang.String getExternalStoragePath()
          Returns the external storage path directory.
 FileHandle getFileHandle(java.lang.String path, Files.FileType type)
          Returns a handle representing a file or directory.
 java.lang.String getLocalStoragePath()
          Returns the local storage path directory.
 FileHandle internal(java.lang.String path)
          Convenience method that returns a Files.FileType.Internal file handle.
 boolean isExternalStorageAvailable()
          Returns true if the external storage is ready for file IO.
 boolean isLocalStorageAvailable()
          Returns true if the local storage is ready for file IO.
 FileHandle local(java.lang.String path)
          Convenience method that returns a Files.FileType.Local file handle.
 

Method Detail

getFileHandle

FileHandle getFileHandle(java.lang.String path,
                         Files.FileType type)
Returns a handle representing a file or directory.

Parameters:
type - Determines how the path is resolved.
Throws:
GdxRuntimeException - if the type is classpath or internal and the file does not exist.
See Also:
Files.FileType

classpath

FileHandle classpath(java.lang.String path)
Convenience method that returns a Files.FileType.Classpath file handle.


internal

FileHandle internal(java.lang.String path)
Convenience method that returns a Files.FileType.Internal file handle.


external

FileHandle external(java.lang.String path)
Convenience method that returns a Files.FileType.External file handle.


absolute

FileHandle absolute(java.lang.String path)
Convenience method that returns a Files.FileType.Absolute file handle.


local

FileHandle local(java.lang.String path)
Convenience method that returns a Files.FileType.Local file handle.


getExternalStoragePath

java.lang.String getExternalStoragePath()
Returns the external storage path directory. This is the SD card on Android and the home directory of the current user on the desktop.


isExternalStorageAvailable

boolean isExternalStorageAvailable()
Returns true if the external storage is ready for file IO. Eg, on Android, the SD card is not available when mounted for use with a PC.


getLocalStoragePath

java.lang.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.


isLocalStorageAvailable

boolean isLocalStorageAvailable()
Returns true if the local storage is ready for file IO.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)