@Test public void chunkWith0xFFValue() { final byte[] bytes = new byte[]{ 0, 1, 2, 3, 4, 5, 6, (byte) 0xFF, 7, 8, 9, 10 }; InputStream is = new DataChunkInputStream( new DataChunkPublisher( new DataChunk[]{DataChunk.create(bytes)})); try { byte[] readBytes = new byte[bytes.length]; is.read(readBytes); if (!Arrays.equals(bytes, readBytes)) { fail("expected: " + Arrays.toString(bytes) + ", actual: " + Arrays.toString(readBytes)); } } catch (IOException ex) { fail(ex); } }
@Override public int read() throws IOException { if (oneByte == null) { oneByte = new byte[1]; } int r = read(oneByte, 0, 1); if (r < 0) { return r; } return oneByte[0] & 0xFF; }
DataChunkInputStream extends InputStream { @Override public int read() throws IOException { if (oneByte == null) { oneByte = new byte[1]; } int r = read(oneByte, 0, 1); if (r < 0) { return r; } return oneByte[0] & 0xFF; } }
DataChunkInputStream extends InputStream { @Override public int read() throws IOException { if (oneByte == null) { oneByte = new byte[1]; } int r = read(oneByte, 0, 1); if (r < 0) { return r; } return oneByte[0] & 0xFF; } DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher);  DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate); }
DataChunkInputStream extends InputStream { @Override public int read() throws IOException { if (oneByte == null) { oneByte = new byte[1]; } int r = read(oneByte, 0, 1); if (r < 0) { return r; } return oneByte[0] & 0xFF; } DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher);  DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate); @Override void close(); @Override int read(); @Override int read(byte[] buf, int off, int len); }
DataChunkInputStream extends InputStream { @Override public int read() throws IOException { if (oneByte == null) { oneByte = new byte[1]; } int r = read(oneByte, 0, 1); if (r < 0) { return r; } return oneByte[0] & 0xFF; } DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher);  DataChunkInputStream(Flow.Publisher<DataChunk> originalPublisher, boolean validate); @Override void close(); @Override int read(); @Override int read(byte[] buf, int off, int len);  }