我试图从指定网址下载GIF,但有一个问题。 我在这里停留,不知道下载这个文件的正确方法。 如何修复呢? 我有样本网址: http://i1.kwejk.pl/k/obrazki/2015/02/6f0239004a643dbd9510ebda5a6f22b3.gif
我的代码:
try{
System.out.println(this.adressToGif);
URL url = new URL(urltoGif);
URLConnection conn = url.openConnection();
//conn.connect();
InputStream is = conn.getInputStream(); //IT crashes here and jumps to catch()
BufferedInputStream bis = new BufferedInputStream(is);
bis.mark(conn.getContentLength());
bis.close();
gifPlayer = new NewGifPlayer(this, bis);
//Movie movie = Movie.decodeStream(bis);
}catch(Exception x)
{
System.out.println("There is a problem");
}