use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class AndroidZipFileHandle method list.
@Override
public FileHandle[] list(FileFilter filter) {
ZipEntryRO[] zipEntries = expansionFile.getEntriesAt(getPath());
FileHandle[] handles = new FileHandle[zipEntries.length];
int count = 0;
for (int i = 0, n = handles.length; i < n; i++) {
FileHandle child = new AndroidZipFileHandle(zipEntries[i].mFileName);
if (!filter.accept(child.file()))
continue;
handles[count] = child;
count++;
}
if (count < zipEntries.length) {
FileHandle[] newHandles = new FileHandle[count];
System.arraycopy(handles, 0, newHandles, 0, count);
handles = newHandles;
}
return handles;
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class AndroidFileHandle method list.
public FileHandle[] list() {
if (type == FileType.Internal) {
try {
String[] relativePaths = assets.list(file.getPath());
FileHandle[] handles = new FileHandle[relativePaths.length];
for (int i = 0, n = handles.length; i < n; i++) handles[i] = new AndroidFileHandle(assets, new File(file, relativePaths[i]), type);
return handles;
} catch (Exception ex) {
throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex);
}
}
return super.list();
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class AndroidFileHandle method list.
public FileHandle[] list(FilenameFilter filter) {
if (type == FileType.Internal) {
try {
String[] relativePaths = assets.list(file.getPath());
FileHandle[] handles = new FileHandle[relativePaths.length];
int count = 0;
for (int i = 0, n = handles.length; i < n; i++) {
String path = relativePaths[i];
if (!filter.accept(file, path))
continue;
handles[count] = new AndroidFileHandle(assets, new File(file, path), type);
count++;
}
if (count < relativePaths.length) {
FileHandle[] newHandles = new FileHandle[count];
System.arraycopy(handles, 0, newHandles, 0, count);
handles = newHandles;
}
return handles;
} catch (Exception ex) {
throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex);
}
}
return super.list(filter);
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class AndroidFileHandle method list.
public FileHandle[] list(String suffix) {
if (type == FileType.Internal) {
try {
String[] relativePaths = assets.list(file.getPath());
FileHandle[] handles = new FileHandle[relativePaths.length];
int count = 0;
for (int i = 0, n = handles.length; i < n; i++) {
String path = relativePaths[i];
if (!path.endsWith(suffix))
continue;
handles[count] = new AndroidFileHandle(assets, new File(file, path), type);
count++;
}
if (count < relativePaths.length) {
FileHandle[] newHandles = new FileHandle[count];
System.arraycopy(handles, 0, newHandles, 0, count);
handles = newHandles;
}
return handles;
} catch (Exception ex) {
throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex);
}
}
return super.list(suffix);
}
use of com.badlogic.gdx.files.FileHandle in project libgdx by libgdx.
the class AndroidFileHandle method list.
public FileHandle[] list(FileFilter filter) {
if (type == FileType.Internal) {
try {
String[] relativePaths = assets.list(file.getPath());
FileHandle[] handles = new FileHandle[relativePaths.length];
int count = 0;
for (int i = 0, n = handles.length; i < n; i++) {
String path = relativePaths[i];
FileHandle child = new AndroidFileHandle(assets, new File(file, path), type);
if (!filter.accept(child.file()))
continue;
handles[count] = child;
count++;
}
if (count < relativePaths.length) {
FileHandle[] newHandles = new FileHandle[count];
System.arraycopy(handles, 0, newHandles, 0, count);
handles = newHandles;
}
return handles;
} catch (Exception ex) {
throw new GdxRuntimeException("Error listing children: " + file + " (" + type + ")", ex);
}
}
return super.list(filter);
}
Aggregations