我有ImageInputStream
。我正在使用需要InputStream
来源的第三方API。我写了一个包装类来传递给API:
class ImageInputStreamWrapper extends InputStream {
private ImageInputStream imageInputStream;
public ImageInputStreamWrapper(ImageInputStream is) {
imageInputStream = is;
}
public int read() throws IOException {
return imageInputStream.read();
}
}
它有效,但速度极慢。有更好的方法吗?
答案 0 :(得分:0)
想出来。我需要补充一下:
public int read(byte[] b, int off, int len) throws IOException {
return imageInputStream.read(b, off, len);
}