msgpack-java
msgpack-java copied to clipboard
Convert Type to Value (org.msgpack.value.Value), if one exists
How can I convert an Array to ArrayValue?
For instance
String[] myStringArray = {"abc", "def", "ghi"}
// now I want to pack it in MessageBufferPacker
// I don't want to use a loop(really big array 200 elements) to read
// each value followed by packString
messageBufferPacker.packValue(myStringArray.asArrayValue)
// This doesn't work.
What should I do?
@chintan-mishra Try using https://static.javadoc.io/org.msgpack/msgpack-core/0.8.14/org/msgpack/value/ValueFactory.html
import static ValueFactory.*
newArray(newString("abc"), ...)
I still have to iterate over a large number of elements.
If that's the case, directly calling packArrayHeader(n), packString(x_1),..., packString(x_n) is better .
I will make do with this for now.