PHP 正则转义序列

PHP正则转义字符-1

PHP正则转义字符-1

PHP正则转义字符-2

PHP正则转义字符-2

PHP正则转义字符-3

PHP正则转义字符-3

PHP正则转义字符-4

PHP正则转义字符-4

PHP 正则修饰符

PHP正则修饰符-1

PHP正则修饰符-1

PHP正则修饰符-2

PHP正则修饰符-2

PHP正则修饰符-3

PHP正则修饰符-3

PHP正则修饰符-4

PHP正则修饰符-4

PHP正则修饰符-5

PHP正则修饰符-5

sudo 环境变量设置

编辑 /etc/sudoers :

Defaults   env_reset
Defaults   secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

修改为:

#不重置sudo的环境变量,沿用当前用户的环境变量
Defaults    !env_reset
#Defaults   secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

Android Framework 重启系统代码

private void RebootIntoRecovery() {
        PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
        pm.reboot("recovery");
}
<uses-permission android:name="android.permission.REBOOT" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.android.settings"
        coreApp="true"
        android:sharedUserId="android.uid.system">

使用FileChannel拷贝文件

使用FileChannel拷贝文件的效率比逐字节拷贝要更高效,但是FileChannel有一个限制:操作的文件大小不能大于2GB

public void copy(File src, File dst) throws IOException {
    FileInputStream inStream = new FileInputStream(src);
    FileOutputStream outStream = new FileOutputStream(dst);
    FileChannel inChannel = inStream.getChannel();
    FileChannel outChannel = outStream.getChannel();
    inChannel.transferTo(0, inChannel.size(), outChannel);
    inStream.close();
    outStream.close();
}