|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.MemoryCacheImageInputStream
public class MemoryCacheImageInputStream
从常规 InputStream 获取输入的 ImageInputStream 的实现。内存缓冲区用于缓存(至少)丢弃位置和当前读取位置之间的数据。
一般而言,从常规 InputStream 进行读取时最好使用 FileCacheImageInputStream。提供此类用于不可能创建可写入临时文件的情况。
| 字段摘要 |
|---|
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的字段 |
|---|
bitOffset, byteOrder, flushedPos, streamPos |
| 构造方法摘要 | |
|---|---|
MemoryCacheImageInputStream(InputStream stream)
构造一个将从给定 InputStream 进行读取的 MemoryCacheImageInputStream。 |
|
| 方法摘要 | |
|---|---|
void |
close()
关闭此 MemoryCacheImageInputStream,释放缓存。 |
protected void |
finalize()
在垃圾回收前结束此对象。 |
void |
flushBefore(long pos)
丢弃所指示位置之前的流初始部分。 |
boolean |
isCached()
返回 true,因为此 ImageInputStream为了允许逆向查找而缓存了数据。 |
boolean |
isCachedFile()
返回 false,因为此 ImageInputStream 不维护文件缓存。 |
boolean |
isCachedMemory()
返回 true,因为此 ImageInputStream 维护主存缓存。 |
int |
read()
从流中读取单个字节,并以 int(0 到 255 之间)形式返回该字节。 |
int |
read(byte[] b,
int off,
int len)
从流中读取至多 len 个字节,并将其存储到 b 中(从 off 索引处开始)。 |
| 从类 javax.imageio.stream.ImageInputStreamImpl 继承的方法 |
|---|
checkClosed, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, length, 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 |
| 构造方法详细信息 |
|---|
public MemoryCacheImageInputStream(InputStream stream)
InputStream 进行读取的 MemoryCacheImageInputStream。
stream - 要从其进行读取的 InputStream。
IllegalArgumentException - 如果 stream 为 null。| 方法详细信息 |
|---|
public int read()
throws IOException
ImageInputStreamImpl 复制的描述int(0 到 255 之间)形式返回该字节。 如果到达 EOF,则返回 -1。
子类必须提供此方法的实现。子类实现在退出前应该更新流位置。
在发生读取前,流中的位偏移量必须被重置为 0。
ImageInputStream 中的 readImageInputStreamImpl 中的 read-1。
IOException - 如果流已经被关闭。
public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpl 复制的描述len 个字节,并将其存储到 b 中(从 off 索引处开始)。如果由于到达流末尾而没有读取任何字节,则返回 -1。
在发生读取前,流中的位偏移量必须被重置为 0。
子类必须提供此方法的实现。子类实现在退出前应该更新流位置。
ImageInputStream 中的 readImageInputStreamImpl 中的 readb - 用来接收写入的字节数组。off - b 中要写入的起始位置。len - 要读取的最大字节数。
-1,指示 EOF。
IOException - 如果发生 I/O 错误。
public void flushBefore(long pos)
throws IOException
ImageInputStream 复制的描述IndexOutOfBoundsException。
调用 flushBefore 可允许实现此接口的类释放存储流中的数据所使用的资源,如内存和磁盘空间。
ImageInputStream 中的 flushBeforeImageInputStreamImpl 中的 flushBeforepos - 一个 long,它包含要刷新的流前缀的长度。
IOException - 如果发生 I/O 错误。public boolean isCached()
true,因为此 ImageInputStream为了允许逆向查找而缓存了数据。
ImageInputStream 中的 isCachedImageInputStreamImpl 中的 isCachedtrue。isCachedMemory(),
isCachedFile()public boolean isCachedFile()
false,因为此 ImageInputStream 不维护文件缓存。
ImageInputStream 中的 isCachedFileImageInputStreamImpl 中的 isCachedFilefalse。isCached(),
isCachedMemory()public boolean isCachedMemory()
true,因为此 ImageInputStream 维护主存缓存。
ImageInputStream 中的 isCachedMemoryImageInputStreamImpl 中的 isCachedMemorytrue。isCached(),
isCachedFile()
public void close()
throws IOException
MemoryCacheImageInputStream,释放缓存。但不关闭源 InputStream。
ImageInputStream 中的 closeImageInputStreamImpl 中的 closeIOException - 如果发生 I/O 错误。
protected void finalize()
throws Throwable
close 方法来关闭所有开启的输入源。不应该从应用程序代码调用此方法。
ImageInputStreamImpl 中的 finalizeThrowable - 如果在超类终止过程中发生错误。
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。