serialization

NotSerializableException: java.util.regex.Matcher

三世轮回 提交于 2019-12-24 20:36:55
问题 Given that java.util.regex.Matcher does not implement Serializable , is it somehow possible to serialize a class that privately declares and uses private Pattern pattern; private Matcher matcher; What, if any, workaround is possible here? 回答1: make the Matcher transient so that it wont be serialized, as transient variables are not serialized.. private transient Matcher matcher; 来源: https://stackoverflow.com/questions/14901766/notserializableexception-java-util-regex-matcher

C tree XML serialization

﹥>﹥吖頭↗ 提交于 2019-12-24 20:25:33
问题 I'm currently trying to recursively loop through a tree structure and serialize it to a string using (the language) C. I'm a real novice when it comes to C (Coming from a Java, C#, action-script background) and I'm having trouble getting to grips with things in general. Should I use a library to help generate the XML? How do I implement recursion using C? Thanks 回答1: Should I use a library to help generate the XML? Yes. libxml, minixml and others. Just google to know others, but I'd go with

I'm trying to import Lotus Notes Structured Text as some data I can perform linq queries on

丶灬走出姿态 提交于 2019-12-24 19:38:06
问题 I"m not even really too sure how to approach this, but that's my question. How to approach this: I have many (10000s) of these examples and need to extract as much data as possible into various members/lists of a data type. Since it's not JSON or XML I don't think I have deserialize options. Maybe regex somehow into a user-defined class of data? Status: In Process Prefix: 18- PlantLoc: Lewiston Date: 08/10/2018 Department: FT Time: 08/10/2018 02:08:30 PM StationID: 177 Fixture: initialization

Developing a (file) exchange format for java

旧巷老猫 提交于 2019-12-24 18:39:07
问题 I want to come up with a binary format for passing data between application instances in a form of POFs (Plain Old Files ;)). Prerequisites: should be cross-platform information to be persisted includes a single POJO & arbitrary byte[]s (files actually, the POJO stores it's names in a String[]) only sequential access is required should be a way to check data consistency should be small and fast should prevent an average user with archiver + notepad from modifying the data Currently I'm using

NSData writeToFile writes Plist successfully, but then crashes, giving NSInvalidArgumentException

妖精的绣舞 提交于 2019-12-24 18:29:11
问题 I am converting a JSON file to a plist using the new NSJSONSerialization class and NSPropertyListSerialization class. I manage to convert my JSON to a Plist without errors, but then, at my last step, when I go to write the plist to my desktop, the program crashes, but AFTER the Plist has been generated! NSData *data = [[NSData alloc] initWithContentsOfURL:path]; \\(NSURL *)path -->goes to my JSON file NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:data options

“no valid constructor” when serializing a subclass of Path2D.Double

ぐ巨炮叔叔 提交于 2019-12-24 18:16:05
问题 I'm trying to serialize a subclass of Path2D.Double, the serialization works, but the deserialization doesn't because of the following Exception: Exception in thread "main" java.io.InvalidClassException: CustomShape; no valid constructor at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:147) at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:755) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1751) at java.io

How to do serialization of float numbers on network?

可紊 提交于 2019-12-24 18:10:57
问题 I found a piece of code to do the serialization of float numbers on network. uint32_t htonf(float f) { uint32_t p; uint32_t sign; if (f < 0) { sign = 1; f = -f; } else { sign = 0; } p = ((((uint32_t)f)&0x7fff)<<16) | (sign<<31); // whole part and sign p |= (uint32_t)(((f - (int)f) * 65536.0f))&0xffff; // fraction return p; } Spec: The above code is sort of a naive implementation that stores a float in a 32-bit number. The high bit (31) is used to store the sign of the number ("1" means

Android/C++ data serialization

落爺英雄遲暮 提交于 2019-12-24 17:44:00
问题 What is the best way or library to exchange data/serialize structures between c++ server and android client? Performance is essential. Compression is preffered. Right now I am trying to implement packet exchange using msgpack (https://github.com/msgpack/msgpack-java) - for android side. 回答1: Msgpack/protobuf are fine for this task. But Msgpack does not fully supports 'optional' values or versioning (it can be important for your application). On the other hand, I'm not sure that all protobuf

Trying to hide base class member during serialization with Json.NET

╄→гoц情女王★ 提交于 2019-12-24 17:43:56
问题 I have two classes, where the concrete class Model<T> hides the base class' Items property. class Model { List<ListItem> Items {get;set;} } class Model<T> : Model { new List<ListItem<T>> Items {get;set;} } Upon serializing an instance of Model<T> with Json.NET I get the error: Newtonsoft.Json.JsonSerializationException : A member with the name ' Items ' already exists on ' Model<T> '. Use the JsonPropertyAttribute to specify another name. I understand why I'm receiving this error, however, I

CDI Beans Serialization issue on Cluster

本小妞迷上赌 提交于 2019-12-24 17:28:22
问题 I'm facing a big issue when I tried to run my EJB+CDI+JSF application on Wildfly 9.2 (Also I tried 10.0) on Standalone Clustered mode. The issue happens when my cluster container tries to deserialize my session scoped CDI beans, it throws the following exception : 2016-02-06 02:17:22,650 ERROR [io.undertow.request] (default task-9) UT005071: Undertow request failed HttpServerExchange{ GET /login.xhtml request {Accept=[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8]