< prev index next >

src/java.base/share/classes/java/io/FilterInputStream.java

Print this page




  86     /**
  87      * Reads up to <code>b.length</code> bytes of data from this
  88      * input stream into an array of bytes. This method blocks until some
  89      * input is available.
  90      * <p>
  91      * This method simply performs the call
  92      * <code>read(b, 0, b.length)</code> and returns
  93      * the  result. It is important that it does
  94      * <i>not</i> do <code>in.read(b)</code> instead;
  95      * certain subclasses of  <code>FilterInputStream</code>
  96      * depend on the implementation strategy actually
  97      * used.
  98      *
  99      * @param      b   the buffer into which the data is read.
 100      * @return     the total number of bytes read into the buffer, or
 101      *             <code>-1</code> if there is no more data because the end of
 102      *             the stream has been reached.
 103      * @exception  IOException  if an I/O error occurs.
 104      * @see        java.io.FilterInputStream#read(byte[], int, int)
 105      */
 106     public int read(byte b[]) throws IOException {
 107         return read(b, 0, b.length);
 108     }
 109 
 110     /**
 111      * Reads up to <code>len</code> bytes of data from this input stream
 112      * into an array of bytes. If <code>len</code> is not zero, the method
 113      * blocks until some input is available; otherwise, no
 114      * bytes are read and <code>0</code> is returned.
 115      * <p>
 116      * This method simply performs <code>in.read(b, off, len)</code>
 117      * and returns the result.
 118      *
 119      * @param      b     the buffer into which the data is read.
 120      * @param      off   the start offset in the destination array <code>b</code>
 121      * @param      len   the maximum number of bytes read.
 122      * @return     the total number of bytes read into the buffer, or
 123      *             <code>-1</code> if there is no more data because the end of
 124      *             the stream has been reached.
 125      * @exception  NullPointerException If <code>b</code> is <code>null</code>.
 126      * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
 127      * <code>len</code> is negative, or <code>len</code> is greater than
 128      * <code>b.length - off</code>
 129      * @exception  IOException  if an I/O error occurs.
 130      * @see        java.io.FilterInputStream#in
 131      */
 132     public int read(byte b[], int off, int len) throws IOException {
 133         return in.read(b, off, len);
 134     }
 135 
 136     /**
 137      * Skips over and discards <code>n</code> bytes of data from the
 138      * input stream. The <code>skip</code> method may, for a variety of
 139      * reasons, end up skipping over some smaller number of bytes,
 140      * possibly <code>0</code>. The actual number of bytes skipped is
 141      * returned.
 142      * <p>
 143      * This method simply performs <code>in.skip(n)</code>.
 144      *
 145      * @param      n   the number of bytes to be skipped.
 146      * @return     the actual number of bytes skipped.
 147      * @throws     IOException  if {@code in.skip(n)} throws an IOException.
 148      */
 149     public long skip(long n) throws IOException {
 150         return in.skip(n);
 151     }
 152 




  86     /**
  87      * Reads up to <code>b.length</code> bytes of data from this
  88      * input stream into an array of bytes. This method blocks until some
  89      * input is available.
  90      * <p>
  91      * This method simply performs the call
  92      * <code>read(b, 0, b.length)</code> and returns
  93      * the  result. It is important that it does
  94      * <i>not</i> do <code>in.read(b)</code> instead;
  95      * certain subclasses of  <code>FilterInputStream</code>
  96      * depend on the implementation strategy actually
  97      * used.
  98      *
  99      * @param      b   the buffer into which the data is read.
 100      * @return     the total number of bytes read into the buffer, or
 101      *             <code>-1</code> if there is no more data because the end of
 102      *             the stream has been reached.
 103      * @exception  IOException  if an I/O error occurs.
 104      * @see        java.io.FilterInputStream#read(byte[], int, int)
 105      */
 106     public int read(byte[] b) throws IOException {
 107         return read(b, 0, b.length);
 108     }
 109 
 110     /**
 111      * Reads up to <code>len</code> bytes of data from this input stream
 112      * into an array of bytes. If <code>len</code> is not zero, the method
 113      * blocks until some input is available; otherwise, no
 114      * bytes are read and <code>0</code> is returned.
 115      * <p>
 116      * This method simply performs <code>in.read(b, off, len)</code>
 117      * and returns the result.
 118      *
 119      * @param      b     the buffer into which the data is read.
 120      * @param      off   the start offset in the destination array <code>b</code>
 121      * @param      len   the maximum number of bytes read.
 122      * @return     the total number of bytes read into the buffer, or
 123      *             <code>-1</code> if there is no more data because the end of
 124      *             the stream has been reached.
 125      * @exception  NullPointerException If <code>b</code> is <code>null</code>.
 126      * @exception  IndexOutOfBoundsException If <code>off</code> is negative,
 127      * <code>len</code> is negative, or <code>len</code> is greater than
 128      * <code>b.length - off</code>
 129      * @exception  IOException  if an I/O error occurs.
 130      * @see        java.io.FilterInputStream#in
 131      */
 132     public int read(byte[] b, int off, int len) throws IOException {
 133         return in.read(b, off, len);
 134     }
 135 
 136     /**
 137      * Skips over and discards <code>n</code> bytes of data from the
 138      * input stream. The <code>skip</code> method may, for a variety of
 139      * reasons, end up skipping over some smaller number of bytes,
 140      * possibly <code>0</code>. The actual number of bytes skipped is
 141      * returned.
 142      * <p>
 143      * This method simply performs <code>in.skip(n)</code>.
 144      *
 145      * @param      n   the number of bytes to be skipped.
 146      * @return     the actual number of bytes skipped.
 147      * @throws     IOException  if {@code in.skip(n)} throws an IOException.
 148      */
 149     public long skip(long n) throws IOException {
 150         return in.skip(n);
 151     }
 152 


< prev index next >