Class BencodedString
- java.lang.Object
-
- org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
-
- org.johnnei.javatorrent.bittorrent.encoding.BencodedString
-
- All Implemented Interfaces:
IBencodedValue
public class BencodedString extends AbstractBencodedValue
A bencoded string.
-
-
Field Summary
-
Fields inherited from class org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
ENTRY_END_BYTES
-
-
Constructor Summary
Constructors Constructor Description BencodedString(byte[] value)Creates a new bencoded string based on the given value.BencodedString(String value)Creates a new bencoded string based on the given value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]asBytes()StringasString()byte[]serialize()StringtoString()-
Methods inherited from class org.johnnei.javatorrent.bittorrent.encoding.AbstractBencodedValue
asBigInteger, asList, asLong, asMap
-
-
-
-
Constructor Detail
-
BencodedString
public BencodedString(String value)
Creates a new bencoded string based on the given value.- Parameters:
value- The string to bencode.
-
BencodedString
public BencodedString(byte[] value)
Creates a new bencoded string based on the given value.- Parameters:
value- The string to bencode.
-
-
Method Detail
-
asString
public String asString()
- Specified by:
asStringin interfaceIBencodedValue- Overrides:
asStringin classAbstractBencodedValue- Returns:
- The bencoded value as a string.
-
asBytes
public byte[] asBytes()
- Specified by:
asBytesin interfaceIBencodedValue- Overrides:
asBytesin classAbstractBencodedValue- Returns:
- The bencoded value as a byte array.
-
serialize
public byte[] serialize()
- Returns:
- The value represented in bencoded format.
-
-