<dependency> <groupId>org.msgpack</groupId> <artifactId>msgpack-core</artifactId> <version>0.8.20</version> </dependency> import org.msgpack.core.MessagePack; import org.msgpack.core.MessagePacker; import org.msgpack.core.MessageUnpacker; public class MsgPackExample { public static void main(String[] args) throws IOException { MessagePacker packer = MessagePack.newDefaultPacker(System.out); packer.packInt(42); packer.packString("Hello, World!"); packer.close(); MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(System.in); int intValue = unpacker.unpackInt(); String stringValue = unpacker.unpackString(); System.out.println(intValue); System.out.println(stringValue); unpacker.close(); } }


上一篇:
下一篇:
切换中文