java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.FileImageInputStream
- 所有已实现的接口:
-
Closeable,DataInput,AutoCloseable,ImageInputStream
从
File或RandomAccessFile获取输入的ImageInputStream实现。假定文件内容在对象的生命周期内保持稳定。
-
Field Summary
Fields declared in class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescription构造一个将从给定File读取的FileImageInputStream。构造一个将从给定RandomAccessFile读取的FileImageInputStream。 -
Method Summary
Methods declared in class javax.imageio.stream.ImageInputStreamImpl
checkClosed, close, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, 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
-
Constructor Details
-
FileImageInputStream
构造一个将从给定File读取的FileImageInputStream。在构造此对象和最后调用读取方法之间,文件内容不得更改。
- 参数:
-
f- 要读取的File。 - 抛出:
-
IllegalArgumentException- 如果f为null。 -
SecurityException- 如果存在安全管理器且不允许对文件进行读取访问。 -
FileNotFoundException- 如果f是目录或由于其他原因无法打开进行读取。 -
IOException- 如果发生I/O错误。
-
FileImageInputStream
构造一个将从给定RandomAccessFile读取的FileImageInputStream。在构造此对象和最后调用读取方法之间,文件内容不得更改。
- 参数:
-
raf- 要读取的RandomAccessFile。 - 抛出:
-
IllegalArgumentException- 如果raf为null。
-
-
Method Details
-
read
从类中复制的描述:ImageInputStreamImpl从流中读取一个字节,并将其作为介于0和255之间的int返回。如果达到EOF,则返回-1。子类必须为此方法提供实现。子类实现应在退出之前更新流位置。
在读取发生之前,流中的位偏移必须重置为零。
- 指定者:
-
read在接口ImageInputStream中 - 指定者:
-
read在类ImageInputStreamImpl中 - 返回:
-
流中下一个字节的值,如果达到EOF则返回
-1。 - 抛出:
-
IOException- 如果流已关闭。
-
read
从类中复制的描述:ImageInputStreamImpl从流中读取最多len个字节,并将它们存储到从索引off开始的b中。如果由于已达到流的末尾而无法读取任何字节,则返回-1。在读取发生之前,流中的位偏移必须重置为零。
子类必须为此方法提供实现。子类实现应在退出之前更新流位置。
- 指定者:
-
read在接口ImageInputStream中 - 指定者:
-
read在类ImageInputStreamImpl中 - 参数:
-
b- 要写入的字节数组。 -
off- 要写入的b中的起始位置。 -
len- 要读取的最大字节数。 - 返回:
-
实际读取的字节数,或
-1表示EOF。 - 抛出:
-
IOException- 如果发生I/O错误。
-
length
public long length()返回底层文件的长度,如果未知则返回-1。- 指定者:
-
length在接口ImageInputStream中 - 覆盖:
-
length在类ImageInputStreamImpl中 - 返回:
-
文件长度作为
long,或-1。
-
finalize
Deprecated, for removal: This API element is subject to removal in a future version.Finalization has been deprecated for removal. SeeObject.finalize()for background information and details about migration options.在垃圾回收之前完成此对象的处理。将调用close方法来关闭任何打开的输入源。此方法不应从应用程序代码中调用。- 覆盖:
-
finalize在类ImageInputStreamImpl中 - 抛出:
-
Throwable- 如果在超类终结期间发生错误。 - 参见:
-