/** * Skips over and discards n bytes of data from this stream. */ public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Skips over and discards n bytes of data from this stream. */ @Override public long skip(long n) throws IOException { long skipped = 0; while (n-- > 0 && read() >= 0) skipped++; return skipped; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }
/** * Reads up to <code>len</code> decoded bytes of data from this input stream * into an array of bytes. This method blocks until some input is * available. * <p> * * @param buf the buffer into which the data is read. * @param off the start offset of the data. * @param len the maximum number of bytes read. * @return the total number of bytes read into the buffer, or * <code>-1</code> if there is no more data because the end of * the stream has been reached. * @exception IOException if an I/O error occurs. */ @Override public int read(byte[] buf, int off, int len) throws IOException { int i, c; for (i = 0; i < len; i++) { if ((c = read()) == -1) { if (i == 0) // At end of stream, so we should i = -1; // return -1 , NOT 0. break; } buf[off+i] = (byte)c; } return i; }