java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
javax.imageio.stream.ImageOutputStreamImpl
javax.imageio.stream.FileImageOutputStream
- 所有已实现的接口:
-
Closeable,DataInput,DataOutput,AutoCloseable,ImageInputStream,ImageOutputStream
实现了
ImageOutputStream接口,直接将输出写入File或RandomAccessFile的类。
-
Field Summary
Fields declared in class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescription构造一个将写入给定File的FileImageOutputStream。构造一个将写入给定RandomAccessFile的FileImageOutputStream。 -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()关闭流。protected voidfinalize()已弃用,将来会移除: 该API元素可能在将来的版本中被移除。终结已被标记为将来移除。longlength()返回-1L表示流的长度未知。intread()从流中读取一个字节,并将其作为介于0和255之间的int返回。intread(byte[] b, int off, int len) 从流中读取最多len个字节,并将它们存储到从索引off开始的b中。voidseek(long pos) 设置当前流位置并将位偏移重置为0。voidwrite(byte[] b, int off, int len) 在当前位置向流中写入一系列字节。voidwrite(int b) 在当前位置向流中写入一个字节。Methods declared in class javax.imageio.stream.ImageOutputStreamImpl
flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTFMethods declared in class javax.imageio.stream.ImageInputStreamImpl
checkClosed, close, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, 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, setBitOffset, setByteOrder, skipBytes, skipBytesMethods declared in class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface javax.imageio.stream.ImageInputStream
flush, 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, setBitOffset, setByteOrder, skipBytes, skipBytesMethods declared in interface javax.imageio.stream.ImageOutputStream
flushBefore
-
Constructor Details
-
FileImageOutputStream
构造一个将写入给定File的FileImageOutputStream。- 参数:
-
f- 要写入的File。 - 抛出:
-
IllegalArgumentException- 如果f为null。 -
SecurityException- 如果存在安全管理器且不允许对文件进行写访问。 -
FileNotFoundException- 如果f不表示常规文件或由于其他原因无法打开以供读取和写入。 -
IOException- 如果发生I/O错误。
-
FileImageOutputStream
构造一个将写入给定RandomAccessFile的FileImageOutputStream。- 参数:
-
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- 要写入的数据中的起始位置。 -
len- 要读取的最大字节数。 - 返回:
-
实际读取的字节数,或
-1表示EOF。 - 抛出:
-
IOException- 如果发生I/O错误。
-
write
从接口中复制的描述:ImageOutputStream在当前位置向流中写入一个字节。忽略b的24个高阶位。如果流中的位偏移不为零,则当前字节的其余部分将填充为0并首先写出。写入后,位偏移将为0。实现者可以使用
flushBits方法的ImageOutputStreamImpl来保证这一点。- 参数:
-
b- 要写入其低8位的int。 - 抛出:
-
IOException- 如果发生I/O错误。
-
write
从接口中复制的描述:ImageOutputStream在当前位置向流中写入一系列字节。如果len为0,则不写入任何内容。首先写入字节b[off],然后是字节b[off + 1],依此类推。如果流中的位偏移不为零,则当前字节的其余部分将填充为0并首先写出。写入后,位偏移将为0。实现者可以使用
flushBits方法的ImageOutputStreamImpl来保证这一点。- 参数:
-
b- 要写入的byte数组。 -
off- 数据中的起始偏移量。 -
len- 要写入的byte数。 - 抛出:
-
IOException- 如果发生I/O错误。
-
length
public long length()从类中复制的描述:ImageInputStreamImpl返回-1L表示流的长度未知。子类必须重写此方法以提供实际长度信息。- 指定者:
-
length在接口ImageInputStream中 - 覆盖:
-
length在类ImageInputStreamImpl中 - 返回:
- -1L表示长度未知。
-
seek
设置当前流位置并将位偏移重置为0。可以合法地寻找超出文件末尾;只有在执行读取时才会抛出EOFException。直到执行写入操作,文件长度不会增加。- 参数:
-
pos- 包含所需文件指针位置的long。 - 抛出:
-
IndexOutOfBoundsException- 如果pos小于刷新位置。 -
IOException- 如果发生其他I/O错误。
-
close
从接口中复制的描述:ImageInputStream关闭流。尝试访问已关闭的流可能导致IOException或不正确的行为。调用此方法可能允许实现此接口的类释放与流相关的资源,如内存、磁盘空间或文件描述符。- 抛出:
-
IOException- 如果发生I/O错误。
-
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- 如果在超类终结期间发生错误。 - 参见:
-