本文整理汇总了Java中com.android.ddmlib.MultiLineReceiver类的典型用法代码示例。如果您正苦于以下问题:Java MultiLineReceiver类的具体用法?Java MultiLineReceiver怎么用?Java MultiLineReceiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiLineReceiver类属于com.android.ddmlib包,在下文中一共展示了MultiLineReceiver类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.android.ddmlib.MultiLineReceiver; //导入依赖的package包/类
/**
* Inits the parser for a specific Device.
* <p/>
* This methods reads the event-log-tags located on the device to find out
* what tags are being written to the event log and what their format is.
* @param device The device.
* @return <code>true</code> if success, <code>false</code> if failure or cancellation.
*/
public boolean init(IDevice device) {
// read the event tag map file on the device.
try {
device.executeShellCommand("cat " + EVENT_TAG_MAP_FILE, //$NON-NLS-1$
new MultiLineReceiver() {
@Override
public void processNewLines(String[] lines) {
for (String line : lines) {
processTagLine(line);
}
}
@Override
public boolean isCancelled() {
return false;
}
});
} catch (Exception e) {
// catch all possible exceptions and return false.
return false;
}
return true;
}
示例2: getDeviceConfig
import com.android.ddmlib.MultiLineReceiver; //导入依赖的package包/类
@NonNull
@Override
public DeviceConfig getDeviceConfig() throws DeviceException {
final List<String> output = new ArrayList<String>();
final MultiLineReceiver receiver = new MultiLineReceiver() {
@Override
public void processNewLines(String[] lines) {
output.addAll(Arrays.asList(lines));
}
@Override
public boolean isCancelled() {
return false;
}
};
try {
executeShellCommand("am get-config", receiver, 5, TimeUnit.SECONDS);
return DeviceConfig.Builder.parse(output);
} catch (Exception e) {
throw new DeviceException(e);
}
}
示例3: loadDatabases
import com.android.ddmlib.MultiLineReceiver; //导入依赖的package包/类
@NotNull
private static List<String> loadDatabases(@NotNull IDevice device, @NotNull final String packageName) {
final List<String> result = new ArrayList<String>();
try {
device.executeShellCommand("run-as " + packageName + " ls " + AndroidDbUtil.getInternalDatabasesRemoteDirPath(packageName), new MultiLineReceiver() {
@Override
public void processNewLines(String[] lines) {
for (String line : lines) {
if (line.length() > 0 && !line.contains(" ")) {
result.add(line);
}
}
}
@Override
public boolean isCancelled() {
return false;
}
}, 2, TimeUnit.SECONDS);
}
catch (Exception e) {
LOG.debug(e);
}
return result;
}
示例4: init
import com.android.ddmlib.MultiLineReceiver; //导入依赖的package包/类
/**
* Inits the parser for a specific Device.
* <p/>
* This methods reads the event-log-tags located on the device to find out
* what tags are being written to the event log and what their format is.
* @param device The device.
* @return <code>true</code> if success, <code>false</code> if failure or cancellation.
*/
public boolean init(IDevice device) {
// read the event tag map file on the device.
try {
device.executeShellCommand("cat " + EVENT_TAG_MAP_FILE, //$NON-NLS-1$
new MultiLineReceiver() {
@Override
public void processNewLines(String[] lines) {
for (String line : lines) {
processTagLine(line);
}
}
public boolean isCancelled() {
return false;
}
});
} catch (Exception e) {
// catch all possible exceptions and return false.
return false;
}
return true;
}
示例5: setTrimLine
import com.android.ddmlib.MultiLineReceiver; //导入依赖的package包/类
static void setTrimLine(RemoteAndroidTestRunner runner, boolean value) {
try {
Field mParserField = RemoteAndroidTestRunner.class.getDeclaredField("mParser");
mParserField.setAccessible(true);
MultiLineReceiver multiLineReceiver = (MultiLineReceiver) mParserField.get(runner);
multiLineReceiver.setTrimLine(value);
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}