public int read(final byte[] b, int off, int len) throws IOException { if (this.closed) { return -1; } else { return this.in.read(b, off, len); } }
public int read() throws IOException { if (this.closed) { return -1; } else { return this.in.read(); } }
/** * Read the next byte from the stream * @return The next byte or -1 if the end of stream has been reached. * @throws IOException If an IO problem occurs * @see java.io.InputStream#read() */ public int read() throws IOException { if (closed) { throw new IOException("Attempted read from closed stream."); } if (pos >= contentLength) { return -1; } pos++; return this.in.read(); }
/** * Does standard {@link InputStream#read(byte[], int, int)} behavior, but * also notifies the watcher when the contents have been consumed. * * @param b The byte array to fill. * @param off Start filling at this position. * @param len The number of bytes to attempt to read. * @return The number of bytes read, or -1 if the end of content has been * reached. * * @throws java.io.IOException Should an error occur on the wrapped stream. */ public int read (byte[] b, int off, int len) throws java.io.IOException { if (closed) { throw new IOException("Attempted read from closed stream."); } if (pos >= contentLength) { return -1; } if (pos + len > contentLength) { len = (int) (contentLength - pos); } int count = this.in.read(b, off, len); pos += count; return count; }
/** * <p> Returns all the data in a chunked stream in coalesced form. A chunk * is followed by a CRLF. The method returns -1 as soon as a chunksize of 0 * is detected.</p> * * <p> Trailer headers are read automcatically at the end of the stream and * can be obtained with the getResponseFooters() method.</p> * * @return -1 of the end of the stream has been reached or the next data * byte * @throws IOException If an IO problem occurs */ public int read() throws IOException { if (this.closed) { throw new IOException("Attempted read from closed stream."); } if (this.eof) { return -1; } if (this.pos >= this.chunkSize) { nextChunk(); if (this.eof) { return -1; } } pos++; return in.read(); }
/** * Read some bytes from the stream. * @param b The byte array that will hold the contents from the stream. * @param off The offset into the byte array at which bytes will start to be * placed. * @param len the maximum number of bytes that can be returned. * @return The number of bytes returned or -1 if the end of stream has been * reached. * @see java.io.InputStream#read(byte[], int, int) * @throws IOException if an IO problem occurs. */ public int read (byte[] b, int off, int len) throws IOException { if (closed) { throw new IOException("Attempted read from closed stream."); } if (eof) { return -1; } if (pos >= chunkSize) { nextChunk(); if (eof) { return -1; } } len = Math.min(len, chunkSize - pos); int count = in.read(b, off, len); pos += count; return count; }
public int read(byte[] b, int off, int len) throws IOException { int l = this.in.read(b, off, len); if (this.wire.enabled() && l > 0) { this.wire.input(b, off, l); } return l; }
public int read() throws IOException { int l = this.in.read(); if (this.wire.enabled() && l > 0) { this.wire.input(l); } return l; }
public int read(byte[] b) throws IOException { int l = this.in.read(b); if (this.wire.enabled() && l > 0) { this.wire.input(b, 0, l); } return l; }
final int b = in.read(); if (b != -1) { pos++;
final int bytesRead = in.read(b, off, (int) Math.min(len, chunkSize - pos)); if (bytesRead != -1) { pos += bytesRead;
@Override public int read(final byte[] b, final int off, final int len) throws IOException { if (this.closed) { return -1; } else { return this.in.read(b, off, len); } }
@Override public int read() throws IOException { if (this.closed) { return -1; } else { return this.in.read(); } }
public int read() throws IOException { if (this.closed) { return -1; } else { return this.in.read(); } }
public int read(final byte[] b, int off, int len) throws IOException { if (this.closed) { return -1; } else { return this.in.read(b, off, len); } }
public int read(byte[] b) throws IOException { int l = this.in.read(b); if (this.wire.enabled() && l > 0) { this.wire.input(b, 0, l); } return l; }
public int read(byte[] b, int off, int len) throws IOException { int l = this.in.read(b, off, len); if (this.wire.enabled() && l > 0) { this.wire.input(b, off, l); } return l; }
public int read() throws IOException { int l = this.in.read(); if (this.wire.enabled() && l > 0) { this.wire.input(l); } return l; }
public int read() throws IOException { final int l = this.in.read(); if (this.wire.enabled() && l != -1) { this.wire.input(l); } return l; }