@Test public void shouldCorrectlyConvertBytesToPositiveIntegers() { final byte[] data = { (byte)-1, 0 }; final DirectBuffer buffer = new UnsafeBuffer(data); final DirectBufferInputStream inputStream = new DirectBufferInputStream(buffer); assertEquals(inputStream.read(), 255); }
public int read() { int b = -1; if (position < length) { b = buffer.getByte(offset + position) & 0xFF; ++position; } return b; }
DirectBufferInputStream extends InputStream { public int read() { int b = -1; if (position < length) { b = buffer.getByte(offset + position) & 0xFF; ++position; } return b; } }
DirectBufferInputStream extends InputStream { public int read() { int b = -1; if (position < length) { b = buffer.getByte(offset + position) & 0xFF; ++position; } return b; } DirectBufferInputStream();  DirectBufferInputStream(final DirectBuffer buffer);  DirectBufferInputStream(final DirectBuffer buffer, final int offset, final int length); }
DirectBufferInputStream extends InputStream { public int read() { int b = -1; if (position < length) { b = buffer.getByte(offset + position) & 0xFF; ++position; } return b; } DirectBufferInputStream();  DirectBufferInputStream(final DirectBuffer buffer);  DirectBufferInputStream(final DirectBuffer buffer, final int offset, final int length); void wrap(final DirectBuffer buffer); void wrap(final DirectBuffer buffer, final int offset, final int length); int offset(); int length(); DirectBuffer buffer(); boolean markSupported(); int available(); long skip(final long n); int read(); int read(final byte[] dstBytes, final int dstOffset, final int length); void close(); }
DirectBufferInputStream extends InputStream { public int read() { int b = -1; if (position < length) { b = buffer.getByte(offset + position) & 0xFF; ++position; } return b; } DirectBufferInputStream();  DirectBufferInputStream(final DirectBuffer buffer);  DirectBufferInputStream(final DirectBuffer buffer, final int offset, final int length); void wrap(final DirectBuffer buffer); void wrap(final DirectBuffer buffer, final int offset, final int length); int offset(); int length(); DirectBuffer buffer(); boolean markSupported(); int available(); long skip(final long n); int read(); int read(final byte[] dstBytes, final int dstOffset, final int length); void close();  }