/** Attempts to memory map this file in READ_ONLY mode. Android files must not be compressed. * @throws GdxRuntimeException if this file handle represents a directory, doesn't exist, or could not be read, or memory mapping fails, or is a {@link FileType#Classpath} file. */ public ByteBuffer map () { return map(MapMode.READ_ONLY); }
/** Reads the entire file into a string using the platform's default charset. * @throws GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public String readString () { return readString(null); }
/** Returns a writer for writing to this file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public Writer writer (boolean append) { return writer(append, null); }
static private void copyDirectory (FileHandle sourceDir, FileHandle destDir) { destDir.mkdirs(); FileHandle[] files = sourceDir.list(); for (int i = 0, n = files.length; i < n; i++) { FileHandle srcFile = files[i]; FileHandle destFile = destDir.child(srcFile.name()); if (srcFile.isDirectory()) copyDirectory(srcFile, destFile); else copyFile(srcFile, destFile); } } }
static public String getAtlasName (String name, boolean flattenPaths) { return flattenPaths ? new FileHandle(name).name() : name; } }
public IOSFiles () { new FileHandle(externalPath).mkdirs(); new FileHandle(localPath).mkdirs(); }
/** @param flip If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner. * @see #TextureAtlas(FileHandle) */ public TextureAtlas (FileHandle packFile, boolean flip) { this(packFile, packFile.parent(), flip); }
/** Writes the specified string to the file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public void writeString (String string, boolean append) { writeString(string, append, null); }
private int estimateLength () { int length = (int)length(); return length != 0 ? length : 512; }
public String toString () { return file.toString(); } }
/** Deletes all children of this directory, recursively. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public void emptyDirectory () { emptyDirectory(false); }
public IOSFiles () { new FileHandle(externalPath).mkdirs(); new FileHandle(localPath).mkdirs(); }
/** @param flip If true, all regions loaded will be flipped for use with a perspective where 0,0 is the upper left corner. * @see #TextureAtlas(FileHandle) */ public TextureAtlas (FileHandle packFile, boolean flip) { this(packFile, packFile.parent(), flip); }
/** Reads the entire file into a string using the platform's default charset. * @throws GdxRuntimeException if the file handle represents a directory, doesn't exist, or could not be read. */ public String readString () { return readString(null); }
/** Writes the specified string to the file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public void writeString (String string, boolean append) { writeString(string, append, null); }
/** Attempts to memory map this file in READ_ONLY mode. Android files must not be compressed. * @throws GdxRuntimeException if this file handle represents a directory, doesn't exist, or could not be read, or memory mapping fails, or is a {@link FileType#Classpath} file. */ public ByteBuffer map () { return map(MapMode.READ_ONLY); }
/** Returns a writer for writing to this file using the default charset. Parent directories will be created if necessary. * @param append If false, this file will be overwritten if it exists, otherwise it will be appended. * @throws GdxRuntimeException if this file handle represents a directory, if it is a {@link FileType#Classpath} or * {@link FileType#Internal} file, or if it could not be written. */ public Writer writer (boolean append) { return writer(append, null); }
public String toString () { return file.toString(); } }
/** Deletes all children of this directory, recursively. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public void emptyDirectory () { emptyDirectory(false); }
/** Loads the specified pack file, using the parent directory of the pack file to find the page images. */ public TextureAtlas (FileHandle packFile) { this(packFile, packFile.parent()); }