public class FileImageOutputStream extends ImageOutputStreamImpl
FileまたはRandomAccessFileに直接書き込むImageOutputStreamの実装です。bitOffset, byteOrder, flushedPos, streamPos| コンストラクタと説明 |
|---|
FileImageOutputStream(File f)
指定された
Fileに書き込むFileImageOutputStreamを構築します。 |
FileImageOutputStream(RandomAccessFile raf)
指定された
RandomAccessFileに書き込むFileImageOutputStreamを構築します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void |
close()
ストリームを閉じます。
|
protected void |
finalize()
ガベージ・コレクションの前にこのオブジェクトをファイナライズします。
|
long |
length()
ストリームが未知の長さであることを示す
-1Lを返します。 |
int |
read()
ストリームから1バイトを読み込み、それを0から255までの
intとして返します。 |
int |
read(byte[] b, int off, int len)
ストリームから最大
lenバイトを読み込み、bにインデックスoffから格納します。 |
void |
seek(long pos)
現在のストリーム位置を設定してビット・オフセットを0にリセットします。
|
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, 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, setBitOffset, setByteOrder, skipBytes, skipBytesclone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflushBeforeflush, 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, skipBytespublic FileImageOutputStream(File f) throws FileNotFoundException, IOException
Fileに書き込むFileImageOutputStreamを構築します。f - 書込み先のFile。IllegalArgumentException - fがnullの場合。SecurityException - セキュリティ・マネージャが存在し、ファイルへの書込みアクセスが許可されない場合。FileNotFoundException - fが通常のファイルを示さないか、ほかの何らかの理由で読み込みおよび書込み用に開くことができない場合。IOException - 入出力エラーが発生した場合。public FileImageOutputStream(RandomAccessFile raf)
RandomAccessFileに書き込むFileImageOutputStreamを構築します。raf - 書込み先のRandomAccessFile。IllegalArgumentException - rafが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 void seek(long pos)
throws IOException
EOFExceptionは読込みの場合のみスローされます。書込みが実行されるまで、ファイル長は増加しません。seek、インタフェース: ImageInputStreamseek、クラス: ImageInputStreamImplpos - 目的のファイル・ポインタ位置を示すlong。IndexOutOfBoundsException - posがフラッシュ位置よりも小さい場合。IOException - その他の入出力エラーが発生した場合。public void close()
throws IOException
ImageInputStreamIOExceptionがスローされるか不正な動作が実行される場合があります。このメソッドを呼び出すと、このインタフェースを実装するクラスが、メモリー、ディスク・スペース、またはファイル記述子などのストリームに関連するリソースを解放できます。close、インタフェース: Closeableclose、インタフェース: AutoCloseableclose、インタフェース: ImageInputStreamclose、クラス: ImageInputStreamImplIOException - 入出力エラーが発生した場合。protected void finalize()
throws Throwable
closeメソッドを呼び出して、開いている入力ソースをすべて閉じます。このメソッドを、アプリケーション・コードから呼び出してはいけません。finalize、クラス: ImageInputStreamImplThrowable - スーパー・クラスのファイナライズ時にエラーが発生した場合。WeakReference, PhantomReference バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.