Class BencodedList
- java.lang.Object
-
- org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
-
- org.johnnei.javatorrent.bittorrent.encoding.BencodedList
-
- All Implemented Interfaces:
IBencodedValue
public class BencodedList extends AbstractBencodedValue
A bencoded list.
-
-
Field Summary
-
Fields inherited from class org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
ENTRY_END_BYTES
-
-
Constructor Summary
Constructors Constructor Description BencodedList()Creates a new empty bencoded list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(IBencodedValue value)Adds a value to the bencoded list.List<IBencodedValue>asList()IBencodedValueget(int index)Gets an item from the bencoded list.byte[]serialize()intsize()-
Methods inherited from class org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
asBigInteger, asBytes, asLong, asMap, asString
-
-
-
-
Method Detail
-
get
public IBencodedValue get(int index)
Gets an item from the bencoded list.- Parameters:
index- The index to get the item at.- Returns:
- The item at the given index.
-
add
public void add(IBencodedValue value)
Adds a value to the bencoded list.- Parameters:
value- The value to add.
-
size
public int size()
- Returns:
- The amount of bencoded items in this list.
-
asList
public List<IBencodedValue> asList()
- Specified by:
asListin interfaceIBencodedValue- Overrides:
asListin classAbstractBencodedValue- Returns:
- The bencoded value as a list.
-
serialize
public byte[] serialize()
- Returns:
- The value represented in bencoded format.
-
-