java命名空间javax.imageio类imagewriter的类成员方法:
prepareinsertempty定义及介绍
本文导语:
prepareinsertempty
public void prepareinsertempty(int imageindex,
imagetypespecifier imagetype,
int width,
int height,
iiometadata imagemetadata,
...
prepareinsertempty
public void prepareinsertempty(int imageindex,
imagetypespecifier imagetype,
int width,
int height,
iiometadata imagemetadata,
list extends bufferedimage> thumbnails,
imagewriteparam param)
throws ioexception
- 从将带有不确定像素值的新图像插入现有图像流中开始。索引大于
imageindex 的现有图像被保留,其索引均被加 1。为 -1 的 imageindex 值可用于表示大于以前最大索引的索引;也就是说,它将导致图像按逻辑添加到序列的末尾。如果输出是一个 imageoutputstream,则整个流都必须是可读并且可写的。
图像
iis7站长之家可由稍后使用的 replacepixels 方法提供。直到调用 endinsertempty 才完成插入操作。调用 preparereplacepixels、replacepixels 和 endreplacepixels 可能发生在调用 prepareinsertempty 和 endinsertempty 之间。不过,调用 prepareinsertempty 是不可嵌套的,调用 preparewriteempty 和 prepareinsertempty 不能被散置。
如果 caninsertempty(imageindex) 返回 false,则将抛出 unsupportedoperationexception。
可以有选择地提供 imagewriteparam 来控制写入过程。如果 param 为 null,则将使用默认 write 参数。
如果所提供的 imagewriteparam 包含不受此 writer 支持的可选设置值(例如 逐步编码或任何特定于格式的设置),则将忽略这些设置。
如果输出为 null,则默认实现抛出 illegalstateexception,否则抛出 unsupportedoperationexception。
- 参数:
imageindex - 将在其所在位置处写入图像的索引。imagetype - 描述图像布局的 imagetypespecifier。width - 图像的宽度。height - 图像的高度。imagemetadata - 表示图像元数据的 iiometadata 对象,或者为 null。thumbnails - 此图像的 bufferedimage 缩略图的 list,或者为 null。param - 一个 imagewriteparam,或者为 null,表示使用默认 imagewriteparam。
- 抛出:
illegalstateexception - 如果尚未设置输出。
unsupportedoperationexception - 如果 caninsertempty(imageindex) 返回 false。
indexoutofboundsexception - 如果 imageindex 小于 -1 或大于最大可用索引。
illegalstateexception - 如果以前已经调用 prepareinsertempty,但没有相应地调用 endinsertempty。
illegalstateexception - 如果以前已经调用 preparewriteempty,但没有相应地调用 endwriteempty。
illegalargumentexception - 如果 imagetype 为 null,或者 thumbnails 包含 null 引用或对象,而不是 bufferedimage。
illegalargumentexception - 如果宽度或高度小于 1。
ioexception - 如果在写期间发生 i/o 错误。