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;
  }
@Test
  public void testConstructWithEmptyArray() throws IOException {
    try (ExposedByteArrayInputStream s = new ExposedByteArrayInputStream(new byte[0])) {
      assertEquals(0, s.available());
      byte[] data = s.readAll();
      assertEquals(0, data.length);
    }
  }