UnsafeByteArrayInputStream extends InputStream { @Override public void mark(int readAheadLimit) { mMark = mPosition; } UnsafeByteArrayInputStream(byte[] buf);  UnsafeByteArrayInputStream(byte[] buf, int offset);  UnsafeByteArrayInputStream(byte[] buf, int offset, int length); @Override int read(); @Override int read(byte[] b, int off, int len); @Override long skip(long len); @Override int available(); @Override boolean markSupported(); @Override void mark(int readAheadLimit); @Override void reset(); @Override void close(); int position(); void position(int newPosition); int size();  }
@Test public void testMark() { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes(), 1); assertThat(stream.markSupported(), is(true)); stream.mark(2); stream.read(); assertThat(stream.position(), is(2)); stream.reset(); assertThat(stream.position(), is(1)); }