本文整理汇总了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();
}
}
示例2: runEventLogService
import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver arg0)
throws TimeoutException,
AdbCommandRejectedException,
IOException {
// TODO Auto-generated method stub
}
示例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
}
示例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);
}
}
示例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();
}
}
});
}
示例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();
}
}
}
示例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);
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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);
}
示例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);
}
示例14: runEventLogService
import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runEventLogService(LogReceiver logReceiver) throws TimeoutException,
AdbCommandRejectedException, IOException {
throw new UnsupportedOperationException();
}
示例15: runLogService
import com.android.ddmlib.log.LogReceiver; //导入依赖的package包/类
@Override
public void runLogService(String s, LogReceiver logReceiver) throws TimeoutException,
AdbCommandRejectedException, IOException {
throw new UnsupportedOperationException();
}