Class AbstractBencodedValue
- java.lang.Object
-
- org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
-
- All Implemented Interfaces:
IBencodedValue
- Direct Known Subclasses:
BencodedInteger,BencodedList,BencodedMap,BencodedString
public abstract class AbstractBencodedValue extends Object implements IBencodedValue
Base class for implementations forIBencodedValuewhich implements allasXmethods to throwUnsupportedOperationException
-
-
Field Summary
Fields Modifier and Type Field Description protected static byte[]ENTRY_END_BYTES
-
Constructor Summary
Constructors Constructor Description AbstractBencodedValue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigIntegerasBigInteger()byte[]asBytes()List<IBencodedValue>asList()longasLong()Map<String,IBencodedValue>asMap()StringasString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.johnnei.javatorrent.bittorrent.encoding.IBencodedValue
serialize
-
-
-
-
Method Detail
-
asString
public String asString()
- Specified by:
asStringin interfaceIBencodedValue- Returns:
- The bencoded value as a string.
-
asBytes
public byte[] asBytes()
- Specified by:
asBytesin interfaceIBencodedValue- Returns:
- The bencoded value as a byte array.
-
asMap
public Map<String,IBencodedValue> asMap()
- Specified by:
asMapin interfaceIBencodedValue- Returns:
- The bencoded value as a map.
-
asList
public List<IBencodedValue> asList()
- Specified by:
asListin interfaceIBencodedValue- Returns:
- The bencoded value as a list.
-
asLong
public long asLong()
- Specified by:
asLongin interfaceIBencodedValue- Returns:
- The bencoded value as a long.
-
asBigInteger
public BigInteger asBigInteger()
- Specified by:
asBigIntegerin interfaceIBencodedValue- Returns:
- The bencoded value as a big integer.
-
-