- java.lang.Object
-
- javax.imageio.stream.ImageInputStreamImpl
-
- javax.imageio.stream.FileCacheImageInputStream
-
- 实现的所有接口
-
Closeable,DataInput,AutoCloseable,ImageInputStream
public class FileCacheImageInputStream extends ImageInputStreamImpl
ImageInputStream的实现,从常规InputStream获取其输入。 文件用于缓存先前读取的数据。
-
-
字段汇总
-
声明的属性在类 javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
-
-
构造方法摘要
构造方法 构造器 描述 FileCacheImageInputStream(InputStream stream, File cacheDir)构造一个FileCacheImageInputStream,它将从给定的InputStream读取。
-
方法摘要
所有方法 实例方法 具体的方法 弃用的方法 变量和类型 方法 描述 voidclose()关闭此FileCacheImageInputStream,关闭并删除缓存文件。protected voidfinalize()已过时。finalize方法已被弃用。booleanisCached()返回true因为此ImageInputStream缓存数据以便允许向后搜索。booleanisCachedFile()返回true因为此ImageInputStream维护文件缓存。booleanisCachedMemory()返回false因为此ImageInputStream未维护主内存缓存。-
声明方法的类 javax.imageio.stream.ImageInputStreamImpl
checkClosed, length, mark, read, read, read, reset, skipBytes, skipBytes
-
声明方法的类 java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
声明方法的接口 javax.imageio.stream.ImageInputStream
flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, seek, setBitOffset, setByteOrder
-
-
-
-
构造方法详细信息
-
FileCacheImageInputStream
public FileCacheImageInputStream(InputStream stream, File cacheDir) throws IOException
构造一个FileCacheImageInputStream将从给定的阅读InputStream。临时文件用作缓存。 如果
cacheDir是非null并且是目录,则将在此处创建该文件。 如果是null,将使用系统相关的默认临时文件目录(有关详细信息,请参阅File.createTempFile的文档)。- 参数
-
stream- 从InputStream中读取。 -
cacheDir-一个File表明,其中的缓存文件应该被创建,或null使用系统目录下。 - 异常
-
IllegalArgumentException- 如果stream是null。 -
IllegalArgumentException- 如果cacheDir非null但不是目录。 -
IOException- 如果无法创建缓存文件。
-
-
方法详细信息
-
isCached
public boolean isCached()
返回true因为此ImageInputStream缓存数据以便允许向后搜索。- Specified by:
-
isCached在接口ImageInputStream - 重写:
-
isCached类ImageInputStreamImpl - 结果
-
true。 - 另请参见:
-
isCachedMemory(),isCachedFile()
-
isCachedFile
public boolean isCachedFile()
返回true因为此ImageInputStream维护文件缓存。- Specified by:
-
isCachedFile接口ImageInputStream - 重写:
-
isCachedFile在类ImageInputStreamImpl - 结果
-
true。 - 另请参见:
-
isCached(),isCachedMemory()
-
isCachedMemory
public boolean isCachedMemory()
返回false因为此ImageInputStream不维护主内存缓存。- Specified by:
-
isCachedMemory接口ImageInputStream - 重写:
-
isCachedMemory类ImageInputStreamImpl - 结果
-
false。 - 另请参见:
-
isCached(),isCachedFile()
-
close
public void close() throws IOException关闭此FileCacheImageInputStream,关闭并删除缓存文件。 源InputStream未关闭。- 异常
-
IOException- 如果发生错误。
-
finalize
@Deprecated(since="9") protected void finalize() throws Throwable
Deprecated.Thefinalizemethod has been deprecated. Subclasses that overridefinalizein order to perform cleanup should be modified to use alternative cleanup mechanisms and to remove the overridingfinalizemethod. When overriding thefinalizemethod, its implementation must explicitly ensure thatsuper.finalize()is invoked as described inObject.finalize(). See the specification forObject.finalize()for further information about migration options.在垃圾回收之前完成此对象。 调用close方法以关闭任何打开的输入源。 不应从应用程序代码调用此方法。- 重写:
-
finalize类ImageInputStreamImpl - 异常
-
Throwable- 如果在超类完成期间发生错误。 - 另请参见:
-
WeakReference,PhantomReference
-
-