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/03 Report--
This test method can be found in https://github.com/cwiki-us-demo/serialize-deserialize-demo-java/blob/master/src/test/java/com/insight/demo/serialize/MessagePackSerializer.java.
We need to define the MAP required for testing, and the method of defining Map can be found in the test program below.
/ * SerializationMap * / @ Test public void testMessagePackSerializationMap () {byte [] bytes = new byte [0]; String uuid_a = UUID.randomUUID () .toString (); String uuid_b = UUID.randomUUID () .toString (); / / Instantiate ObjectMapper for MessagePack ObjectMapper objectMapper = new ObjectMapper (new MessagePackFactory ()); Map map = new HashMap (); MessageData messageData = new MessageData () / / Element An in MAP messageData.setUuid (UUID.randomUUID (). ToString ()); messageData.setName ("CWIKI.US-A"); map.put (uuid_a, messageData); / / Element B in MAP messageData = new MessageData (); messageData.setUuid (UUID.randomUUID (). ToString ()); messageData.setName ("CWIKI.US-B"); map.put (uuid_b, messageData) Try {/ / Serialize a Java object to byte array bytes = objectMapper.writeValueAsBytes (map); logger.debug ("Length of Bytes: [{}]", bytes.length); / / Deserialize the byte array to a MAP Map deserialized = objectMapper.readValue (bytes, new TypeReference () {}); logger.debug ("Deserialized MAP Count: [{}]", deserialized.size ()) Logger.debug ("MAP index 0: [{}]", deserialized.get (uuid_a). GetName ()); assertEquals ("CWIKI.US-A", deserialized.get (uuid_a). GetName ());} catch (JsonProcessingException ex) {logger.error ("Serialize Error", ex);} catch (IOException e) {e.printStackTrace ();}
Https://www.cwiki.us/display/Serialization/MessagePack+Jackson+Dataformat
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.