예제 #1
0
 private Response parseResponse(BufferedReader in) throws IOException {
   final Response result = new Response();
   result.setStatusLine(in.readLine());
   String next;
   while (!(next = in.readLine()).equals("")) {
     result.getHeaders().add(HttpHeader.createFromHeaderLine(next));
   }
   in.read(result.getBody());
   return result;
 }
  private CharacterHttpResponse parseResponse(BufferedReader in) throws IOException {
    final CharacterHttpResponse result = new CharacterHttpResponse();

    result.setStatusLine(in.readLine());

    String next;

    while (!(next = in.readLine()).equals("")) {
      result.getHeaders().add(HttpHeader.createFromHeaderLine(next));
    }

    // TODO chunked transfer-encoding is not supported!

    // reading body - we already know how many bytes the body is
    // (from the content-length header line)
    in.read(result.getBody());
    return result;
  }