Java Host Name Get getHtmlSource(final String host)

Here you can find the source of getHtmlSource(final String host)

Description

get Html Source

License

Open Source License

Declaration

private static String getHtmlSource(final String host) 

Method Source Code


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

import java.net.*;
import java.io.*;

public class Main {
    private static String getHtmlSource(final String host) {
        final StringBuilder sb = new StringBuilder();
        InputStream is;/* w  ww.j  a va2 s .  c  o  m*/

        try {
            final URL url = new URL(host);
            is = url.openStream();
            final BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String line;
            while ((line = br.readLine()) != null) {
                sb.append(line);
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb.toString();
    }
}

Related

  1. getHostName(String destination)
  2. getHostName(String host)
  3. getHostname(String targetEndpoint)
  4. getHostNameByInet()
  5. getHostNameByNic()
  6. getInetHost()
  7. getLedgerAllocatorPoolName(int serverRegionId, int shardId, boolean useHostname)
  8. getLocalCanonicalHostName()
  9. getLocalShortHostName()