In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
We know that Java is a statically typed language. Dynamic features can be achieved by entering Value MessagePack.
Value has a way to check its own type (isIntegerType (), isArrayType (), etc.) and also converts it to its own type (asStringValue (), convert (Template)).
This code can be viewed in https://github.com/cwiki-us-demo/messagepack-6-demo-java/blob/master/src/test/java/com/insight/demo/msgpack/MessagePack6DynamicTyping.java.
Package com.insight.demo.msgpack;import org.junit.Test;import org.msgpack.MessagePack;import org.msgpack.type.Value;import org.msgpack.unpacker.Converter;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import java.util.ArrayList;import java.util.List;import static org.msgpack.template.Templates.TString;import static org.msgpack.template.Templates.tList;/** * MessagePack6Objects * * @ author yhu * / public class MessagePack6DynamicTyping {final Logger logger = LoggerFactory.getLogger (MessagePack6DynamicTyping.class) / * Test MessagePack6Objects * / @ Test public void MessagePack6DynamicTyping () {logger.debug ("MessagePack6Objects for Objects"); / / Create serialize objects. List src = new ArrayList (); src.add ("msgpack"); src.add ("kumofs"); src.add ("viver"); MessagePack msgpack = new MessagePack (); try {/ / Serialize byte [] raw = msgpack.write (src); / / Deserialize directly using a template List dst1 = msgpack.read (raw, tList (TString)) / / Or, Deserialze to Value then convert type. Value dynamic = msgpack.read (raw); List dst2 = new Converter (dynamic) .read (tList (TString));} catch (Exception ex) {logger.error ("MessagePack Serialization And Deserialization error", ex);}
Https://www.cwiki.us/display/Serialization/QuickStart+For+MessagePack+Java+0.6.X
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.