public class LimitedInputStream
extends java.io.InputStream
-- revision history -- $Log: LimitedInputStream.java,v $ Revision 1.1.2.1 2003/07/20 17:03:37 dangan [maintenance] 最新の LimitedInputStream からソースを取り込む。 Revision 1.1 2002/12/05 00:00:00 dangan [maintenance] ソース整備 Revision 1.0 2002/07/24 00:00:00 dangan add to version control [change] EndOfStream に達した後の read( new byte[0] ) や read( byte[] buf, int off, 0 ) の戻り値を InputStream と同じく 0 になるようにした [maintenance] タブ廃止 ライセンス文の修正
Constructor and Description |
---|
LimitedInputStream(java.io.InputStream in,
long limit)
in からの読み込み可能なデータ量を制限した
入力ストリームを構築する。
|
Modifier and Type | Method and Description |
---|---|
int |
available()
接続された入力ストリームからブロックしないで
読み込むことのできるバイト数を得る。
|
void |
close()
この入力ストリームを閉じ、使用していた
全てのリソースを開放する。
|
void |
mark(int readLimit)
接続された入力ストリームの現在位置にマークを設定し、
reset() メソッドでマークした時点の 読み込み位置に
戻れるようにする。
|
boolean |
markSupported()
接続された入力ストリームが mark() と reset() を
サポートするかを得る。
|
int |
read()
接続された入力ストリームから 1バイトのデータを読み込む。
|
int |
read(byte[] buffer)
接続された入力ストリームから buffer を満たすように
データを読み込む。
データは必ずしも buffer を満たすとは限らないことに注意。 |
int |
read(byte[] buffer,
int index,
int length)
接続された入力ストリームから バイト配列 buffer の
index で指定された位置から length バイトのデータを
読み込む。
データは必ずしも length バイト読み込まれるとは限ら ないことに注意。 |
void |
reset()
接続された入力ストリームの読み込み位置を最後に
mark() メソッドが呼び出されたときの位置に設定する。
|
long |
skip(long length)
接続された入力ストリームのデータを length バイト読み飛ばす。
|
public LimitedInputStream(java.io.InputStream in, long limit)
in
- 入力ストリームlimit
- 読み込み可能バイト数java.lang.IllegalArgumentException
- limit が負数である場合public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
- 入出力エラーが発生した場合public int read(byte[] buffer) throws java.io.IOException
read
in class java.io.InputStream
buffer
- 読み込んだデータを格納するためのバイト配列java.io.IOException
- 入出力エラーが発生した場合public int read(byte[] buffer, int index, int length) throws java.io.IOException
read
in class java.io.InputStream
buffer
- 読み込まれたデータを格納するためのバイト配列index
- buffer内のデータ読み込み開始位置length
- bufferに読み込むデータ量java.io.IOException
- 入出力エラーが発生した場合public long skip(long length) throws java.io.IOException
skip
in class java.io.InputStream
length
- 読み飛ばすバイト数。java.io.IOException
- 入出力エラーが発生した場合public void mark(int readLimit)
mark
in class java.io.InputStream
readLimit
- マーク位置に戻れる限界のバイト数。
このバイト数を超えてデータを読み
込んだ場合 reset()できなくなる可
能性がある。public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
- public boolean markSupported()
markSupported
in class java.io.InputStream
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- 入出力エラーが発生した場合public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
- 入出力エラーが発生した場合
When you found typographical errors or omissions, Please mail to cqw10305@nifty.com
The company name and product name which are used in this document, it is the trademark or registered trademark of each company generally.
Copyright © 2001-2002 Michel Ishizuka. All Rights Reserved.