Java URL Connection retrieveHtml(URLConnection http)

Here you can find the source of retrieveHtml(URLConnection http)

Description

Returns the text received from a web post

License

Open Source License

Parameter

Parameter Description
http Description of the Parameter

Exception

Parameter Description

Return

Description of the Return Value

Declaration

public static String retrieveHtml(URLConnection http) throws java.io.IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.net.URLConnection;

public class Main {
    /**/*from  ww  w. j a  v a  2s  . c  o m*/
     *  Returns the text received from a web post
     *
     * @param  http                  Description of the Parameter
     * @return                       Description of the Return Value
     * @throws  java.io.IOException  Description of the Exception
     */
    public static String retrieveHtml(URLConnection http) throws java.io.IOException {
        StringBuffer htmlOutput = new StringBuffer();
        InputStreamReader input = new InputStreamReader(http.getInputStream());
        BufferedReader inStream = new BufferedReader(input);
        String inputLine;
        while ((inputLine = inStream.readLine()) != null) {
            htmlOutput.append(inputLine + System.getProperty("line.separator"));
        }
        inStream.close();
        return htmlOutput.toString();
    }
}

Related

  1. queryComputeAPI(String url)
  2. renderRequest(URLConnection connection)
  3. resolveModuleEntriesFromJar(URL url, String _prefix)
  4. retrieveData(URL url)
  5. retrieveFromUrl(String url, boolean useCache, boolean deleteOnExit)
  6. scanPackageByJar(List> classes, final String packageName, final URL jarUrl, final boolean recursive)
  7. sendGetRequest(String resourceUrl, String contentType)
  8. sendGetRequest(String urlStr)
  9. sendPost(String url, String param)