Class ExTermDecoder
java.lang.Object
net.dv8tion.jda.api.utils.data.etf.ExTermDecoder
Decodes an ETF encoded payload to a java object representation.
- Since:
- 4.2.1
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
unpack
(ByteBuffer buffer) Unpacks the provided term into a java object.unpackList
(ByteBuffer buffer) Unpacks the provided term into a javaList
.unpackMap
(ByteBuffer buffer) Unpacks the provided term into a javaMap
.
-
Constructor Details
-
ExTermDecoder
public ExTermDecoder()
-
-
Method Details
-
unpack
Unpacks the provided term into a java object.The mapping is as follows:
Small Int | Int -> Integer
Small BigInt -> Long
Float | New Float -> Double
Small Atom | Atom -> Boolean | null | String
Binary | String -> String
List | NIL -> List
Map -> Map
- Parameters:
buffer
- TheByteBuffer
containing the encoded term- Returns:
- The java object
- Throws:
IllegalArgumentException
- If the buffer does not start with the version byte131
or contains an unsupported tag
-
unpackMap
Unpacks the provided term into a javaMap
.The mapping is as follows:
Small Int | Int -> Integer
Small BigInt -> Long
Float | New Float -> Double
Small Atom | Atom -> Boolean | null | String
Binary | String -> String
List | NIL -> List
Map -> Map
- Parameters:
buffer
- TheByteBuffer
containing the encoded term- Returns:
- The parsed
Map
instance - Throws:
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
Unpacks the provided term into a javaList
.The mapping is as follows:
Small Int | Int -> Integer
Small BigInt -> Long
Float | New Float -> Double
Small Atom | Atom -> Boolean | null | String
Binary | String -> String
List | NIL -> List
Map -> Map
- Parameters:
buffer
- TheByteBuffer
containing the encoded term- Returns:
- The parsed
List
instance - Throws:
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
-