首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

从http中取得 Inputstream

2012-06-26 
从http中获得 Inputstream/*** 从http中获得 Inputstream** @param url http地址* @return inputstream* @

从http中获得 Inputstream

/**     * 从http中获得 Inputstream     *     * @param url http地址     * @return inputstream     * @throws java.io.IOException IOException     */    private static InputStream getInputStreamFromHttp(String url) throws IOException {        URL downUrl = new URL(url);        HttpURLConnection connection = (HttpURLConnection)downUrl.openConnection();        connection.connect();        if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {            return connection.getInputStream();        }        return null;    }

热点排行