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


Java LogReceiver类代码示例

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


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

示例1: runLocalEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs an event log service out of a local file.
 * @param fileName the full file name of the local file containing the event log.
 * @param logReceiver the receiver that will handle the log
 * @throws IOException
 */
@WorkerThread
private void runLocalEventLogService(String fileName, LogReceiver logReceiver)
        throws IOException {
    byte[] buffer = new byte[256];

    FileInputStream fis = new FileInputStream(fileName);
    try {
        int count;
        while ((count = fis.read(buffer)) != -1) {
            logReceiver.parseNewData(buffer, 0, count);
        }
    } finally {
        fis.close();
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:22,代码来源:EventLogPanel.java

示例2: runEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver arg0)
    throws TimeoutException,
        AdbCommandRejectedException,
        IOException {
    // TODO Auto-generated method stub

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:9,代码来源:ShellCommandExecutorTest.java

示例3: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runLogService(String arg0, LogReceiver arg1)
    throws TimeoutException,
        AdbCommandRejectedException,
        IOException {
    // TODO Auto-generated method stub

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:9,代码来源:ShellCommandExecutorTest.java

示例4: runLocalEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs an event log service out of a local file.
 * @param fileName the full file name of the local file containing the event log.
 * @param logReceiver the receiver that will handle the log
 * @throws IOException
 */
@WorkerThread
private void runLocalEventLogService(String fileName, LogReceiver logReceiver)
        throws IOException {
    byte[] buffer = new byte[256];

    FileInputStream fis = new FileInputStream(fileName);

    int count;
    while ((count = fis.read(buffer)) != -1) {
        logReceiver.parseNewData(buffer, 0, count);
    }
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:19,代码来源:EventLogPanel.java

示例5: stopLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
private void stopLogService(final IDevice device) {
    ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        @Override
        public void run() {
            LogReceiver service = logServices.remove(device);
            if (service != null) {
                service.cancel();
            }
        }
    });
}
 
开发者ID:willowtreeapps,项目名称:resPeeker,代码行数:12,代码来源:ResPeekerToolWindowFactory.java

示例6: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs a log service on the {@link com.android.ddmlib.Device}, and provides its output to the {@link LogReceiver}.
 * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true.
 *
 * @param adbSockAddr the socket address to connect to adb
 * @param device      the Device on which to run the service
 * @param logName     the name of the log file to output
 * @param rcvr        the {@link LogReceiver} to receive the log output
 * @throws TimeoutException            in case of timeout on the connection.
 * @throws AdbCommandRejectedException if adb rejects the command
 * @throws IOException                 in case of I/O error on the connection.
 */
static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName, LogReceiver rcvr)
        throws TimeoutException, AdbCommandRejectedException, IOException {

    SocketChannel adbChan = null;

    try {
        adbChan = SocketChannel.open(adbSockAddr);
        adbChan.configureBlocking(false);

        // if the device is not -1, then we first tell adb we're looking to talk
        // to a specific device
        setDevice(adbChan, device);

        byte[] request = formAdbRequest("log:" + logName);
        write(adbChan, request);

        AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */);
        if (!resp.okay) {
            throw new AdbCommandRejectedException(resp.message);
        }

        byte[] data = new byte[16384];
        ByteBuffer buf = ByteBuffer.wrap(data);
        while (true) {
            int count;

            if (rcvr != null && rcvr.isCancelled()) {
                break;
            }

            count = adbChan.read(buf);
            if (count < 0) {
                break;
            } else if (count == 0) {
                try {
                    Thread.sleep(WAIT_TIME * 5);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    // Throw a timeout exception in place of interrupted exception to avoid API changes.
                    throw new TimeoutException(
                            "runLogService interrupted with immediate timeout via interruption.");
                }
            } else {
                if (rcvr != null) {
                    rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position());
                }
                buf.rewind();
            }
        }
    } finally {
        if (adbChan != null) {
            //noinspection ThrowFromFinallyBlock
            adbChan.close();
        }
    }
}
 
开发者ID:rock3r,项目名称:framer,代码行数:69,代码来源:AdbHelper.java

示例7: runEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver receiver)
        throws TimeoutException, AdbCommandRejectedException, IOException {
    AdbHelper.runEventLogService(AndroidDebugBridge.getSocketAddress(), this, receiver);
}
 
开发者ID:rock3r,项目名称:framer,代码行数:6,代码来源:Device.java

示例8: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runLogService(String logname, LogReceiver receiver)
        throws TimeoutException, AdbCommandRejectedException, IOException {
    AdbHelper.runLogService(AndroidDebugBridge.getSocketAddress(), this, logname, receiver);
}
 
开发者ID:rock3r,项目名称:framer,代码行数:6,代码来源:Device.java

示例9: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs a log service on the {@link Device}, and provides its output to the {@link LogReceiver}.
 * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true.
 * @param adbSockAddr the socket address to connect to adb
 * @param device the Device on which to run the service
 * @param logName the name of the log file to output
 * @param rcvr the {@link LogReceiver} to receive the log output
 * @throws TimeoutException in case of timeout on the connection.
 * @throws AdbCommandRejectedException if adb rejects the command
 * @throws IOException in case of I/O error on the connection.
 */
public static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName,
        LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException {
    SocketChannel adbChan = null;

    try {
        adbChan = SocketChannel.open(adbSockAddr);
        adbChan.configureBlocking(false);

        // if the device is not -1, then we first tell adb we're looking to talk
        // to a specific device
        setDevice(adbChan, device);

        byte[] request = formAdbRequest("log:" + logName);
        write(adbChan, request);

        AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */);
        if (!resp.okay) {
            throw new AdbCommandRejectedException(resp.message);
        }

        byte[] data = new byte[16384];
        ByteBuffer buf = ByteBuffer.wrap(data);
        while (true) {
            int count;

            if (rcvr != null && rcvr.isCancelled()) {
                break;
            }

            count = adbChan.read(buf);
            if (count < 0) {
                break;
            } else if (count == 0) {
                try {
                    Thread.sleep(WAIT_TIME * 5);
                } catch (InterruptedException ie) {
                }
            } else {
                if (rcvr != null) {
                    rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position());
                }
                buf.rewind();
            }
        }
    } finally {
        if (adbChan != null) {
            adbChan.close();
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:62,代码来源:AdbHelper.java

示例10: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs a log service on the {@link Device}, and provides its output to the {@link LogReceiver}.
 * <p/>This call is blocking until {@link LogReceiver#isCancelled()} returns true.
 * @param adbSockAddr the socket address to connect to adb
 * @param device the Device on which to run the service
 * @param logName the name of the log file to output
 * @param rcvr the {@link LogReceiver} to receive the log output
 * @throws TimeoutException in case of timeout on the connection.
 * @throws AdbCommandRejectedException if adb rejects the command
 * @throws IOException in case of I/O error on the connection.
 */
public static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName,
        LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException {
    SocketChannel adbChan = null;

    try {
        adbChan = SocketChannel.open(adbSockAddr);
        adbChan.configureBlocking(false);

        // if the device is not -1, then we first tell adb we're looking to talk
        // to a specific device
        setDevice(adbChan, device);

        byte[] request = formAdbRequest("log:" + logName);
        write(adbChan, request);

        AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */);
        if (resp.okay == false) {
            throw new AdbCommandRejectedException(resp.message);
        }

        byte[] data = new byte[16384];
        ByteBuffer buf = ByteBuffer.wrap(data);
        while (true) {
            int count;

            if (rcvr != null && rcvr.isCancelled()) {
                break;
            }

            count = adbChan.read(buf);
            if (count < 0) {
                break;
            } else if (count == 0) {
                try {
                    Thread.sleep(WAIT_TIME * 5);
                } catch (InterruptedException ie) {
                }
            } else {
                if (rcvr != null) {
                    rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position());
                }
                buf.rewind();
            }
        }
    } finally {
        if (adbChan != null) {
            adbChan.close();
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:62,代码来源:AdbHelper.java

示例11: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
/**
 * Runs a log service on the {@link Device}, and provides its output to the
 * {@link LogReceiver}.
 * <p/>
 * This call is blocking until {@link LogReceiver#isCancelled()} returns
 * true.
 * 
 * @param adbSockAddr
 *            the socket address to connect to adb
 * @param device
 *            the Device on which to run the service
 * @param logName
 *            the name of the log file to output
 * @param rcvr
 *            the {@link LogReceiver} to receive the log output
 * @throws TimeoutException
 *             in case of timeout on the connection.
 * @throws AdbCommandRejectedException
 *             if adb rejects the command
 * @throws IOException
 *             in case of I/O error on the connection.
 */
public static void runLogService(InetSocketAddress adbSockAddr, Device device, String logName,
        LogReceiver rcvr) throws TimeoutException, AdbCommandRejectedException, IOException {
    SocketChannel adbChan = null;

    try {
        adbChan = SocketChannel.open(adbSockAddr);
        adbChan.configureBlocking(false);

        // if the device is not -1, then we first tell adb we're looking to
        // talk
        // to a specific device
        setDevice(adbChan, device);

        byte[] request = formAdbRequest("log:" + logName);
        write(adbChan, request);

        AdbResponse resp = readAdbResponse(adbChan, false /* readDiagString */);
        if (resp.okay == false) {
            throw new AdbCommandRejectedException(resp.message);
        }

        byte[] data = new byte[16384];
        ByteBuffer buf = ByteBuffer.wrap(data);
        while (true) {
            int count;

            if (rcvr != null && rcvr.isCancelled()) {
                break;
            }

            count = adbChan.read(buf);
            if (count < 0) {
                break;
            } else if (count == 0) {
                try {
                    Thread.sleep(WAIT_TIME * 5);
                } catch (InterruptedException ie) {}
            } else {
                if (rcvr != null) {
                    rcvr.parseNewData(buf.array(), buf.arrayOffset(), buf.position());
                }
                buf.rewind();
            }
        }
    } finally {
        if (adbChan != null) {
            adbChan.close();
        }
    }
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:73,代码来源:AdbHelper.java

示例12: runEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver receiver) throws TimeoutException,
        AdbCommandRejectedException, IOException {
    AdbHelper.runEventLogService(AndroidDebugBridge.getSocketAddress(), this, receiver);
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:6,代码来源:Device.java

示例13: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runLogService(String logname, LogReceiver receiver) throws TimeoutException,
        AdbCommandRejectedException, IOException {
    AdbHelper.runLogService(AndroidDebugBridge.getSocketAddress(), this, logname, receiver);
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:6,代码来源:Device.java

示例14: runEventLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver logReceiver) throws TimeoutException,
    AdbCommandRejectedException, IOException {
  throw new UnsupportedOperationException();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:6,代码来源:TestDevice.java

示例15: runLogService

import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runLogService(String s, LogReceiver logReceiver) throws TimeoutException,
    AdbCommandRejectedException, IOException {
  throw new UnsupportedOperationException();
}
 
开发者ID:saleehk,项目名称:buck-cutom,代码行数:6,代码来源:TestDevice.java


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