42 * @author Jonathan Payne 43 * @since 1.0 44 */ 45 public 46 class FilterInputStream extends InputStream { 47 /** 48 * The input stream to be filtered. 49 */ 50 protected volatile InputStream in; 51 52 /** 53 * Creates a <code>FilterInputStream</code> 54 * by assigning the argument <code>in</code> 55 * to the field <code>this.in</code> so as 56 * to remember it for later use. 57 * 58 * @param in the underlying input stream, or <code>null</code> if 59 * this instance is to be created without an underlying stream. 60 */ 61 protected FilterInputStream(InputStream in) { 62 if (in == null) { 63 throw new NullPointerException(); 64 } 65 this.in = in; 66 } 67 68 /** 69 * Reads the next byte of data from this input stream. The value 70 * byte is returned as an <code>int</code> in the range 71 * <code>0</code> to <code>255</code>. If no byte is available 72 * because the end of the stream has been reached, the value 73 * <code>-1</code> is returned. This method blocks until input data 74 * is available, the end of the stream is detected, or an exception 75 * is thrown. 76 * <p> 77 * This method 78 * simply performs <code>in.read()</code> and returns the result. 79 * 80 * @return the next byte of data, or <code>-1</code> if the end of the 81 * stream is reached. 82 * @exception IOException if an I/O error occurs. 83 * @see java.io.FilterInputStream#in 84 */ | 42 * @author Jonathan Payne 43 * @since 1.0 44 */ 45 public 46 class FilterInputStream extends InputStream { 47 /** 48 * The input stream to be filtered. 49 */ 50 protected volatile InputStream in; 51 52 /** 53 * Creates a <code>FilterInputStream</code> 54 * by assigning the argument <code>in</code> 55 * to the field <code>this.in</code> so as 56 * to remember it for later use. 57 * 58 * @param in the underlying input stream, or <code>null</code> if 59 * this instance is to be created without an underlying stream. 60 */ 61 protected FilterInputStream(InputStream in) { 62 this.in = in; 63 } 64 65 /** 66 * Reads the next byte of data from this input stream. The value 67 * byte is returned as an <code>int</code> in the range 68 * <code>0</code> to <code>255</code>. If no byte is available 69 * because the end of the stream has been reached, the value 70 * <code>-1</code> is returned. This method blocks until input data 71 * is available, the end of the stream is detected, or an exception 72 * is thrown. 73 * <p> 74 * This method 75 * simply performs <code>in.read()</code> and returns the result. 76 * 77 * @return the next byte of data, or <code>-1</code> if the end of the 78 * stream is reached. 79 * @exception IOException if an I/O error occurs. 80 * @see java.io.FilterInputStream#in 81 */ |