|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.ImageOutputStreamImpl
javax.imageio.stream.MemoryCacheImageOutputStream
public class MemoryCacheImageOutputStream
将输出写入常规 OutputStream 中的 ImageOutputStream 的实现。内存缓冲区用于缓存(至少)丢弃位置和当前写入位置之间的数据。惟一的构造方法带有一个 OutputStream,因此此类不能用于读取/修改/写入操作。读取操作只能发生在那些已经被写入到缓存且尚未被刷新的流部分。
| 字段摘要 |
|---|
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的字段 |
|---|
bitOffset, byteOrder, flushedPos, streamPos |
| 构造方法摘要 | |
|---|---|
MemoryCacheImageOutputStream(OutputStream stream)
构造将向给定 OutputStream 进行写入的 MemoryCacheImageOutputStream。 |
|
| 方法摘要 | |
|---|---|
void |
close()
关闭此 MemoryCacheImageOutputStream。 |
void |
flushBefore(long pos)
丢弃所指示部分之前的流初始部分。 |
boolean |
isCached()
返回 true,因为此 ImageOutputStream为了允许逆向查找而缓存了数据。 |
boolean |
isCachedFile()
返回 false,因为此 ImageOutputStream 不维护文件缓存。 |
boolean |
isCachedMemory()
返回 true,因为此 ImageOutputStream 维护主存缓存。 |
long |
length()
返回 -1L,指示流的长度未知。 |
int |
read()
从流中读取单个字节,并以整数(0 到 255 之间)形式返回该字节。 |
int |
read(byte[] b,
int off,
int len)
从流中读取至多 len 个字节,并将其存储到 b 中(从 off 索引处开始)。 |
void |
write(byte[] b,
int off,
int len)
将数组 b 中的 len 个字节按顺序写入输出流。 |
void |
write(int b)
将参数 b 的八个低位写入输出流。 |
| 从类 javax.imageio.stream.ImageOutputStreamImpl 继承的方法 |
|---|
flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTF |
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的方法 |
|---|
checkClosed, finalize, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 从接口 javax.imageio.stream.ImageInputStream 继承的方法 |
|---|
flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes |
| 构造方法详细信息 |
|---|
public MemoryCacheImageOutputStream(OutputStream stream)
OutputStream 进行写入的 MemoryCacheImageOutputStream。
stream - 将写入到的 OutputStream。
IllegalArgumentException - 如果 stream 为 null。| 方法详细信息 |
|---|
public int read()
throws IOException
ImageInputStream 复制的描述在进行读取前,将流中的位偏移量重置为零。
ImageInputStream 中的 readImageInputStreamImpl 中的 readIOException - 如果发生 I/O 错误。
public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpl 复制的描述len 个字节,并将其存储到 b 中(从 off 索引处开始)。如果由于到达流末尾而没有读取任何字节,则返回 -1。
在发生读取前,必须将流中的位偏移量重置为零。
子类必须提供此方法的实现。子类实现在退出前应该更新流位置。
ImageInputStream 中的 readImageInputStreamImpl 中的 readb - 用来接收写入的字节数组。off - b 中要写入的起始位置。len - 要读取的最大字节数。
-1,指示 EOF。
IOException - 如果发生 I/O 错误。
public void write(int b)
throws IOException
DataOutput 复制的描述b 的八个低位写入输出流。忽略 b 的 24 个高位。
DataOutput 中的 writeImageOutputStream 中的 writeImageOutputStreamImpl 中的 writeb - 要写入的字节。
IOException - 如果发生 I/O 错误。
public void write(byte[] b,
int off,
int len)
throws IOException
DataOutput 复制的描述b 中的 len 个字节按顺序写入输出流。如果 b 为 null,则抛出 NullPointerException。如果 off 为负,或 len 为负,抑或 off+len 大于数组 b 的长度,则抛出 IndexOutOfBoundsException。如果 len 为零,则不写入字节。否则,首先写入字节 b[off],然后写入字节 b[off+1],依此类推;最后一个写入字节是 b[off+len-1]。
DataOutput 中的 writeImageOutputStream 中的 writeImageOutputStreamImpl 中的 writeb - 数据。off - 数据中的起始偏移量。len - 要写入的字节数。
IOException - 如果发生 I/O 错误。public long length()
ImageInputStreamImpl 复制的描述-1L,指示流的长度未知。子类必须重写此方法来提供实际的长度信息。
ImageInputStream 中的 lengthImageInputStreamImpl 中的 lengthpublic boolean isCached()
true,因为此 ImageOutputStream为了允许逆向查找而缓存了数据。
ImageInputStream 中的 isCachedImageInputStreamImpl 中的 isCachedtrue。isCachedMemory(),
isCachedFile()public boolean isCachedFile()
false,因为此 ImageOutputStream 不维护文件缓存。
ImageInputStream 中的 isCachedFileImageInputStreamImpl 中的 isCachedFilefalse。isCached(),
isCachedMemory()public boolean isCachedMemory()
true,因为此 ImageOutputStream 维护主存缓存。
ImageInputStream 中的 isCachedMemoryImageInputStreamImpl 中的 isCachedMemorytrue。isCached(),
isCachedFile()
public void close()
throws IOException
MemoryCacheImageOutputStream。所有的挂起数据都将被刷新到输出,释放该缓存。但不关闭目标 OutputStream。
ImageInputStream 中的 closeImageInputStreamImpl 中的 closeIOException - 如果发生 I/O 错误。
public void flushBefore(long pos)
throws IOException
ImageInputStream 复制的描述IndexOutOfBoundsException。
调用 flushBefore 可允许实现此接口的类释放用于存储流中的数据的资源(如内存和磁盘空间)。
ImageInputStream 中的 flushBeforeImageOutputStream 中的 flushBeforeImageInputStreamImpl 中的 flushBeforepos - 一个 long,它包含要刷新的文件前缀的长度。
IOException - 如果发生 I/O 错误。
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。