Interface IBencodedValue
-
- All Known Implementing Classes:
AbstractBencodedValue,BencodedInteger,BencodedList,BencodedMap,BencodedString
public interface IBencodedValueRepresents a value which was bencoded.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description BigIntegerasBigInteger()byte[]asBytes()List<IBencodedValue>asList()longasLong()Map<String,IBencodedValue>asMap()StringasString()byte[]serialize()
-
-
-
Method Detail
-
asString
String asString()
- Returns:
- The bencoded value as a string.
- Throws:
UnsupportedOperationException- When the stored type is not a string.
-
asBytes
byte[] asBytes()
- Returns:
- The bencoded value as a byte array.
- Throws:
UnsupportedOperationException- When the stored type is not a string.
-
asLong
long asLong()
- Returns:
- The bencoded value as a long.
- Throws:
UnsupportedOperationException- When the stored type is not a long or overflows a long.
-
asBigInteger
BigInteger asBigInteger()
- Returns:
- The bencoded value as a big integer.
- Throws:
UnsupportedOperationException- When the stored type is not a big integer.
-
asMap
Map<String,IBencodedValue> asMap()
- Returns:
- The bencoded value as a map.
- Throws:
UnsupportedOperationException- When the stored type is not a map.
-
asList
List<IBencodedValue> asList()
- Returns:
- The bencoded value as a list.
- Throws:
UnsupportedOperationException- When the stored type is not a list.
-
serialize
byte[] serialize()
- Returns:
- The value represented in bencoded format.
-
-