Search in sources :

Example 1 with Response

use of org.jsoup.helper.HttpConnection.Response in project ABPlayer by winkstu.

the class BiliVideoViewActivity method createParser.

private BaseDanmakuParser createParser(String uri) {
    InputStream stream = null;
    if (uri == null) {
        return new BaseDanmakuParser() {

            @Override
            protected Danmakus parse() {
                return new Danmakus();
            }
        };
    }
    try {
        Response rsp = (Response) Jsoup.connect(uri).execute();
        stream = new ByteArrayInputStream(CompressionTools.decompressXML(rsp.bodyAsBytes()));
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (DataFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    ILoader loader = DanmakuLoaderFactory.create(DanmakuLoaderFactory.TAG_BILI);
    try {
        loader.load(stream);
    } catch (IllegalDataException e) {
        e.printStackTrace();
    }
    BaseDanmakuParser parser = new BiliDanmukuParser();
    IDataSource<?> dataSource = loader.getDataSource();
    parser.load(dataSource);
    return parser;
}
Also used : BaseDanmakuParser(master.flame.danmaku.danmaku.parser.BaseDanmakuParser) Response(org.jsoup.helper.HttpConnection.Response) BiliDanmukuParser(master.flame.danmaku.danmaku.parser.android.BiliDanmukuParser) DataFormatException(java.util.zip.DataFormatException) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Danmakus(master.flame.danmaku.danmaku.model.android.Danmakus) IOException(java.io.IOException) ILoader(master.flame.danmaku.danmaku.loader.ILoader) IllegalDataException(master.flame.danmaku.danmaku.loader.IllegalDataException)

Example 2 with Response

use of org.jsoup.helper.HttpConnection.Response in project ABPlayer by winkstu.

the class HttpUtil method getXmlDecompress.

public static String getXmlDecompress(String urlString) {
    Response rsp = null;
    String temp = "";
    try {
        rsp = (Response) Jsoup.connect(urlString).execute();
        temp = EncodingUtils.getString(CompressionTools.decompressXML(rsp.bodyAsBytes()), "utf-8");
        Log.d("TAG", "=======>Xml解压成功");
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        Log.d("TAG", "=======>Xml解压失败:" + e.toString());
    } catch (DataFormatException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        Log.d("TAG", "=======>Xml解压失败:" + e.toString());
    }
    return temp;
}
Also used : Response(org.jsoup.helper.HttpConnection.Response) HttpResponse(org.apache.http.HttpResponse) DataFormatException(java.util.zip.DataFormatException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 DataFormatException (java.util.zip.DataFormatException)2 Response (org.jsoup.helper.HttpConnection.Response)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 ILoader (master.flame.danmaku.danmaku.loader.ILoader)1 IllegalDataException (master.flame.danmaku.danmaku.loader.IllegalDataException)1 Danmakus (master.flame.danmaku.danmaku.model.android.Danmakus)1 BaseDanmakuParser (master.flame.danmaku.danmaku.parser.BaseDanmakuParser)1 BiliDanmukuParser (master.flame.danmaku.danmaku.parser.android.BiliDanmukuParser)1 HttpResponse (org.apache.http.HttpResponse)1