本文整理汇总了Java中com.sun.media.jai.codec.ByteArraySeekableStream类的典型用法代码示例。如果您正苦于以下问题:Java ByteArraySeekableStream类的具体用法?Java ByteArraySeekableStream怎么用?Java ByteArraySeekableStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ByteArraySeekableStream类属于com.sun.media.jai.codec包,在下文中一共展示了ByteArraySeekableStream类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImage
import com.sun.media.jai.codec.ByteArraySeekableStream; //导入依赖的package包/类
/** @param id unique id given to the image
*/
public RenderedOp getImage(String id)
throws ImageStorageException
{
try {
File f = new File(folder+"sign_"+id+".tif");
FileInputStream is = new FileInputStream(f);
byte[] b = new byte[(new Long(f.length())).intValue()];
is.read(b);
ByteArraySeekableStream stream = new ByteArraySeekableStream(b);
RenderedOp img = JAI.create("stream",stream);
is.close();
return img;
}
catch(FileNotFoundException e1) {
throw new ImageStorageException
("File "+folder+"sign_"+id+".tif not found");
}
catch(IOException e2) {
throw new ImageStorageException
("Class FolderImageStorage : IOException throwed : msg : "+e2.getMessage());
}
}
示例2: loadImageFromBytes
import com.sun.media.jai.codec.ByteArraySeekableStream; //导入依赖的package包/类
public static RenderedImage loadImageFromBytes(byte[] bytes) throws IOException {
SeekableStream ss = new ByteArraySeekableStream(bytes);
RenderedImage image = JAI.create("stream", ss);
return image;
}