@Test public void testRead() throws IOException { UnsafeByteArrayInputStream stream = new UnsafeByteArrayInputStream("abc".getBytes()); assertThat(stream.read(), is((int) 'a')); assertThat(stream.available(), is(2)); stream.skip(1); assertThat(stream.available(), is(1)); byte[] bytes = new byte[1]; int read = stream.read(bytes); assertThat(read, is(1)); assertThat(bytes, is("c".getBytes())); stream.reset(); assertThat(stream.position(), is(0)); assertThat(stream.size(), is(3)); stream.position(1); assertThat(stream.read(), is((int) 'b')); }
@Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; }
UnsafeByteArrayInputStream extends InputStream { @Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; } }
UnsafeByteArrayInputStream extends InputStream { @Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; } UnsafeByteArrayInputStream(byte buf[]);  UnsafeByteArrayInputStream(byte buf[], int offset);  UnsafeByteArrayInputStream(byte buf[], int offset, int length); }
UnsafeByteArrayInputStream extends InputStream { @Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; } 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(); }
UnsafeByteArrayInputStream extends InputStream { @Override public int read() { return (mPosition < mLimit) ? (mData[mPosition++] & 0xff) : -1; } 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();  }