@Test public void readOneByte() throws IOException { int c = -1; while ((c = in.read()) != -1) { buf[bytesRead++] = (byte) c; } Assert.assertArrayEquals(firstBytes, Arrays.copyOf(buf, bytesRead)); buf = new byte[256]; bytesRead = 0; c = -1; while ((c = in.read()) != -1) { buf[bytesRead++] = (byte) c; } Assert.assertArrayEquals(secondBytes, Arrays.copyOf(buf, bytesRead)); }
@Override public int read() throws IOException { if (readEOT) { readEOT = false; return -1; } int l = in.read(); if (l == EOT) { readEOT = true; } return l; }
EndOfTransmissionInputStream extends InputStream { @Override public int read() throws IOException { if (readEOT) { readEOT = false; return -1; } int l = in.read(); if (l == EOT) { readEOT = true; } return l; } }
EndOfTransmissionInputStream extends InputStream { @Override public int read() throws IOException { if (readEOT) { readEOT = false; return -1; } int l = in.read(); if (l == EOT) { readEOT = true; } return l; } EndOfTransmissionInputStream(InputStream in); }
EndOfTransmissionInputStream extends InputStream { @Override public int read() throws IOException { if (readEOT) { readEOT = false; return -1; } int l = in.read(); if (l == EOT) { readEOT = true; } return l; } EndOfTransmissionInputStream(InputStream in); @Override int read(); }
EndOfTransmissionInputStream extends InputStream { @Override public int read() throws IOException { if (readEOT) { readEOT = false; return -1; } int l = in.read(); if (l == EOT) { readEOT = true; } return l; } EndOfTransmissionInputStream(InputStream in); @Override int read();  }