private void loadFrom(InputStream in) throws IOException {
    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    byte[] buffer = new byte[8192];

    int count;
    while ((count = in.read(buffer)) != -1) {
      bytesOut.write(buffer, 0, count);
    }

    this.data = ByteBuffer.wrap(bytesOut.toByteArray());
    this.data.order(ByteOrder.LITTLE_ENDIAN);
    this.tableOfContents.readFrom(this);
  }
It is the caller's responsibility to close {@code in}.
android/android_framework/dex-maker/src/main/java/com/android/dex/Dex.java