📄 urlgrabber.java
字号:
package com.macfaq.net;import java.net.URL;import java.io.IOException;import java.net.MalformedURLException;import java.io.InputStream;public class URLGrabber { public static InputStream getDocumentAsInputStream(URL url) throws IOException { InputStream in = url.openStream(); return in; } public static InputStream getDocumentAsInputStream(String url) throws MalformedURLException, IOException { URL u = new URL(url); return getDocumentAsInputStream(u); } public static String getDocumentAsString(URL url) throws IOException { StringBuffer result = new StringBuffer(); InputStream in = url.openStream(); int c; while ((c = in.read()) != -1) result.append((char) c); return result.toString(); } public static String getDocumentAsString(String url) throws MalformedURLException, IOException { URL u = new URL(url); return getDocumentAsString(u); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -