Class ExTermDecoder
- java.lang.Object
-
- net.dv8tion.jda.api.utils.data.etf.ExTermDecoder
-
public class ExTermDecoder extends java.lang.ObjectDecodes an ETF encoded payload to a java object representation.- Since:
- 4.2.1
- See Also:
unpack(ByteBuffer),unpackMap(ByteBuffer),unpackList(ByteBuffer)
-
-
Constructor Summary
Constructors Constructor Description ExTermDecoder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Objectunpack(java.nio.ByteBuffer buffer)Unpacks the provided term into a java object.static java.util.List<java.lang.Object>unpackList(java.nio.ByteBuffer buffer)Unpacks the provided term into a javaList.static java.util.Map<java.lang.String,java.lang.Object>unpackMap(java.nio.ByteBuffer buffer)Unpacks the provided term into a javaMap.
-
-
-
Method Detail
-
unpack
public static java.lang.Object unpack(java.nio.ByteBuffer buffer)
Unpacks the provided term into a java object.The mapping is as follows:
Small Int | Int -> IntegerSmall BigInt -> LongFloat | New Float -> DoubleSmall Atom | Atom -> Boolean | null | StringBinary | String -> StringList | NIL -> ListMap -> Map
- Parameters:
buffer- TheByteBuffercontaining the encoded term- Returns:
- The java object
- Throws:
java.lang.IllegalArgumentException- If the buffer does not start with the version byte131or contains an unsupported tag
-
unpackMap
public static java.util.Map<java.lang.String,java.lang.Object> unpackMap(java.nio.ByteBuffer buffer)
Unpacks the provided term into a javaMap.The mapping is as follows:
Small Int | Int -> IntegerSmall BigInt -> LongFloat | New Float -> DoubleSmall Atom | Atom -> Boolean | null | StringBinary | String -> StringList | NIL -> ListMap -> Map
- Parameters:
buffer- TheByteBuffercontaining the encoded term- Returns:
- The parsed
Mapinstance - Throws:
java.lang.IllegalArgumentException- If the buffer does not start with a Map term, does not have the right version byte, or the format includes an unsupported tag
-
unpackList
public static java.util.List<java.lang.Object> unpackList(java.nio.ByteBuffer buffer)
Unpacks the provided term into a javaList.The mapping is as follows:
Small Int | Int -> IntegerSmall BigInt -> LongFloat | New Float -> DoubleSmall Atom | Atom -> Boolean | null | StringBinary | String -> StringList | NIL -> ListMap -> Map
- Parameters:
buffer- TheByteBuffercontaining the encoded term- Returns:
- The parsed
Listinstance - Throws:
java.lang.IllegalArgumentException- If the buffer does not start with a List or NIL term, does not have the right version byte, or the format includes an unsupported tag
-
-