|
LHA Library for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
jp.gr.java_conf.dangan.util.lha.LhaInputStream
public class LhaInputStream
接続されたストリームからLHA書庫データを読みこみ、
エントリを解凍しつつ読み込むためのユーティリティクラス。
java.util.zip.ZipInputStream と似たインターフェイスを持つように作った。
壊れた書庫の処理に関しては壊れたエントリ以降の
壊れていないエントリも正常に読みこめない可能性がある。
-- revision history --
$Log: LhaInputStream.java,v $
Revision 1.1.2.1 2003/07/20 13:22:31 dangan
[bug fix]
getNextEntry() で CompressMethod.connectDecoder に
this.limit を渡すべきところで this.in を渡していた。
Revision 1.1 2002/12/08 00:00:00 dangan
[maintenance]
LhaConstants から CompressMethod へのクラス名の変更に合わせて修正。
Revision 1.0 2002/08/05 00:00:00 dangan
add to version control
[change]
コンストラクタから 引数に String encode を取るものを廃止、
Properties を引数に取るものを追加。
書庫終端に達した場合はそれ以上読み込めないように修正。
available() の振る舞いを java.util.zip.ZipInputStream と同じように
エントリの終端に達していない場合は 1 エントリの終端に達した場合は 0 を返すように変更。
[maintenance]
ソース整備
タブ廃止
ライセンス文の修正
| Constructor Summary | |
|---|---|
LhaInputStream(java.io.InputStream in)
in から LHA書庫のデータを読み取る InputStream を構築する。 各圧縮形式に対応した復号器の生成式等を持つプロパティには LhaProperty.getProperties() で得られたプロパティが使用される。 |
|
LhaInputStream(java.io.InputStream in,
java.util.Properties property)
in から LHA書庫のデータを読み取る InputStreamを構築する。 |
|
| Method Summary | |
|---|---|
int |
available()
現在読み取り中のエントリの終端に達したかを得る。 ブロックしないで読み込めるデータ量を返さない事に注意すること。 |
void |
close()
この入力ストリームを閉じ、使用していた 全てのリソースを開放する。 |
void |
closeEntry()
現在読み取り中のエントリを閉じ、 次のエントリを読みこめるようにストリームを設定する。 |
LhaHeader |
getNextEntry()
次のエントリを解凍しながら読みこむようにストリームを設定する。 |
LhaHeader |
getNextEntryWithoutExtract()
次のエントリを解凍しないで読みこむようにストリームを設定する。 |
void |
mark(int readLimit)
現在読み取り中のエントリの現在位置にマークを設定し、 reset() でマークした読み込み位置に戻れるようにする。 |
boolean |
markSupported()
接続された入力ストリームが mark()と reset()をサポートするかを得る。 ヘッダ読み込み時に mark/reset が必須のため コンストラクタで渡された in が markSupported() で false を返す場合、このクラスは in を mark/reset をサポートする BufferedInputStream でラップする。 そのため、このメソッドは常に true を返す。 |
int |
read()
現在のエントリから 1バイトのデータを読み込む。 |
int |
read(byte[] buffer)
現在のエントリから buffer を満たすようにデータを読み込む。 |
int |
read(byte[] buffer,
int index,
int length)
現在のエントリから buffer のindexへ lengthバイトの データをを読み込む。 |
void |
reset()
現在読み取り中のエントリの読み込み位置を最後に mark() メソッドが呼び出されたときの位置に設定する。 |
long |
skip(long length)
現在のエントリのデータを length バイト読みとばす。 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LhaInputStream(java.io.InputStream in)
in - LHA書庫形式のデータを供給する入力ストリームLhaProperty.getProperties()
public LhaInputStream(java.io.InputStream in,
java.util.Properties property)
throws java.io.UnsupportedEncodingException
in - LHA書庫形式のデータを供給する入力ストリームproperty - 各圧縮形式に対応した復号器の生成式等が含まれるプロパティ
java.io.UnsupportedEncodingException - property.getProperty( "lha.encoding" ) で得られた
エンコーディング名がサポートされない場合| Method Detail |
|---|
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合
public int read(byte[] buffer)
throws java.io.IOException
read in class java.io.InputStreambuffer - データを読み込むバッファ
java.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合
public int read(byte[] buffer,
int index,
int length)
throws java.io.IOException
read in class java.io.InputStreambuffer - データを読み込むバッファindex - buffer内のデータ読み込み開始位置length - 読み込むデータ量
java.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合
public long skip(long length)
throws java.io.IOException
skip in class java.io.InputStreamlength - 読みとばすデータ量
java.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合public void mark(int readLimit)
mark in class java.io.InputStreamreadLimit - マーク位置に戻れる限界読み込み量。
このバイト数を超えてデータを読み込んだ場合
reset() できる保証はない。
java.lang.IllegalStateException - 現在読み込み中のエントリが無い場合
public void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合public boolean markSupported()
markSupported in class java.io.InputStream
public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException - 現在読み込み中のエントリが無いか
入出力エラーが発生した場合ZipInputStream.available()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.InputStreamjava.io.IOException - 入出力エラーが発生した場合
public LhaHeader getNextEntry()
throws java.io.IOException
java.io.IOException - 入出力エラーが発生した場合
public LhaHeader getNextEntryWithoutExtract()
throws java.io.IOException
java.io.IOException - 入出力エラーが発生した場合
public void closeEntry()
throws java.io.IOException
java.io.IOException - 入出力エラーが発生した場合
|
LHA Library for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||