@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }
@Override public int read(byte[] buffer, int byteOffset, int byteCount) throws IOException { if (closed) { throw new IOException("Stream is closed"); } if (eos) { return -1; } Arrays.checkOffsetAndCount(buffer.length, byteOffset, byteCount); int bytesRead; try { bytesRead = super.read(buffer, byteOffset, byteCount); } finally { eos = eof; // update eos after every read(), even when it throws } if (bytesRead != -1) { crc.update(buffer, byteOffset, bytesRead); } if (eos) { verifyCrc(); } return bytesRead; }