|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.klomp.snark.bencode.BDecoder
public class BDecoder
Decodes a bencoded stream to BEValue
s.
A bencoded byte stream can represent byte arrays, numbers, lists and
maps (dictionaries).
It currently contains a hack to indicate a name of a dictionary of
which a SHA-1 digest hash should be calculated (the hash over the
original bencoded bytes).
Constructor Summary | |
---|---|
BDecoder(java.io.InputStream in)
Initalizes a new BDecoder. |
Method Summary | |
---|---|
BEValue |
bdecode()
Gets the next indicator and returns either null when the stream has ended or bdecodes the rest of the stream and returns the appropriate BEValue encoded object. |
static BEValue |
bdecode(java.io.InputStream in)
Creates a new BDecoder and immediatly decodes the first value it sees. |
BEValue |
bdecodeBytes()
Returns the next bencoded value on the stream and makes sure it is a byte array. |
BEValue |
bdecodeList()
Returns the next bencoded value on the stream and makes sure it is a list. |
BEValue |
bdecodeMap()
Returns the next bencoded value on the stream and makes sure it is a map (dictonary). |
BEValue |
bdecodeNumber()
Returns the next bencoded value on the stream and makes sure it is a number. |
byte[] |
get_special_map_digest()
|
int |
getNextIndicator()
Returns what the next bencoded object will be on the stream or -1 when the end of stream has been reached. |
void |
set_special_map_name(java.lang.String name)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BDecoder(java.io.InputStream in)
InputStream
yet.
Method Detail |
---|
public byte[] get_special_map_digest()
public void set_special_map_name(java.lang.String name)
public static BEValue bdecode(java.io.InputStream in) throws java.io.IOException
InvalidBEncoding
- when the stream doesn't start with a
bencoded value or the stream isn't a bencoded stream at all.
java.io.IOException
- when somthing bad happens with the stream
to read from.public int getNextIndicator() throws java.io.IOException
java.io.IOException
public BEValue bdecode() throws java.io.IOException
java.io.IOException
public BEValue bdecodeBytes() throws java.io.IOException
java.io.IOException
public BEValue bdecodeNumber() throws java.io.IOException
java.io.IOException
public BEValue bdecodeList() throws java.io.IOException
java.io.IOException
public BEValue bdecodeMap() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |