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


Java MultiLineReceiver类代码示例

本文整理汇总了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;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:EventLogParser.java

示例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);
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ConnectedDevice.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidDataSourcePropertiesDialog.java

示例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;
}
 
开发者ID:liuyq,项目名称:aster,代码行数:31,代码来源:EventLogParser.java

示例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);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:11,代码来源:InstrumentationTestRunner.java


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