|
LHA Library for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjp.gr.java_conf.dangan.util.lha.CRC16
public class CRC16
CRC16値を算出するためのクラス。 クラス内の定数、処理、説明は
C言語によるアルゴリズム辞典 奥村晴彦著 技術評論社 ISBN4-87408-414-1 C3055 2400円(購入当時)によった。
-- revision history --
$Log: CRC16.java,v $
Revision 1.0 2002/07/24 00:00:00 dangan
add to version control
[maintanance]
ソース整備
タブ廃止
ライセンス文の変更
| Field Summary | |
|---|---|
static int |
CCITT_INIT
CCITT の X.25という規格の crc の初期値。 |
static int |
CCITT_POLY
CCITT の X.25という規格の 多項式 x^16 + x^12 + x^5 + 1 をビット表現にしたもの。 |
static int |
CRC_ANSY_INIT
LHAで使用される crc の初期値。 作者が勝手に設定した値であり、 CRC-ANSY でこの値が初期値として 定められているかは知らない。 |
static int |
CRC_ANSY_POLY
CRC-ANSY または CRC-16 として有名な 多項式 x^16 + x^15 + x^2 + 1 をビット表現にしたもの。 |
static int |
DefaultINIT
LHAで通常使用される、という意味でデフォルトのcrcの初期値。 CRC16.CRC_ANSY_INIT と同等である。 |
static int |
DefaultPOLY
LHAで通常使用される、という意味でデフォルトのCRC多項式。 CRC16.CRC_ANSY_POLY と同等である。 |
| Constructor Summary | |
|---|---|
CRC16()
LHAで使用される 多項式と初期値を持つ CRC16を生成する。 |
|
CRC16(int poly)
poly で指定される 多項式を持つ CRC16を生成する。 初期値は poly が CRC16.CCITT_POLY であれば CRC16.CCITT_INIT を そうでなければ CRC16.DefaultINIT を使用する。 |
|
CRC16(int[] crcTable,
int init)
crcTable で指定される CRC算出用表と initで指定される初期値を持つ CRC16を作成する。 |
|
CRC16(int poly,
int init)
poly で指定される 多項式と initで指定される初期値を持つ CRC16を生成する。 |
|
| Method Summary | |
|---|---|
long |
getValue()
crc 値を得る。 crc 値は 2バイトの値であり、 0x0000〜0xFFFFにマップされる。 |
static int[] |
makeCrcTable(int poly)
CRC値算出用の 表を作成する。 |
void |
reset()
crc 値を初期値に設定しなおす。 |
void |
update(byte[] buffer)
buffer で指定したバイト配列で crc の値を更新する。 |
void |
update(byte[] buffer,
int index,
int length)
buffer で指定したバイト配列で crc の値を更新する。 |
void |
update(int byte8)
byte8 で指定される 1バイトのデータで crcの値を更新する。 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CRC_ANSY_POLY
public static final int CRC_ANSY_INIT
public static final int CCITT_POLY
public static final int CCITT_INIT
public static final int DefaultPOLY
public static final int DefaultINIT
| Constructor Detail |
|---|
public CRC16()
public CRC16(int poly)
poly - CRC16算出に使用する多項式のビット表現
public CRC16(int poly,
int init)
poly - CRC16算出に使用する多項式のビット表現init - crc の初期値
public CRC16(int[] crcTable,
int init)
crcTable - CRC16算出に使用する表init - crc の初期値| Method Detail |
|---|
public void update(int byte8)
update in interface java.util.zip.Checksumbyte8 - crcを更新する 1バイトのデータpublic void update(byte[] buffer)
buffer - crcを更新する データを持つバイト配列
public void update(byte[] buffer,
int index,
int length)
update in interface java.util.zip.Checksumbuffer - crcを更新する データを持つバイト配列index - データの開始位置length - チェックサムの更新に使うバイト数public void reset()
reset in interface java.util.zip.Checksumpublic long getValue()
getValue in interface java.util.zip.Checksumpublic static int[] makeCrcTable(int poly)
poly - CRC算出用の多項式
|
LHA Library for Java | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||