首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解码图像URL -解码器->解码返回false

无法解码图像URL -解码器->解码返回false
EN

Stack Overflow用户
提问于 2013-07-20 18:48:02
回答 1查看 805关注 0票数 1

我被困在从图像URL位置解码一个jpg文件。我尝试了许多不同的解决方案,但无法解码。

你能不能试一下下面的网址,让我知道解决方案。

网址:http://halosys.co.in/FTP-LOCATION/ftp-user15/testing2.jpg

代码语言:javascript
复制
InputStream in = new java.net.URL(imageURL).openStream();
Bitmap bImage = BitmapFactory.decodeStream(new FlushedInputStream(in));
imageView.setImageBitmap(bImage);

static class FlushedInputStream extends FilterInputStream {
        public FlushedInputStream(InputStream inputStream) {
            super(inputStream);
        }

        @Override
        public long skip(long n) throws IOException {
            long totalBytesSkipped = 0L;
            while (totalBytesSkipped < n) {
                long bytesSkipped = in.skip(n - totalBytesSkipped);
                if (bytesSkipped == 0L) {
                    int b = read();
                    if (b < 0) {
                        break;  // we reached EOF
                    } else {
                        bytesSkipped = 1; // we read one byte
                    }
                }
                totalBytesSkipped += bytesSkipped;
            }
            return totalBytesSkipped;
        }
    }

此外,iPhone应用程序还成功解码了此图像。Android对图片的解码有限制吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2013-07-22 20:17:19

有图像的问题,该图像是skia图形启用,所以你面临这个问题。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17761438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档