public int read()

in java/com/facebook/soloader/ElfZipFileChannel.java [105:129]


  public int read(ByteBuffer dst, long position) throws IOException {
    if (mIs == null) {
      throw new IOException("InputStream is null");
    }

    int wanted = dst.remaining();
    long possible = mLength - position;
    if (possible <= 0) {
      return -1;
    }
    if (wanted > (int) possible) {
      wanted = (int) possible;
    }
    position(position);
    if (dst.hasArray()) {
      mIs.read(dst.array(), 0, wanted);
      dst.position(dst.position() + wanted);
    } else {
      byte[] bytes = new byte[wanted];
      mIs.read(bytes, 0, wanted);
      dst.put(bytes, 0, wanted);
    }
    mPos += wanted;
    return wanted;
  }