JDK1.7 ImageIO的一个梗
2016-04-29 20:36
302 查看
上个星期我的leader就要我看 这个东西了,由于一个星期都在做项目上的东西,没时间看,今天终于把那个事情完结了。。
来脑补一下这个事情:
他们项目组的JDK原来是JDK1.6,现在要用JDK1.7,然后呢,图像处理这一块有点问题。
JDK1.7将encoder,decoder类删除掉了,所以呢代码就有问题了,就要我帮助他们改一改。
今天终于好了!
言归正传,了解下JDK1.7和JDK1.6的差别吧:
encoder --> 写 write
decoder --> 读 read
Returns a
Unlike most other methods in this class, this method does close the provided
Parameters:
Writes an image using an arbitrary
Parameters:
来脑补一下这个事情:
他们项目组的JDK原来是JDK1.6,现在要用JDK1.7,然后呢,图像处理这一块有点问题。
JDK1.7将encoder,decoder类删除掉了,所以呢代码就有问题了,就要我帮助他们改一改。
今天终于好了!
言归正传,了解下JDK1.7和JDK1.6的差别吧:
encoder --> 写 write
decoder --> 读 read
static BufferedImage | read(File input) Returns a BufferedImageas the result of decoding a supplied Filewith an ImageReaderchosen automatically from among those currently registered. |
static BufferedImage | read(ImageInputStream stream) Returns a BufferedImageas the result of decoding a supplied ImageInputStreamwith an ImageReaderchosen automatically from among those currently registered. |
static BufferedImage | read(InputStream input) Returns a BufferedImageas the result of decoding a supplied InputStreamwith an ImageReaderchosen automatically from among those currently registered. |
static BufferedImage | read(URL input) Returns a BufferedImageas the result of decoding a supplied URLwith an ImageReaderchosen automatically from among those currently registered. |
read
public static BufferedImage read(ImageInputStream stream) throws IOException
Returns a
BufferedImageas the result of decoding a supplied
ImageInputStreamwith an
ImageReaderchosen automatically from among those currently registered. If no registered
ImageReaderclaims to be able to read the stream,
nullis returned.
Unlike most other methods in this class, this method does close the provided
ImageInputStreamafter the read operation has completed, unless
nullis returned, in which case this method does not close the stream.
Parameters:
stream- an
ImageInputStreamto read from. Returns:a
BufferedImagecontaining the decoded contents of the input, or
null. Throws:
IllegalArgumentException- if
streamis
null.
IOException- if an error occurs during reading.
static boolean | write(RenderedImage im, String formatName, File output) Writes an image using an arbitrary ImageWriterthat supports the given format to a File. |
static boolean | write(RenderedImage im, String formatName, ImageOutputStream output) Writes an image using the an arbitrary ImageWriterthat supports the given format to an ImageOutputStream. |
static boolean | write(RenderedImage im, String formatName, OutputStream output) Writes an image using an arbitrary ImageWriterthat supports the given format to an OutputStream. |
public static boolean write(RenderedImage im, String formatName, File output) throws IOException
Writes an image using an arbitrary
ImageWriterthat supports the given format to a
File. If there is already a
Filepresent, its contents are discarded.
Parameters:
im- a
RenderedImageto be written.
formatName- a
Stringcontaing the informal name of the format.
output- a
Fileto be written to. Returns:
falseif no appropriate writer is found. Throws:
IllegalArgumentException- if any parameter is
null.
IOException- if an error occurs during writing.
相关文章推荐
- 为何从ThreadLocal中获得的对象是线程安全的? Java7 Java8
- 【Java】访问控制权限
- [Java视频笔记]day11
- Java问题探讨之String的不可变性
- 轻松搞定java内存模型(二)类的加载以及初始化
- 总结javaweb 目录结构
- Java中用到的一些基本概念
- Spring与Quartz的整合实现定时任务调度
- java文件拷贝类
- 改变myeclipse背景颜色
- 调用第三方api之图灵机器人
- Java应用调优指南之-工具篇
- Java mail学习之邮件基础
- spring和mybatis整合的dao两种开放方式
- JAVA模拟post请求
- java排序之归并排序
- (34)Spring Boot的启动器Starter详解【从零开始学Spring Boot】
- Struts2之Crud综合实例
- java .bat批处理(java cmd命令)
- 二叉查找树BST----java实现