/** * Reads an error message from the opened {@link #mChannel}. * @param result the current adb result. Must contain both FAIL and the length of the message. * @param timeOut * @return * @throws TimeoutException in case of a timeout reading responses from the device. * @throws IOException */ private String readErrorMessage(byte[] result, final int timeOut) throws TimeoutException, IOException { if (checkResult(result, ID_FAIL)) { int len = ArrayHelper.swap32bitFromArray(result, 4); if (len > 0) { AdbHelper.read(mChannel, getBuffer(), len, timeOut); String message = new String(getBuffer(), 0, len); Log.e("ddms", "transfer error: " + message); return message; } } return null; }
/** * Reads an error message from the opened {@link #mChannel}. * @param result the current adb result. Must contain both FAIL and the length of the message. * @param timeOut * @return * @throws TimeoutException in case of a timeout reading responses from the device. * @throws IOException */ private String readErrorMessage(byte[] result, final int timeOut) throws TimeoutException, IOException { if (checkResult(result, ID_FAIL)) { int len = ArrayHelper.swap32bitFromArray(result, 4); if (len > 0) { AdbHelper.read(mChannel, getBuffer(), len, timeOut); String message = new String(getBuffer(), 0, len); Log.e("ddms", "transfer error: " + message); return message; } } return null; }