Java HttpURLConnection Open getConnectionStream(HttpURLConnection con)

Here you can find the source of getConnectionStream(HttpURLConnection con)

Description

This method is used to get a connection stream from an HTTP connection.

License

Apache License

Parameter

Parameter Description
con The connection to the HTTP address

Return

The Output from the webpage

Declaration

public static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;

public class Main {
    /**// w  w  w . j av a  2s  .c  o  m
     * This method is used to get a connection stream from an HTTP connection. It
     * gives the output from the webpage that it gets from the connection
     * 
     * @param con The connection to the HTTP address
     * @return The Output from the webpage
     */
    public static BufferedReader getConnectionStream(HttpURLConnection con) throws IOException {
        InputStream is = con.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
        return br;
    }
}

Related

  1. getConnection(String url)
  2. getConnection(String urlStr, boolean useProxy)
  3. getConnection(URL url)
  4. getConnectionCharset(HttpURLConnection connection)
  5. openConnection(final String urlString)
  6. openConnection(final URL url, final String requestMethod)
  7. openConnection(String url, String method, String contentType, String ssic)
  8. openConnection(URL url, Proxy proxy)