/** * Reads a single byte from the proxied input stream and writes it to * the associated output stream. * * @return next byte from the stream, or -1 if the stream has ended * @throws IOException if the stream could not be read (or written) */ @Override public int read() throws IOException { final int ch = super.read(); if (ch != EOF) { branch.write(ch); } return ch; }
/** * Reads bytes from the proxied input stream and writes the read bytes * to the associated output stream. * * @param bts byte buffer * @return number of bytes read, or -1 if the stream has ended * @throws IOException if the stream could not be read (or written) */ @Override public int read(final byte[] bts) throws IOException { final int n = super.read(bts); if (n != EOF) { branch.write(bts, 0, n); } return n; }
/** * Reads bytes from the proxied input stream and writes the read bytes * to the associated output stream. * * @param bts byte buffer * @param st start offset within the buffer * @param end maximum number of bytes to read * @return number of bytes read, or -1 if the stream has ended * @throws IOException if the stream could not be read (or written) */ @Override public int read(final byte[] bts, final int st, final int end) throws IOException { final int n = super.read(bts, st, end); if (n != -1) { branch.write(bts, st, n); } return n; }
/** * Reads the next byte of data adding to the count of bytes received * if a byte is successfully read. * * @return the byte read, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read() */ public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Reads a number of bytes into the byte array, keeping count of the * number read. * * @param b the buffer into which the data is read, not null * @return the total number of bytes read into the buffer, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read(byte[]) */ public int read(byte[] b) throws IOException { int found = super.read(b); this.count += (found >= 0) ? found : 0; return found; }
/** * Reads a number of bytes into the byte array at a specific offset, * keeping count of the number read. * * @param b the buffer into which the data is read, not null * @param off the start offset in the buffer * @param len the maximum number of bytes to read * @return the total number of bytes read into the buffer, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read(byte[], int, int) */ public int read(byte[] b, int off, int len) throws IOException { int found = super.read(b, off, len); this.count += (found >= 0) ? found : 0; return found; }
@Override public int read() throws IOException { int result = 0; IOException ioe = null; try { result = super.read(); } catch (final IOException pException) { ioe = pException; } if (ioe != null) { noteError(ioe); } else if (result == -1) { noteFinished(); } else { noteDataByte(result); } return result; }
@Override public int read(final byte[] pBuffer) throws IOException { int result = 0; IOException ioe = null; try { result = super.read(pBuffer); } catch (final IOException pException) { ioe = pException; } if (ioe != null) { noteError(ioe); } else if (result == -1) { noteFinished(); } else if (result > 0) { noteDataBytes(pBuffer, 0, result); } return result; }
@Override public int read(final byte[] pBuffer, final int pOffset, final int pLength) throws IOException { int result = 0; IOException ioe = null; try { result = super.read(pBuffer, pOffset, pLength); } catch (final IOException pException) { ioe = pException; } if (ioe != null) { noteError(ioe); } else if (result == -1) { noteFinished(); } else if (result > 0) { noteDataBytes(pBuffer, pOffset, result); } return result; }
/** * Reads the next byte of data adding to the count of bytes received * if a byte is successfully read. * * @return the byte read, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read() */ public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Reads a number of bytes into the byte array, keeping count of the * number read. * * @param b the buffer into which the data is read, not null * @return the total number of bytes read into the buffer, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read(byte[]) */ public int read(byte[] b) throws IOException { int found = super.read(b); this.count += (found >= 0) ? found : 0; return found; }
/** * Reads the next byte of data adding to the count of bytes received * if a byte is successfully read. * * @return the byte read, -1 if end of stream * @throws IOException if an I/O error occurs * @see java.io.InputStream#read() */ public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Reads a single byte from the proxied input stream and writes it to * the associated output stream. * * @return next byte from the stream, or -1 if the stream has ended * @throws IOException if the stream could not be read (or written) */ public int read() throws IOException { int ch = super.read(); if (ch != -1) { branch.write(ch); } return ch; }
public int read() throws IOException { if (remaining == 0) { throw exception = new IOException("Maximum number of bytes read"); } int b = super.read(); if (b == -1) { throw exception = new IOException("End of stream reached"); } remaining--; return b; }
public int read() throws IOException { if (remaining == 0) { throw new IOException("Maximum number of bytes read"); } int b = super.read(); if (b == -1) { throw new IOException("End of stream reached"); } remaining--; return b; }
@Override public int read(byte[] bts, int st, int end) throws IOException { int read = super.read(bts, st, end); eosSafeCountingRead(read); return read; }
@Override public int read() throws IOException { int readByte = super.read(); /* * the other read methods return the # bytes read, not the actual byte like this one does so * if we've reached EOS, we don't increment the counter, otherwise we do. */ eosSafeCountingRead(readByte < 0 ? 0 : 1); return readByte; }
@Override public int read(byte[] b, int off, int len) throws IOException { return (int) updateProgress(super.read(b, off, len)); }
@Override public int read() throws IOException { return (int) updateProgress(super.read()); }
@Override public int read(byte[] bts) throws IOException { int read = super.read(bts); eosSafeCountingRead(read); return read; }