private void nextChunk() throws IOException { if (!myIsBOF) { readCRLF(); } myChunkSize = getChunkSizeFromInputStream(myInputStream, myCharset); myIsBOF = false; myPosition = 0; if (myChunkSize == 0) { myIsEOF = true; } }
public int read (byte[] b) throws IOException { return read(b, 0, b.length); }
public int read() throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } myPosition++; return myInputStream.read(); }
private InputStream createInputStream(HTTPHeader readHeader, InputStream is) throws IOException { if ("chunked".equalsIgnoreCase(readHeader.getFirstHeaderValue(HTTPHeader.TRANSFER_ENCODING_HEADER))) { is = new ChunkedInputStream(is, myCharset); } else if (readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER) != null) { String lengthStr = readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER);
public int read() throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } myPosition++; return myInputStream.read(); }
private InputStream createInputStream(HTTPHeader readHeader, InputStream is) throws IOException { if ("chunked".equalsIgnoreCase(readHeader.getFirstHeaderValue(HTTPHeader.TRANSFER_ENCODING_HEADER))) { is = new ChunkedInputStream(is, myCharset); } else if (readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER) != null) { String lengthStr = readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER);
private void nextChunk() throws IOException { if (!myIsBOF) { readCRLF(); } myChunkSize = getChunkSizeFromInputStream(myInputStream, myCharset); myIsBOF = false; myPosition = 0; if (myChunkSize == 0) { myIsEOF = true; } }
public int read() throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } myPosition++; return myInputStream.read(); }
public int read (byte[] b) throws IOException { return read(b, 0, b.length); }
private InputStream createInputStream(HTTPHeader readHeader, InputStream is) throws IOException { if ("chunked".equalsIgnoreCase(readHeader.getFirstHeaderValue(HTTPHeader.TRANSFER_ENCODING_HEADER))) { is = new ChunkedInputStream(is, myCharset); } else if (readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER) != null) { String lengthStr = readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_LENGTH_HEADER); long length = 0; try { length = Long.parseLong(lengthStr); } catch (NumberFormatException nfe) { length = 0; } is = new FixedSizeInputStream(is, length); } else if (!hasToCloseConnection(readHeader)) { // no content length and no valid transfer-encoding! // consider as empty response. // but only when there is no "Connection: close" or "Proxy-Connection: close" header, // in that case just return "is". // skipData will not read that as it should also analyze "close" instruction. // return empty stream. // and force connection close? (not to read garbage on the next request). is = new FixedSizeInputStream(is, 0); // this will force connection to close. readHeader.setHeaderValue(HTTPHeader.CONNECTION_HEADER, "close"); } if ("gzip".equals(readHeader.getFirstHeaderValue(HTTPHeader.CONTENT_ENCODING_HEADER))) { is = new GZIPInputStream(is); } return myRepository.getDebugLog().createLogStream(SVNLogType.NETWORK, is); }
private void nextChunk() throws IOException { if (!myIsBOF) { readCRLF(); } myChunkSize = getChunkSizeFromInputStream(myInputStream, myCharset); myIsBOF = false; myPosition = 0; if (myChunkSize == 0) { myIsEOF = true; } }
public int read (byte[] b, int off, int len) throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } len = Math.min(len, myChunkSize - myPosition); int count = myInputStream.read(b, off, len); myPosition += count; return count; }
public int read (byte[] b) throws IOException { return read(b, 0, b.length); }
public int read (byte[] b, int off, int len) throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } len = Math.min(len, myChunkSize - myPosition); int count = myInputStream.read(b, off, len); myPosition += count; return count; }
public int read (byte[] b, int off, int len) throws IOException { if (myIsClosed) { throw new IOException("Attempted read from closed stream."); } if (myIsEOF) { return -1; } if (myPosition >= myChunkSize) { nextChunk(); if (myIsEOF) { return -1; } } len = Math.min(len, myChunkSize - myPosition); int count = myInputStream.read(b, off, len); myPosition += count; return count; }