Windows可清理文件夹
日志文件
C:\Windows\Logs\CBS
临时文件
C:\Windows\Temp
C:\Users\Administrator\AppData\Local\Temp
应用历史版本
C:\Users\Administrator\AppData\Local\Postman
C:\Users\Administrator\AppData\Local\kingsoft\WPS Office
阿里云盘缓存
C:\Users\Administrator\AppData\Roaming\aDrive\Partitions\adrive\blob_storage
C:\Users\Administrator\AppData\Roaming\aDrive\Partitions\adrive\Cache
AndroidAsync框架实现局域网通信
Java NIO 相关资料
Log抓取和分析-BugReport
Android File Descriptor(文件描述符)
抱歉,Xposed真的可以为所欲为
发丘摸金,搬山卸岭,跨进程传输大数据
Android TransactionTooLargeException 解析,思考与监控方案
Android获取Root权限和执行Shell脚本
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class ShellUtil {
/**
* 获取Root权限
*
* @return
*/
public static boolean getRoot() {
boolean res = false;
try {
Process process = Runtime.getRuntime().exec("su -c exit");
int exitValue = process.waitFor();
if (exitValue == 0) {
res = true;
}
exitProcess(process);
} catch (Exception e) {
e.printStackTrace();
}
return res;
}
/**
* 执行Shell命令(必须有Root权限)
*
* @param cmd
*/
public static String execShell(String cmd) {
StringBuffer sb = new StringBuffer();
try {
Process process = Runtime.getRuntime().exec("su -c " + cmd);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
reader.close();
exitProcess(process);
} catch (IOException e) {
e.printStackTrace();
}
return sb.toString();
}
/**
* 获取FD数量
*
* @return
*/
public static int getFDNumber() {
int res = 0;
try {
int pid = android.os.Process.myPid();
Process process = Runtime.getRuntime().exec("ls /proc/" + pid + "/fd");
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
while (reader.readLine() != null) {
res++;
}
reader.close();
exitProcess(process);
} catch (IOException e) {
e.printStackTrace();
}
return res;
}
/**
* 退出进程
*
* @param process
*/
private static void exitProcess(Process process) {
try {
if (process != null) {
process.exitValue();
}
} catch (IllegalThreadStateException e) {
process.destroy();
}
}
}