当前位置: 首页>>代码示例>>Java>>正文


Java Command类代码示例

本文整理汇总了Java中com.stericson.RootTools.execution.Command的典型用法代码示例。如果您正苦于以下问题:Java Command类的具体用法?Java Command怎么用?Java Command使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Command类属于com.stericson.RootTools.execution包,在下文中一共展示了Command类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cleanDirectory

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
public void cleanDirectory() {
    for (final File file : mEmulatedDirectory.listFiles()) {
        Command mountCommand = new CommandCapture(0, "umount " + mMountDirectory.getAbsolutePath() + "/" + file.getName()) {
            @Override
            public void commandCompleted(int id, int exitcode) {
                super.commandCompleted(id, exitcode);
                file.delete();
            }
        };
        try {
            mRootShell.add(mountCommand);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:acomminos,项目名称:Mountie,代码行数:17,代码来源:Automounter.java

示例2: commandWait

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
private void commandWait(Command cmd) {
    int waitTill = 50;
    int waitTillMultiplier = 2;
    int waitTillLimit = 3200; //7 tries, 6350 msec

    while (!cmd.isFinished() && waitTill<=waitTillLimit) {
        synchronized (cmd) {
            try {
                if (!cmd.isFinished()) {
                    cmd.wait(waitTill);
                    waitTill *= waitTillMultiplier;
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    if (!cmd.isFinished()){
        LogUtils.e("Could not finish root command in " + (waitTill/waitTillMultiplier));
    }
}
 
开发者ID:olunx,项目名称:xMan,代码行数:22,代码来源:IDeviceHelper.java

示例3: waitForCommand

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
private static boolean waitForCommand(Command cmd)
{
    while (!cmd.isFinished())
    {
        synchronized (cmd)
        {
            try
            {
                if (!cmd.isFinished())
                {
                    cmd.wait(2000);
                }
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }

        if (!cmd.isExecuting() && !cmd.isFinished())
        {
            //         Logger.errorST("Error: Command is not executing and is not finished!");
            return false;
        }
    }

    //Logger.debug("Command Finished!");
    return true;
}
 
开发者ID:DeFuture,项目名称:AmazeFileManager-master,代码行数:30,代码来源:RootHelper.java

示例4: getMAC

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
public static String getMAC() {
    final String[] result = {"deadbebe"};
    Command command = new Command(0, "busybox ip addr show dev wlan0") {
        @Override
        public void output(int id, String line) {
            if (line.contains("link/ether")) {
                String[] split = line.trim().split(" ");
                System.out.println("MAC - " + split[1]);
                result[0] = split[1];
            }
        }
    };
    runCmd(command);
    return result[0];
}
 
开发者ID:moosd,项目名称:NetworkGhost,代码行数:16,代码来源:Util.java

示例5: getHost

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
public static String getHost() {
    final String[] result = {"deadbebe"};
    Command command = new Command(0, "getprop net.hostname") {
        @Override
        public void output(int id, String line) {
            result[0] = line;
        }
    };
    runCmd(command);
    return result[0];
}
 
开发者ID:moosd,项目名称:NetworkGhost,代码行数:12,代码来源:Util.java

示例6: unmount

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
public void unmount(Shell shell, final UnmountListener listener) throws IOException {
    Command mountCommand = new CommandCapture(0, "umount " + getTarget()) {
        @Override
        public void commandCompleted(int id, int exitcode) {
            super.commandCompleted(id, exitcode);
            if (exitcode == 0) {
                getDevice().removeMount(Mount.this);
                listener.onUnmountSuccess(Mount.this);
            } else {
                listener.onUnmountError(Mount.this, null);
            }
        }
    };
    shell.add(mountCommand);
}
 
开发者ID:acomminos,项目名称:Mountie,代码行数:16,代码来源:Mount.java

示例7: commandWait

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
private void commandWait(Command cmd) {
    synchronized (cmd) {
        try {
            if (!cmd.isFinished()) {
                cmd.wait(2000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:acomminos,项目名称:Mountie,代码行数:12,代码来源:Runner.java

示例8: commandWait

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
private void commandWait(Command cmd) {
    synchronized (cmd) {
        try {
            if (!cmd.isFinished()) {
                cmd.wait(2000);
            }
        } catch (InterruptedException ex) {
            Log.e(LOG_TAG, ex.toString());
        }
    }
}
 
开发者ID:acomminos,项目名称:Mountie,代码行数:12,代码来源:Installer.java

示例9: commandWait

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
protected void commandWait(Command cmd) throws Exception {
    while (!cmd.isFinished()) {
        synchronized (cmd) {
            try {
                if (!cmd.isFinished()) {
                    cmd.wait(10);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:shaun2029,项目名称:Multi-Core-Control,代码行数:14,代码来源:SysfsInterface.java

示例10: CommandNoOutput

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
public static void CommandNoOutput(String Command) throws RootDeniedException , IOException, TimeoutException, InterruptedException{
    CommandCapture command = new CommandCapture(0, Command);
    RootTools.getShell(true).add(command).wait();
}
 
开发者ID:p0isonra1n,项目名称:OmniRomOTA,代码行数:5,代码来源:RootCommands.java

示例11: runShellCommand

import com.stericson.RootTools.execution.Command; //导入依赖的package包/类
/**
 * Executes a given command with root access or without depending on the value of the boolean passed.
 * This will also start a root shell or a standard shell without you having to open it specifically.
 * <p/>
 * You will still need to close the shell after you are done using the shell.
 *
 * @param shell   The shell to execute the command on, this can be a root shell or a standard shell.
 * @param command The command to execute in the shell
 * @throws IOException
 */
public static void runShellCommand(Shell shell, Command command) throws IOException {
    shell.add(command);
}
 
开发者ID:acomminos,项目名称:Mountie,代码行数:14,代码来源:RootTools.java


注:本文中的com.stericson.RootTools.execution.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。