jodd-http/src/main/java/jodd/http/HttpResponse.java
public static HttpResponse readFrom(final InputStream in) {
		InputStreamReader inputStreamReader;
		try {
			inputStreamReader = new InputStreamReader(in, StringPool.ISO_8859_1);
		} catch (UnsupportedEncodingException unee) {
			throw new HttpException(unee);
		}
		BufferedReader reader = new BufferedReader(inputStreamReader);

		HttpResponse httpResponse = new HttpResponse();

		// the first line
		String line;
		try {
			line = reader.readLine();
		} catch (IOException ioex) {
			throw new HttpException(ioex);
		}

		if (line != null) {

			line = line.trim();

			int ndx = line.indexOf(' ');
			int ndx2;

			if (ndx > -1) {
				httpResponse.httpVersion(line.substring(0, ndx));

				ndx2 = line.indexOf(' ', ndx + 1);
			}
			else {
				httpResponse.httpVersion(HTTP_1_1);
				ndx2 = -1;
				ndx = 0;
			}

			if (ndx2 == -1) {
				ndx2 = line.length();
			}

			try {
				httpResponse.statusCode(Integer.parseInt(line.substring(ndx, ndx2).trim()));
			}
			catch (NumberFormatException nfex) {
				httpResponse.statusCode(-1);
			}

			httpResponse.statusPhrase(line.substring(ndx2).trim());
		}

		httpResponse.readHeaders(reader);
		httpResponse.readBody(reader);

		return httpResponse;
	}
public static HttpResponse readFrom(final InputStream in) {
		InputStreamReader inputStreamReader;
		try {
			inputStreamReader = new InputStreamReader(in, StringPool.ISO_8859_1);
		} catch (UnsupportedEncodingException unee) {
			throw new HttpException(unee);
		}
		BufferedReader reader = new BufferedReader(inputStreamReader);

		HttpResponse httpResponse = new HttpResponse();

		// the first line
		String line;
		try {
			line = reader.readLine();
		} catch (IOException ioex) {
			throw new HttpException(ioex);
		}

		if (line != null) {

			line = line.trim();

			int ndx = line.indexOf(' ');
			int ndx2;

			if (ndx > -1) {
				httpResponse.httpVersion(line.substring(0, ndx));

				ndx2 = line.indexOf(' ', ndx + 1);
			}
			else {
				httpResponse.httpVersion(HTTP_1_1);
				ndx2 = -1;
				ndx = 0;
			}

			if (ndx2 == -1) {
				ndx2 = line.length();
			}

			try {
				httpResponse.statusCode(Integer.parseInt(line.substring(ndx, ndx2).trim()));
			}
			catch (NumberFormatException nfex) {
				httpResponse.statusCode(-1);
			}

			httpResponse.statusPhrase(line.substring(ndx2).trim());
		}

		httpResponse.readHeaders(reader);
		httpResponse.readBody(reader);

		return httpResponse;
	}
public static HttpResponse readFrom ( final InputStream in ) { InputStreamReader inputStreamReader ; try { inputStreamReader = new InputStreamReader ( in , StringPool . ISO_8859_1 ) ; } catch ( UnsupportedEncodingException unee ) { throw new HttpException ( unee ) ; } BufferedReader reader = new BufferedReader ( inputStreamReader ) ; HttpResponse httpResponse = new HttpResponse ( ) ; // the first line String line ; try { line = reader . readLine ( ) ; } catch ( IOException ioex ) { throw new HttpException ( ioex ) ; } if ( line != null ) { line = line . trim ( ) ; int ndx = line . indexOf ( ' ' ) ; int ndx2 ; if ( ndx > - 1 ) { httpResponse . httpVersion ( line . substring ( 0 , ndx ) ) ; ndx2 = line . indexOf ( ' ' , ndx + 1 ) ; } else { httpResponse . httpVersion ( HTTP_1_1 ) ; ndx2 = - 1 ; ndx = 0 ; } if ( ndx2 == - 1 ) { ndx2 = line . length ( ) ; } try { httpResponse . statusCode ( Integer . parseInt ( line . substring ( ndx , ndx2 ) . trim ( ) ) ) ; } catch ( NumberFormatException nfex ) { httpResponse . statusCode ( - 1 ) ; } httpResponse . statusPhrase ( line . substring ( ndx2 ) . trim ( ) ) ; } httpResponse . readHeaders ( reader ) ; httpResponse . readBody ( reader ) ; return httpResponse ; }
Reads response input stream and returns {@link HttpResponse response}.
Supports both streamed and chunked response.
Reads response input stream and returns {