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;
}
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;
}
Aggregations