|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsteg.HammingCode
public class HammingCode
The Class encode/decodes a byte array with the 8/4 Hamming Code to correct one bit failure.
Constructor Summary | |
---|---|
HammingCode()
|
Method Summary | |
---|---|
byte |
decode(byte seq)
Decodes a byte h7, h6, h5, h4, h3, h2, h1, h0 p = h7 ^ h6 ^ h5 ^ h4 ^ h3 ^ h2 ^ h1 ^ h0 c0 = h7 ^ h5 ^ h1 ^ h0 c1 = h7 ^ h3 ^ h2 ^ h1 c2 = h5 ^ h4 ^ h3 ^ h1 If the parity, p, is correct (equal to 1) then either 0 or 2 errors occurred. |
byte[] |
decode(byte[] seq)
Decodes a byte array |
byte |
encode(byte seq)
The first four bits are used. |
byte[] |
encode(byte[] seq)
Encodes a byte array |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HammingCode()
Method Detail |
---|
public byte[] encode(byte[] seq)
encode
in interface CorrectionCode
seq
- the byte array to encode
public byte[] decode(byte[] seq)
decode
in interface CorrectionCode
seq
- the byte array to decode
public byte encode(byte seq)
seq
- the byte to encode
public byte decode(byte seq) throws java.lang.Exception
seq
- the byte to decode
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |