common/src/main/java/HTTPClient/HTTPResponse.java
/**
     * Reads the response data received. Does not return until either
     * Content-Length bytes have been read or EOF is reached.
     *
     * @inp       the input stream from which to read the data
     * @exception IOException if any read on the input stream fails
     */
Reads the response data received. Does not return until either
Content-Length bytes have been read or EOF is reached.

@inp       the input stream from which to read the data
@exception IOException if any read on the input stream fails
Reads the response data received . Does not return until either Content - Length bytes have been read or EOF is reached . @inp the input stream from which to read the data @exception IOException if any read on the input stream fails
private void readResponseData(InputStream inp)
	    throws IOException, ModuleException
    {
	if (ContentLength == 0)
	    return;
	if (Data == null)
	    Data = new byte[0];
	int off = Data.length;
	try
	{
	    if (getHeader("Content-Length") != null)
	    {
		int rcvd = 0;
		Data = new byte[ContentLength];
		do
		{
		    off  += rcvd;
		    rcvd  = inp.read(Data, off, ContentLength-off);
		} while (rcvd != -1  &&  off+rcvd < ContentLength);
                /* Don't do this!
		 * If we do, then getData() won't work after a getInputStream()
		 * because we'll never get all the expected data. Instead, let
		 * the underlying RespInputStream throw the EOF.
		if (rcvd == -1)	// premature EOF
		{
		    throw new EOFException("Encountered premature EOF while " +
					    "reading headers: received " + off +
					    " bytes instead of the expected " +
					    ContentLength + " bytes");
		}
		*/
	    }
	    else
	    {
		int inc  = 1000,
		    rcvd = 0;
		do
		{
		    off  += rcvd;
		    Data  = Util.resizeArray(Data, off+inc);
		} while ((rcvd = inp.read(Data, off, inc)) != -1);
		Data = Util.resizeArray(Data, off);
	    }
	}
	catch (IOException ioe)
	{
	    Data = Util.resizeArray(Data, off);
	    throw ioe;
	}
	finally
	{
	    try
		{ inp.close(); }
	    catch (IOException ioe)
		{ }
	}
    }
private void readResponseData ( InputStream inp ) throws IOException , ModuleException { if ( ContentLength == 0 ) return ; if ( Data == null ) Data = new byte [ 0 ] ; int off = Data . length ; try { if ( getHeader ( "Content-Length" ) != null ) { int rcvd = 0 ; Data = new byte [ ContentLength ] ; do { off += rcvd ; rcvd = inp . read ( Data , off , ContentLength - off ) ; } while ( rcvd != - 1 && off + rcvd < ContentLength ) ; /* Don't do this!
		 * If we do, then getData() won't work after a getInputStream()
		 * because we'll never get all the expected data. Instead, let
		 * the underlying RespInputStream throw the EOF.
		if (rcvd == -1)	// premature EOF
		{
		    throw new EOFException("Encountered premature EOF while " +
					    "reading headers: received " + off +
					    " bytes instead of the expected " +
					    ContentLength + " bytes");
		}
		*/ } else { int inc = 1000 , rcvd = 0 ; do { off += rcvd ; Data = Util . resizeArray ( Data , off + inc ) ; } while ( ( rcvd = inp . read ( Data , off , inc ) ) != - 1 ) ; Data = Util . resizeArray ( Data , off ) ; } } catch ( IOException ioe ) { Data = Util . resizeArray ( Data , off ) ; throw ioe ; } finally { try { inp . close ( ) ; } catch ( IOException ioe ) { } } }
Reads the response data received.
Reads the response data received .
// read response data // check Content-length header in case CE-Module removed it