/** * Invokes the delegate's <code>read()</code> method. * @return the byte read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read() throws IOException { try { beforeRead(1); int b = in.read(); afterRead(b != -1 ? 1 : -1); return b; } catch (IOException e) { handleIOException(e); return -1; } }
/** * 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() */ @Override public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Skips the stream over the specified number of bytes, adding the skipped * amount to the count. * * @param length the number of bytes to skip * @return the actual number of bytes skipped * @throws IOException if an I/O error occurs * @see java.io.InputStream#skip(long) */ @Override public long skip(final long length) throws IOException { final long skip = super.skip(length); this.count += skip; return skip; }
/** * Invokes the delegate's <code>close()</code> method. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { try { in.close(); } catch (IOException e) { handleIOException(e); } }
/** * Invokes the delegate's <code>reset()</code> method. * @throws IOException if an I/O error occurs */ @Override public synchronized void reset() throws IOException { try { in.reset(); } catch (IOException e) { handleIOException(e); } }
/** * Invokes the delegate's <code>read(byte[])</code> method. * @param bts the buffer to read the bytes into * @return the number of bytes read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read(byte[] bts) throws IOException { try { beforeRead(bts.length); int n = in.read(bts); afterRead(n); return n; } catch (IOException e) { handleIOException(e); return -1; } }
/** * Invokes the delegate's <code>skip(long)</code> method. * @param ln the number of bytes to skip * @return the actual number of bytes skipped * @throws IOException if an I/O error occurs */ @Override public long skip(long ln) throws IOException { try { return in.skip(ln); } catch (IOException e) { handleIOException(e); return 0; } }
/** * 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[]) */ @Override public int read(byte[] b) throws IOException { int found = super.read(b); this.count += (found >= 0) ? found : 0; return found; }
/** * Skips the stream over the specified number of bytes, adding the skipped * amount to the count. * * @param length the number of bytes to skip * @return the actual number of bytes skipped * @throws IOException if an I/O error occurs * @see java.io.InputStream#skip(long) */ @Override public long skip(final long length) throws IOException { final long skip = super.skip(length); this.count += skip; return skip; }
/** * Invokes the delegate's <code>read(byte[], int, int)</code> method. * @param bts the buffer to read the bytes into * @param off The start offset * @param len The number of bytes to read * @return the number of bytes read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read(byte[] bts, int off, int len) throws IOException { try { beforeRead(len); int n = in.read(bts, off, len); afterRead(n); return n; } catch (IOException e) { handleIOException(e); return -1; } }
/** * Invokes the delegate's <code>available()</code> method. * @return the number of available bytes * @throws IOException if an I/O error occurs */ @Override public int available() throws IOException { try { return super.available(); } catch (IOException e) { handleIOException(e); return 0; } }
/** * 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) */ @Override 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; }
/** * Skips the stream over the specified number of bytes, adding the skipped * amount to the count. * * @param length the number of bytes to skip * @return the actual number of bytes skipped * @throws IOException if an I/O error occurs * @see java.io.InputStream#skip(long) */ @Override public long skip(final long length) throws IOException { final long skip = super.skip(length); this.count += skip; return skip; }
/** * Invokes the delegate's <code>read()</code> method. * @return the byte read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read() throws IOException { try { beforeRead(1); int b = in.read(); afterRead(b != -1 ? 1 : -1); return b; } catch (IOException e) { handleIOException(e); return -1; } }
/** * Invokes the delegate's <code>close()</code> method. * @throws IOException if an I/O error occurs */ @Override public void close() throws IOException { try { in.close(); } catch (IOException e) { handleIOException(e); } }
/** * 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() */ @Override public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Invokes the delegate's <code>read(byte[])</code> method. * @param bts the buffer to read the bytes into * @return the number of bytes read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read(byte[] bts) throws IOException { try { beforeRead(bts.length); int n = in.read(bts); afterRead(n); return n; } catch (IOException e) { handleIOException(e); return -1; } }
/** * Invokes the delegate's <code>reset()</code> method. * @throws IOException if an I/O error occurs */ @Override public synchronized void reset() throws IOException { try { in.reset(); } catch (IOException e) { handleIOException(e); } }
/** * 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() */ @Override public int read() throws IOException { int found = super.read(); this.count += (found >= 0) ? 1 : 0; return found; }
/** * Invokes the delegate's <code>read()</code> method. * @return the byte read or -1 if the end of stream * @throws IOException if an I/O error occurs */ @Override public int read() throws IOException { try { beforeRead(1); int b = in.read(); afterRead(b != -1 ? 1 : -1); return b; } catch (IOException e) { handleIOException(e); return -1; } }