public class MemoryCacheImageOutputStream extends ImageOutputStreamImpl
OutputStreamに書き込むImageOutputStreamの実装です。メモリー・バッファには、少なくとも破棄位置と現在の書込み位置との間のデータがキャッシュされます。OutputStreamを使用するのはコンストラクタのみなので、このクラスは読み込み、変更、または書込み操作に使用できない場合があります。読込みは、キャッシュに書込み済みでまだフラッシュされていないストリーム部分についてのみ行うことができます。bitOffset, byteOrder, flushedPos, streamPos| コンストラクタと説明 |
|---|
MemoryCacheImageOutputStream(OutputStream stream)
指定された
OutputStreamに書き込むMemoryCacheImageOutputStreamを構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
close()
この
MemoryCacheImageOutputStreamを閉じます。 |
void |
flushBefore(long pos)
指示された位置より前のストリームの先頭部分を破棄します。
|
boolean |
isCached()
後方へのシークを可能にするために、この
ImageOutputStreamがデータをキャッシュするため、trueが返されます。 |
boolean |
isCachedFile()
この
ImageOutputStreamはファイル・キャッシュを維持しないため、falseが返されます。 |
boolean |
isCachedMemory()
この
ImageOutputStreamはメイン・メモリー・キャッシュを維持するため、trueが返されます。 |
long |
length()
ストリームが未知の長さであることを示す
-1Lを返します。 |
int |
read()
ストリームから1バイトを読み込み、それを0から255までの
intとして返します。 |
int |
read(byte[] b, int off, int len)
ストリームから最大
lenバイトを読み込み、bにインデックスoffから格納します。 |
void |
write(byte[] b, int off, int len)
バイトのシーケンスをストリームの現在位置に書き込みます。
|
void |
write(int b)
ストリームの現在の位置に1バイト書き込みます。
|
flushBits, write, writeBit, writeBits, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeChars, writeDouble, writeDoubles, writeFloat, writeFloats, writeInt, writeInts, writeLong, writeLongs, writeShort, writeShorts, writeUTFcheckClosed, finalize, flush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, 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, skipBytesclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflush, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, 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 MemoryCacheImageOutputStream(OutputStream stream)
OutputStreamに書き込むMemoryCacheImageOutputStreamを構築します。stream - 書込み先のOutputStream。IllegalArgumentException - streamがnullの場合。public int read()
throws IOException
ImageInputStreamImplintとして返します。EOFに達すると-1を返します。
サブクラスでこのメソッドを実装する必要があります。サブクラス実装で終了する前にストリーム位置を更新します。
ストリーム内のビット・オフセットは、読込みを行う前に0にリセットする必要があります。
read、インタフェース: ImageInputStreamread、クラス: ImageInputStreamImpl-1。IOException - ストリームが閉じられている場合。public int read(byte[] b,
int off,
int len)
throws IOException
ImageInputStreamImpllenバイトを読み込み、bにインデックスoffから格納します。ストリームの終わりに達したためにバイトを読み込めない場合は、-1を返します。
ストリーム内のビット・オフセットは、読込みを行う前に0にリセットする必要があります。
サブクラスでこのメソッドを実装する必要があります。サブクラス実装で終了する前にストリーム位置を更新します。
read、インタフェース: ImageInputStreamread、クラス: ImageInputStreamImplb - 書き込まれるバイト配列。off - 書込み先のb内の開始位置。len - 読み込む最大バイト数。-1。IOException - 入出力エラーが発生した場合。public void write(int b)
throws IOException
ImageOutputStreambの上位24ビットは無視されます。
ストリーム内のビット・オフセットがゼロでない場合、現在のバイトの残りは0でパディングされ、最初に書き込まれます。書込み後は、ビット・オフセットは0です。実装側は、ImageOutputStreamImplのflushBitsメソッドを使用してこれを保証できます。
write、インタフェース: DataOutputwrite、インタフェース: ImageOutputStreamwrite、クラス: ImageOutputStreamImplb - 下位8ビットが書き込まれるint。IOException - 入出力エラーが発生した場合。public void write(byte[] b,
int off,
int len)
throws IOException
ImageOutputStreamlenが0の場合、何も書き込みません。バイトb[off]を最初に書き込み、次にバイトb[off+1]を書き込む、という具合になります。
ストリーム内のビット・オフセットがゼロでない場合、現在のバイトの残りは0でパディングされ、最初に書き込まれます。書込み後は、ビット・オフセットは0です。実装側は、ImageOutputStreamImplのflushBitsメソッドを使用してこれを保証できます。
write、インタフェース: DataOutputwrite、インタフェース: ImageOutputStreamwrite、クラス: ImageOutputStreamImplb - 書き込まれるbyte配列。off - データの開始オフセット。len - 書き込むbyte数。IOException - 入出力エラーが発生した場合。public long length()
ImageInputStreamImpl-1Lを返します。サブクラスでこのメソッドをオーバーライドして、実際の長さの情報を指定する必要があります。length、インタフェース: ImageInputStreamlength、クラス: ImageInputStreamImplpublic boolean isCached()
ImageOutputStreamがデータをキャッシュするため、trueが返されます。isCached、インタフェース: ImageInputStreamisCached、クラス: ImageInputStreamImpltrue。isCachedMemory(), isCachedFile()public boolean isCachedFile()
ImageOutputStreamはファイル・キャッシュを維持しないため、falseが返されます。isCachedFile、インタフェース: ImageInputStreamisCachedFile、クラス: ImageInputStreamImplfalse。isCached(), isCachedMemory()public boolean isCachedMemory()
ImageOutputStreamはメイン・メモリー・キャッシュを維持するため、trueが返されます。isCachedMemory、インタフェース: ImageInputStreamisCachedMemory、クラス: ImageInputStreamImpltrue。isCached(), isCachedFile()public void close()
throws IOException
MemoryCacheImageOutputStreamを閉じます。保留中のデータはすべて出力にフラッシュされ、キャッシュは解放されます。出力先OutputStreamは閉じられません。close、インタフェース: Closeableclose、インタフェース: AutoCloseableclose、インタフェース: ImageInputStreamclose、クラス: ImageInputStreamImplIOException - 入出力エラーが発生した場合。public void flushBefore(long pos)
throws IOException
ImageInputStreamIndexOutOfBoundsExceptionがスローされます。
flushBeforeを呼び出すと、このインタフェースを実装するクラスが、ストリームからデータを格納するのに使用するメモリーやディスク・スペースなどのリソースを解放できます。
flushBefore、インタフェース: ImageInputStreamflushBefore、インタフェース: ImageOutputStreamflushBefore、クラス: ImageInputStreamImplpos - フラッシュされるストリーム接頭辞の長さを示すlong。IOException - 入出力エラーが発生した場合。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.