public class BEncodedValue extends Object
| Constructor and Description |
|---|
BEncodedValue(byte[] value) |
BEncodedValue(int value) |
BEncodedValue(List<BEncodedValue> value) |
BEncodedValue(long value) |
BEncodedValue(Map<String,BEncodedValue> value) |
BEncodedValue(Number value) |
BEncodedValue(String value) |
BEncodedValue(String value,
String enc) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBytes()
Returns this BEValue as a byte[].
|
int |
getInt()
Returns this BEValue as int.
|
List<BEncodedValue> |
getList()
Returns this BEValue as a List of BEValues.
|
long |
getLong()
Returns this BEValue as long.
|
Map<String,BEncodedValue> |
getMap()
Returns this BEValue as a Map of String keys and BEValue values.
|
Number |
getNumber()
Returns this BEValue as a Number.
|
short |
getShort()
Returns this BEValue as short.
|
String |
getString()
Returns this BEValue as a String, interpreted as UTF-8.
|
String |
getString(String encoding)
Returns this BEValue as a String, interpreted with the specified
encoding.
|
Object |
getValue() |
public BEncodedValue(byte[] value)
public BEncodedValue(String value) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic BEncodedValue(String value, String enc) throws UnsupportedEncodingException
UnsupportedEncodingExceptionpublic BEncodedValue(int value)
public BEncodedValue(long value)
public BEncodedValue(Number value)
public BEncodedValue(List<BEncodedValue> value)
public BEncodedValue(Map<String,BEncodedValue> value)
public Object getValue()
public String getString() throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a byte[].public String getString(String encoding) throws InvalidBEncodingException
encoding - The encoding to interpret the bytes as when converting
them into a String.InvalidBEncodingException - If the value is not a byte[].public byte[] getBytes()
throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a byte[].public Number getNumber() throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a Number.public short getShort()
throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a Number.public int getInt()
throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a Number.public long getLong()
throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a Number.public List<BEncodedValue> getList() throws InvalidBEncodingException
InvalidBEncodingException - If the value is not an
ArrayList.public Map<String,BEncodedValue> getMap() throws InvalidBEncodingException
InvalidBEncodingException - If the value is not a HashMap.Copyright © 2016. All rights reserved.