1

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

您能否在以下 URL 上尝试一下并告诉我解决方案。

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

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 解码图像有什么限制吗?

谢谢

4

1 回答 1

-1

图像存在问题,该图像启用了滑雪图形,因此您面临此问题。

于 2013-07-22T12:17:19.170 回答