public final class SysUtil
extends java.lang.Object
| Constructor and Description |
|---|
SysUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteOrThrow(java.io.File file) |
static void |
dumbDelete(java.io.File file)
Delete a directory and its contents.
|
static void |
fallocateIfSupported(java.io.FileDescriptor fd,
long length)
Pre-allocate disk space for a file if we can do that on this version of the OS.
|
static int |
findAbiScore(java.lang.String[] supportedAbis,
java.lang.String abi)
Determine how preferred a given ABI is on this system.
|
static void |
fsyncAll(java.io.File fileName) |
static long |
getApkDepBlockLength(java.io.File apkFile)
Retrieve the size of dependency file.
|
static int |
getAppVersionCode(android.content.Context context) |
static java.lang.String |
getBaseName(java.lang.String fileName)
Gets the base name, without extension, of given file name.
|
static java.lang.String |
getClassLoaderLdLoadLibrary() |
static FileLocker |
getFileLocker(java.io.File lockFileName) |
static java.lang.reflect.Method |
getNativeLoadRuntimeMethod() |
static FileLocker |
getOrCreateLockOnDir(java.io.File soDirectory,
java.io.File lockFileName) |
static java.lang.String[] |
getSupportedAbis()
Return an list of ABIs we supported on this device ordered according to preference.
|
static boolean |
is64Bit() |
static boolean |
isDisabledExtractNativeLibs(android.content.Context context) |
static boolean |
isSupportedDirectLoad(android.content.Context context,
int appType) |
static byte[] |
makeApkDepBlock(java.io.File apkFile,
android.content.Context context)
N.B.
|
static java.lang.String |
makeNonZipPath(java.lang.String localLdLibraryPath) |
static void |
mkdirOrThrow(java.io.File dir)
Like File.mkdirs, but throws on error.
|
public static int findAbiScore(java.lang.String[] supportedAbis,
java.lang.String abi)
supportedAbis - ABIs on this systemabi - ABI of a shared library we might want to unpackpublic static void deleteOrThrow(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String[] getSupportedAbis()
public static void fallocateIfSupported(java.io.FileDescriptor fd,
long length)
throws java.io.IOException
fd - File descriptor for filelength - Number of bytes to allocate.java.io.IOException - IOExceptionpublic static void dumbDelete(java.io.File file)
throws java.io.IOException
WARNING: Java APIs do not let us distinguish directories from symbolic links to directories. Consequently, if the directory contains symbolic links to directories, we will attempt to delete the contents of pointed-to directories.
file - File or directory to deletejava.io.IOException - IOExceptionpublic static void mkdirOrThrow(java.io.File dir)
throws java.io.IOException
dir - Directory to create. All parents created as well.java.io.IOException - IOExceptionpublic static void fsyncAll(java.io.File fileName)
throws java.io.IOException
java.io.IOExceptionpublic static long getApkDepBlockLength(java.io.File apkFile)
throws java.io.IOException
apkFile - the apk filejava.io.IOException - IOExceptionpublic static byte[] makeApkDepBlock(java.io.File apkFile,
android.content.Context context)
throws java.io.IOException
getApkDepBlockLength(java.io.File) must also be
updated to reflect the expected size of the dep blockapkFile - apk filecontext - application contextjava.io.IOException - IOExceptionpublic static int getAppVersionCode(android.content.Context context)
public static boolean is64Bit()
public static boolean isSupportedDirectLoad(@Nullable
android.content.Context context,
int appType)
public static boolean isDisabledExtractNativeLibs(android.content.Context context)
@Nullable public static FileLocker getOrCreateLockOnDir(java.io.File soDirectory, java.io.File lockFileName) throws java.io.IOException
java.io.IOExceptionpublic static FileLocker getFileLocker(java.io.File lockFileName) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getBaseName(java.lang.String fileName)
fileName - full file name@Nullable
public static java.lang.String makeNonZipPath(@Nullable
java.lang.String localLdLibraryPath)
@Nullable public static java.lang.String getClassLoaderLdLoadLibrary()
@Nullable public static java.lang.reflect.Method getNativeLoadRuntimeMethod()