class ExposedByteArrayInputStream extends ByteArrayInputStream {

  public byte[] readAll() throws IOException {
    if (pos == 0 && count == buf.length) {
      pos = count;
      return buf;
    }
    byte[] ret = new byte[count - pos];
    super.read(ret);
    return ret;
  }

  public  ExposedByteArrayInputStream(byte[] buf);

}