use of org.robolectric.res.android.String8 in project robolectric by robolectric.
the class ShadowArscAssetManager method list.
@Implementation
protected final String[] list(String path) throws IOException {
CppAssetManager am = assetManagerForJavaObject();
String fileName8 = path;
if (fileName8 == null) {
return null;
}
AssetDir dir = am.openDir(fileName8);
if (dir == null) {
throw new FileNotFoundException(fileName8);
}
int N = dir.getFileCount();
String[] array = new String[dir.getFileCount()];
for (int i = 0; i < N; i++) {
String8 name = dir.getFileName(i);
array[i] = name.string();
}
return array;
}
use of org.robolectric.res.android.String8 in project robolectric by robolectric.
the class ShadowArscAssetManager method addAssetPathNative.
@HiddenApi
@Implementation(minSdk = VERSION_CODES.N)
protected int addAssetPathNative(String path, boolean appAsLib) {
if (Strings.isNullOrEmpty(path)) {
return 0;
}
CppAssetManager am = assetManagerForJavaObject();
if (am == null) {
return 0;
}
final Ref<Integer> cookie = new Ref<>(null);
boolean res = am.addAssetPath(new String8(path), cookie, appAsLib);
return (res) ? cookie.get() : 0;
}
Aggregations