与网络交互相关
wtmusic_9
这个作者很懒,什么都没留下…
展开
-
从输入流读取数据
/** * 从输入流读取数据 * @param inStream * @return * @throws Exception */ public static byte[] readInputStream(InputStream inStream) throws Exception{ ByteArrayOutputStream outSteam = n...原创 2011-07-13 23:03:27 · 197 阅读 · 0 评论 -
通过HttpURLConnection发送post数据
public static void main(String[] args) throws Throwable { String path = "http://192.168.1.10:8080/videoweb/video/manage.do?method=getXML"; String xml = "<?xml version=\"1.0\" encoding=\"UT...原创 2011-07-13 23:10:00 · 117 阅读 · 0 评论 -
通过HttpURLConnection的get方式获取网络图片
//通过get方式获取网络图片 public static void main(String[] args) throws Exception{ String path = "http://i6.17173.itc.cn/2010/news/chinajoy/2010/mm/small01/s0722cyfs01.jpg"; URL url = new URL(path); ...原创 2011-07-13 23:15:36 · 260 阅读 · 0 评论 -
通过DefaultHttpClient 发送post请求
// HTTPS SSL COOKIE private static boolean sendPostRequestHttpClient(String path, Map<String, String> params, String encoding) throws Exception{ List<NameValuePair> paramPairs = n...原创 2011-07-13 23:29:49 · 698 阅读 · 0 评论 -
HttpURLConnection 的get和post请求
/** * 发出一个GET请求 * @param path 请求的路径,不带参数 * @param params 参数 * @return * @throws Exception */ private static boolean sendGetRequest(String path, Map<String, String> params,...原创 2011-07-13 23:39:47 · 103 阅读 · 0 评论