SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:Welcome to the Ranch!
All these parts that start with [B are byte arrays. When you print a byte[], its toString() method will print the type name ([B) followed by an @ and the hexadecimal hash code. This is how you get to something like [B@141d683.
created by=[B@141d683 => byte[]
announce=[B@16a55fa => byte[]
encoding=[B@32c41a => byte[]
announce-list=[[[B@e89b94], [[B@13e205f], [[B@1bf73fa]] => see below
comment=[B@5740bb => byte[]
creation date=1310060702 => int or long, probably long
info={pieces=[B@5ac072, name=[B@109a4c, length=34209795, piece length=65536, private=1} => see below
First of all, the announce list. You see not one but three starting [ characters. If used without closing ] character that means another array dimension. For example, [[B@e89b94 would be a byte[][] and [[[B@e89b94 a byte[][][]. However, there are closing ] characters. That means that it's not another array dimension, but a List, Set or other Collection; these are usually printed as [] with the elements inside separated by a comma and space. Matching the brackets you get this structure (using Collection since List and Set both extend Collection):
- Collection
-- Collection with one byte[]
-- Collection with one byte[]
-- Collection with one byte[]
Now, info. The {} with inside key=value pair usually indicates a Map. In this case it has the following entries:
- pieces => byte[]
- name => byte[]
- length => Integer or Long
- piece length => Integer or Long
- private => Byte, Short, Integer or Long
Afterwards, I'm guessing that you can turn each byte[] into a String, by using the right String constructor and providing the right encoding. Which one that is I can't tell you, but I'd probably start with UTF-8.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:What error are you getting? Please post the full stack trace.