com.android.ddmlib.MultiLineReceiver Java Examples

The following examples show how to use com.android.ddmlib.MultiLineReceiver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DdmlibDevice.java    From bundletool with Apache License 2.0 6 votes vote down vote up
RemoteCommandExecutor(Device device, long timeout, PrintStream out) {
  this.device = device;
  this.timeout = timeout;
  this.out = out;
  this.receiver =
      new MultiLineReceiver() {
        @Override
        public void processNewLines(String[] lines) {
          for (String line : lines) {
            if (!line.isEmpty()) {
              out.println("ADB >> " + line);
              lastOutputLine = line;
            }
          }
        }

        @Override
        public boolean isCancelled() {
          return false;
        }
      };
}
 
Example #2
Source File: EventLogParser.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: InstrumentationTestRunner.java    From buck with Apache License 2.0 5 votes vote down vote up
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);
  }
}