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 |
dumbDeleteRecursive(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 |
fsyncRecursive(java.io.File fileName) |
static long |
getApkDepBlockLength(java.io.File apkFile) |
static int |
getAppVersionCode(Context context) |
static java.lang.String |
getBaseName(java.lang.String fileName)
Gets the base name, without extension, of given file name.
|
static FileLocker |
getOrCreateLockOnDir(java.io.File soDirectory,
java.io.File lockFileName,
boolean blocking) |
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(Context context) |
static boolean |
isSupportedDirectLoad(Context context,
int appType) |
static byte[] |
makeApkDepBlock(java.io.File apkFile,
Context context) |
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.IOExceptionpublic static void dumbDeleteRecursive(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.IOExceptionpublic static void mkdirOrThrow(java.io.File dir)
throws java.io.IOException
dir - Directory to create. All parents created as well.java.io.IOExceptionpublic static void fsyncRecursive(java.io.File fileName)
throws java.io.IOException
java.io.IOExceptionpublic static long getApkDepBlockLength(java.io.File apkFile)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] makeApkDepBlock(java.io.File apkFile,
Context context)
throws java.io.IOException
java.io.IOExceptionpublic static int getAppVersionCode(Context context)
public static boolean is64Bit()
public static boolean isSupportedDirectLoad(Context context,
int appType)
throws java.io.IOException
java.io.IOExceptionpublic static boolean isDisabledExtractNativeLibs(Context context)
public static FileLocker getOrCreateLockOnDir(java.io.File soDirectory, java.io.File lockFileName, boolean blocking) throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String getBaseName(java.lang.String fileName)