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 - スーパークラスのファイナライズ時にエラーが発生した場合。 バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.