public class FileCacheImageInputStream extends ImageInputStreamImpl
ImageInputStream获得其输入从一个普通的
InputStream实现。一个文件用于缓存以前读过的数据。
bitOffset, byteOrder, flushedPos, streamPos| Constructor and Description |
|---|
FileCacheImageInputStream(InputStream stream, File cacheDir)
构建了一个
FileCacheImageInputStream将从一个给定的
InputStream读。
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
这
FileCacheImageInputStream关闭,关闭和删除缓存文件。
|
protected void |
finalize()
完成这个对象的垃圾收集之前。
|
boolean |
isCached()
返回
true因为这
ImageInputStream缓存数据以便寻求向后。
|
boolean |
isCachedFile()
返回
true因为这
ImageInputStream保持文件缓存。
|
boolean |
isCachedMemory()
返回
false因为这
ImageInputStream不保持内存缓存。
|
int |
read()
从流中读取一个字节并返回0和255之间的
int。
|
int |
read(byte[] b, int off, int len)
从流中读取到
len字节,并将它们存储到
b从指数
off。
|
checkClosed, flush, flushBefore, 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, skipBytespublic FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException
FileCacheImageInputStream将从一个给定的
InputStream读。
一个临时文件被用作缓存。如果cacheDiris non-null是目录,文件将被创建在。如果是null,依赖于系统默认的临时文件目录将被使用(见File.createTempFile详情的文件)。
stream -
InputStream读。
cacheDir -
File标明缓存文件应该被创建,或
null使用系统目录。
null
stream
IllegalArgumentException。
IllegalArgumentException -如果
cacheDir是非
null但不是目录。
IOException -如果一个缓存文件无法创建。
public int read()
throws IOException
ImageInputStreamImpl
int。如果达到
-1返回EOF。
子类必须为这种方法提供一个实现。子类实现应在退出之前更新流位置。
在流中的位偏移量必须在读取发生之前重置为零。
read 接口
ImageInputStream
read 方法重写,继承类
ImageInputStreamImpl
-1 EOF。
IOException如果流已关闭。
public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpl
len字节流,并将它们存储到
b从指数
off。如果没有字节可以读取因为已到达流的末尾,则返回
-1。
在流中的位偏移量必须在读取发生之前重置为零。
子类必须为这种方法提供一个实现。子类实现应在退出之前更新流位置。
read 接口
ImageInputStream
read 方法重写,继承类
ImageInputStreamImpl
b -字节被写入到数组。
off -起始位置在
b写。
len -的最大字节数读。
-1指示EOF。
IOException如果I/O错误发生。
public boolean isCached()
true因为这
ImageInputStream缓存数据以便寻求向后。
isCached 接口
ImageInputStream
isCached 方法重写,继承类
ImageInputStreamImpl
true。
isCachedMemory(),
isCachedFile()
public boolean isCachedFile()
true因为这
ImageInputStream保持文件缓存。
isCachedFile 接口
ImageInputStream
isCachedFile 方法重写,继承类
ImageInputStreamImpl
true。
isCached(),
isCachedMemory()
public boolean isCachedMemory()
false因为这
ImageInputStream不保持内存缓存。
isCachedMemory 接口
ImageInputStream
isCachedMemory 方法重写,继承类
ImageInputStreamImpl
false。
isCached(),
isCachedFile()
public void close()
throws IOException
FileCacheImageInputStream关闭,关闭和删除缓存文件。源
InputStream不是封闭的。
close 接口
Closeable
close 接口
AutoCloseable
close 接口
ImageInputStream
close 方法重写,继承类
ImageInputStreamImpl
IOException -如果出现错误。
protected void finalize()
throws Throwable
close方法来关闭任何打开的输入源。此方法不应该从应用程序代码调用。
finalize 方法重写,继承类
ImageInputStreamImpl
Throwable -如果在父类定型时发生错误。
WeakReference,
PhantomReference
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.