printhttpsurlpage.java

来自「java 完全探索的随书源码」· Java 代码 · 共 32 行

JAVA
32
字号
import javax.net.ssl.*;import java.io.*;import java.net.*;import java.security.*;public class PrintHTTPSUrlPage{  public static void main(String args[]) throws Exception  {    System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");    Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider());    // Notice the https protocol here    URL url = new URL("https://www.verisign.com" );    URLConnection conn = url.openConnection();    conn.connect();    BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );    String data = null;    // Keep reading lines until there are no more to read    while( (data = reader.readLine()) != null )    {      // Just write out the text to the console      System.out.println( data );    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?