public static BytesInput from(InputStream in, int bytes) {
    return new StreamBytesInput(in, bytes);
  }
@Test
  public void testFromByteArrayOutputStream() throws IOException {
    byte[] data = new byte[1000];
    RANDOM.nextBytes(data);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    baos.write(data);
    Supplier<BytesInput> factory = () -> BytesInput.from(baos);

    validate(data, factory);
  }