CN104360865A - Serialization method, deserialization method and related equipment - Google Patents

Serialization method, deserialization method and related equipment Download PDF

Info

Publication number
CN104360865A
CN104360865A CN201410712481.9A CN201410712481A CN104360865A CN 104360865 A CN104360865 A CN 104360865A CN 201410712481 A CN201410712481 A CN 201410712481A CN 104360865 A CN104360865 A CN 104360865A
Authority
CN
China
Prior art keywords
attribute
serializing
information
serializability
class
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410712481.9A
Other languages
Chinese (zh)
Other versions
CN104360865B (en
Inventor
邓国宇
蓝洪波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN201410712481.9A priority Critical patent/CN104360865B/en
Publication of CN104360865A publication Critical patent/CN104360865A/en
Application granted granted Critical
Publication of CN104360865B publication Critical patent/CN104360865B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a serialization method, a deserialization method and related equipment. General attributes required to be serialized and attribute type information are acquired; serialized description information is added in the attributes required to be serialized, so that general attributes are marked as the attributes which can be serialized; the serialization information and the attribute type information are loaded to a memory; serialized configuration is expressed according to the information to be serialized; no extra configuration file is needed, static compile checking is supported, the possibility that the configuration is mistaken is reduced, the customer attributes required to be serialized are supported, and multiple base types and customer types are supported. The serialization method has the advantages of simplicity for realization, high processing efficiency and convenience for expansion.

Description

A kind of sequencing method, unserializing method and relevant device
Technical field
The invention belongs to computer realm, particularly a kind of sequencing method, unserializing method and relevant device.
Background technology
Object serialization/unserializing technology is widely used in computer realm, be used in the scene that system backup, network communication etc. relate to exchanges data in a large number, object serialization is binary word throttling by main realization, and then can be kept at memory device or and other system exchange data.
The all properties of object all can be carried out serializing by the serializing technology of current main flow; self-definedly cannot need the attribute of serializing; often occur in the sector application of big data quantity exchange at some; as telecommunications, financial industry; the self-defined communication format of usual meeting, and only need the part attribute in serializing object, improve serializing efficiency to reach; save the object of transmission bandwidth, directly cannot use the serializing technology of main flow.
In prior art, Chinese patent (the patent No.: 200910190251) disclose a kind of object serialization method, object unserializing method, Apparatus and system, describe attribute increase and decrease in object, cause the problem of unserializing failure, Chinese patent (the patent No.: 201310596703) disclose a kind of object serialization method and apparatus, describe serializing result strictly to map with target object in structure, the problem of serializing demand flexibly cannot be met, but all do not solve the problem of User Defined serializing attribute.
Summary of the invention
In view of this, a kind of sequencing method, unserializing method and relevant device is embodiments provided.
An object of the present invention is to provide a kind of sequencing method, described sequencing method comprises:
Serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags;
To serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
According to preloading sequence information, obtain all serializability attributes in pending byte sequence, and sort according to serializing order;
Obtain the attribute needing serializing in instance object;
According to the described serialization information loaded in described internal memory and attribute type information, the sequence of attributes of serializing is needed to described instance object, and export the property value after described instance object serializing to byte sequence.
As the preferred scheme of one, need in the attribute of serializing in described acquisition instance object, described method specifically comprises:
Obtain the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
As the preferred scheme of one, according to the described serialization information loaded in described internal memory and attribute type information, the sequence of attributes of serializing is being needed to described instance object, and the property value after described instance object serializing is exported in byte sequence, described method specifically comprises:
Corresponding serialization information is searched, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence in serialization information buffer memory according to the prestrain of attribute name.
As the preferred scheme of one, described by the property value Formatting Output after instance object serializing in byte sequence, described method specifically comprises:
The described formal mode by property value employing sequence number, length or coding after instance object serializing outputs in byte sequence.
Another object of the present invention is to provide a kind of unserializing method, and described sequencing method comprises:
Serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags;
To serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
According to preloading sequence information, obtain all serializability attributes in pending byte sequence, and sort according to serializing order;
Obtain the content of pending byte sequence;
Be property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
As the preferred scheme of one, need in the attribute of serializing in described acquisition instance object, described method specifically comprises:
Obtain the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
As the preferred scheme of one, described be in property value by the Content Transformation in described byte sequence, described method specifically comprises:
And described content is formatd according to attribute type information, by the property value of described content stored in described instance object of format.
Another object of the present invention is to provide a kind of serializing device, it is characterized in that, described serializing device comprises:
Attribute flags, for being need the attribute of serializing to add serializability to explain in serializability class, is serializability attribute by the first acquiring unit;
First indexing unit, for serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
First loading unit, for according to preloading sequence information, obtains all serializability attributes in pending byte sequence, and sorts according to serializing order;
Second acquisition unit, for obtaining in instance object the attribute needing serializing;
First output unit, for needing the sequence of attributes of serializing according to the described serialization information loaded in described internal memory and attribute type information to described instance object, and exports the property value after described instance object serializing to byte sequence.
As the preferred scheme of one, described first acquiring unit also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
As the preferred scheme of one, described first output unit is also for according to searching corresponding serialization information in the serialization information buffer memory of attribute name prestrain, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence.
As the preferred scheme of one, the property value after instance object serializing also adopts the formal mode of sequence number, length or coding to output in byte sequence for described by described first output unit.
Another object of the present invention is to provide a kind of unserializing device, it is characterized in that, described serializing device comprises:
Attribute flags, for being need the attribute of serializing to add serializability to explain in serializability class, is serializability attribute by the first acquiring unit;
First indexing unit, for serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
First loading unit, for according to preloading sequence information, obtains all serializability attributes in pending byte sequence, and sorts according to serializing order;
Second acquisition unit, for the content of pending byte sequence;
First converting unit, for being property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
As the preferred scheme of one, described first indexing unit also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
As the preferred scheme of one, described first converting unit also for described content is formatd according to attribute type information, by the property value of described content stored in described instance object of format.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages:
A kind of sequencing method provided by the invention, unserializing method and relevant device, obtain the attribute and the attribute type information that need serializing of general category, the described attribute of serializing that needs is added seriation descriptor, to make general category be labeled as serializability class, load described serialization information and attribute type information to internal memory serializing configuration by by serialization information, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realize simple, treatment effeciency is high, expansion is convenient.
Term " first ", " second ", " the 3rd " " 4th " etc. in instructions of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.The embodiments described herein should be appreciated that the data used like this can be exchanged in the appropriate case, so that can be implemented with the order except the content except here diagram or description.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those skilled in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The invention provides a kind of sequencing method, described sequencing method comprises:
S101, class and attribute declaration thereof are added to the annotating information of serializability in class declaration file, general category is labeled as serializability class.
General category herein refers to the raw data of not carrying out serializing, user can arrange by self-defined the attribute needing serializing, can customize serialization format, can customize the attribute needing serializing, numerous types of data can be supported, as shaping, floating number, byte, the fundamental types such as array, and by inheriting, the self-defining types of mode such as combination, general category comprises attribute and attribute type information, common breeding can comprise multiple attribute needing serializing, here attribute can be understood as a series of set needing the attribute of serializing, use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information can comprise sequence number, length, the information such as coding, user can the attribute of custom list, make serialization process more flexible.
S102, serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags.
Use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information comprises sequence number, length, the information such as coding, such as, carry out serializing according to sequence number by general category, or utilize length or numbering etc., do not limit, general category is marked serializability class.
S103, to serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
All classes being labeled serializability are searched in class.path, can the attribute of serializing in analysis classes, the serialization information of attribute and attribute type information cache to internal memory, be convenient to carry out when serializing or unserializing calling use.
It should be noted that these three steps of S101, S102, S103, can pre-configuredly complete, also can carry out situ configuration when carrying out serializing or unserializing operation, this is not limited.
The attribute of serializing is needed in S104, acquisition instance object.
Instance object is the object variable of instantiation, when carrying out serializing operation to instance object, obtain the attribute needing serializing in instance object, title according to attribute can inquire serialization information corresponding to attribute in residing internal memory, again according to the type information of serialization information and attribute, export the property value after instance object serializing to byte sequence.
S105, according to the described serialization information loaded in described internal memory and attribute type information, the sequence of attributes of serializing is needed to described instance object, and export the property value after described instance object serializing to byte sequence.
Inquire about the serialization information be carried in internal memory, traversal wherein needs the attribute of serializing, according to sequence of attributes information and attribute type, property value is outputted to byte sequence, the output of property value also can adopt other modes, selects according to actual needs, does not specifically limit.
Explain (Annotation), be also metadata, for illustration of code rank, with class, interface, to enumerate be at same level.It can state before bag, class, field, method, local variable, method parameter etc., be used for being described these elements, annotation, write document: generate document by the metadata identified in code, code analysis: code is analyzed by the metadata identified in code, compiling checks: by the metadata identified in code, compiler can be crossed and realize basic compiling inspection, those of ordinary skill in the art should understand, and do not repeat.
A kind of sequencing method provided by the invention, serializing configuration is by representing serialization information by explaining in general category, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realization is simple, treatment effeciency is high, and expansion is convenient.
Sequencing method of the present invention additionally provides another kind of embodiment, and described sequencing method comprises:
S201, to serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
General category herein refers to the raw data of not carrying out serializing, user can arrange by self-defined the attribute needing serializing, can customize serialization format, can customize the attribute needing serializing, numerous types of data can be supported, as shaping, floating number, byte, the fundamental types such as array, and by inheriting, the self-defining types of mode such as combination, general category comprises attribute and attribute type information, common breeding can comprise multiple attribute needing serializing, here attribute can be understood as a series of set needing the attribute of serializing, use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information can comprise sequence number, length, the information such as coding, user can the attribute of custom list, make serialization process more flexible.
S202, serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags.
Use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information comprises sequence number, length, the information such as coding, such as, carry out serializing according to sequence number by general category, or utilize length or numbering etc., do not limit, general category is marked serializability class.
S203, to serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
All classes being labeled serializability are searched in class.path, can the attribute of serializing in analysis classes, the serialization information of attribute and attribute type information cache to internal memory, be convenient to carry out when serializing or unserializing calling use.
It should be noted that these three steps of S201, S202, S203, can pre-configuredly complete, also can carry out situ configuration when carrying out serializing or unserializing operation, this is not limited.
The attribute of serializing is needed in S204, acquisition instance object.
Corresponding serialization information is searched, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence in S205, serialization information buffer memory according to the prestrain of attribute name.
Particularly, arrived by the property value Formatting Output after instance object serializing to specific design in byte sequence, the described formal mode by property value employing sequence number, length or coding after instance object serializing outputs in byte sequence.
A kind of sequencing method provided by the invention, serializing configuration is by representing serialization information by explaining in general category, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realization is simple, treatment effeciency is high, and expansion is convenient.
Below for sequencing method, the invention provides a kind of application scenarios and be convenient to be described sequencing method:
1. add serialization information
In this step, a kind of structurized describing mode is needed to explain the class and attribute needing serializing:
Code snippet above uses@Serializable to explain the class of a serializability, and use@SerializableAttribute serializing to explain to each field, the information used is needed to use list to list after@SerializableAttribute in some serializings, @Serializable ,@SerializableAttribute is self-defining note.
@Serializable explains can act on general category, also can act on and generate class by succession mode.
@SerializableAttribute explains can act on int, the fundamental types such as float and array, also can act on String, the customization types such as Date; This note can add parameter, comprising: optional parameter index, for the order of collating sequence field; Optional parameter maxLen, is used to specify this attribute and takies how many bytes at most in byte stream; Optional parameter encoding, is used to specify the coded system that this attribute uses when serializing.
2. preloading sequence information
Before serializing/antitone sequence, the serialization information in Water demand class file, could carry out serializing/unserializing to object in step afterwards, simultaneously by analyze after result cache to internal memory, raising serializing treatment effeciency.Concrete steps
2.1 search in class.path@Serializable explain all classes;
2.2 search for all SerializableAttribute comment fields in the class of searching for out in 2.1;
2.3 obtain serialization informations such as searching for out the type of each attribute and sequence number, length, coding in 2.2, if attribute is declared as privately owned, other classes can not directly be accessed, can search corresponding get set method, use function call to substitute common assignment statement.
The serialization informations such as 2.4 field types put into buffer memory.
3. serializing operation
3.1 attributes obtaining object successively, and by sorting in proper order.
Corresponding serialization information is searched in the serialization information buffer memory of 3.2 use attribute names prestrain in step 2.
3.3 according to serialization information and attribute type, by fundamental type property value Formatting Output to byte sequence or customization type is decomposed into fundamental type and according to sequence number, length, the Formatting Outputs such as coding are to byte sequence.
A kind of sequencing method provided by the invention, serializing configuration is by representing serialization information by explaining in general category, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realization is simple, treatment effeciency is high, and expansion is convenient.
Method above for serializing is introduced, and lower mask body introduces unserializing method.
Shown in composition graphs 3, the invention provides a kind of embodiment of unserializing method, described sequencing method comprises:
S301, class and attribute declaration thereof are added to the annotating information of serializability in class declaration file, general category is labeled as serializability class.
General category herein refers to the raw data of not carrying out serializing, user can arrange by self-defined the attribute needing serializing, can customize serialization format, can customize the attribute needing serializing, numerous types of data can be supported, as shaping, floating number, byte, the fundamental types such as array, and by inheriting, the self-defining types of mode such as combination, general category comprises attribute and attribute type information, common breeding can comprise multiple attribute needing serializing, here attribute can be understood as a series of set needing the attribute of serializing, use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information can comprise sequence number, length, the information such as coding, user can the attribute of custom list, make serialization process more flexible.
S302, serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags.
Use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information comprises sequence number, length, the information such as coding, such as, carry out serializing according to sequence number by general category, or utilize length or numbering etc., do not limit, general category is marked serializability class.
S303, to serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
All classes being labeled serializability are searched in class.path, can the attribute of serializing in analysis classes, the serialization information of attribute and attribute type information cache to internal memory, be convenient to carry out when serializing or unserializing calling use.
It should be noted that these three steps of S101, S102, S103, can pre-configuredly complete, also can carry out situ configuration when carrying out serializing or unserializing operation, be described above, therefore not to repeat here.
S304, obtain the content of pending byte sequence.
Corresponding serialization information is searched in the serialization information buffer memory of use attribute name prestrain in S303, according to the serialization information of prestrain, reading byte sequence, according to sequence of attributes information and attribute type, is property value by the Current Content of byte sequence according to the type conversion of attribute.
S305, be property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
Described content is formatd according to attribute type information, by in the property value of described content stored in described instance object of format, according to serialization information and attribute type, the content of specified length is read from byte sequence, according to coded system, reading of content is formatd, stored in property value, Ke Yiwei, can for read corresponding byte number according to the size in serialization information in byte sequence, and be property value according to type conversion.
A kind of unserializing method provided by the invention, serializing configuration is by representing serialization information by explaining in general category, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realization is simple, treatment effeciency is high, and expansion is convenient.
Shown in composition graphs 4, sequencing method of the present invention additionally provides another kind of embodiment, and described sequencing method comprises:
S401, class and attribute declaration thereof are added to the annotating information of serializability in class declaration file, general category is labeled as serializability class.
General category herein refers to the raw data of not carrying out serializing, user can arrange by self-defined the attribute needing serializing, can customize serialization format, can customize the attribute needing serializing, numerous types of data can be supported, as shaping, floating number, byte, the fundamental types such as array, and by inheriting, the self-defining types of mode such as combination, general category comprises attribute and attribute type information, common breeding can comprise multiple attribute needing serializing, here attribute can be understood as a series of set needing the attribute of serializing, use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information can comprise sequence number, length, the information such as coding, user can the attribute of custom list, make serialization process more flexible.
S402, serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags.
Use structurized descriptor, for each attribute of serializing that needs adds serialization information in general category, serialization information comprises sequence number, length, the information such as coding, such as, carry out serializing according to sequence number by general category, or utilize length or numbering etc., do not limit, general category is marked serializability class.
S403, to serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
All classes being labeled serializability are searched in class.path, can the attribute of serializing in analysis classes, the serialization information of attribute and attribute type information cache to internal memory, be convenient to carry out when serializing or unserializing calling use.
It should be noted that these three steps of S401, S402, S403, can pre-configuredly complete, also can carry out situ configuration when carrying out serializing or unserializing operation, this is not limited.
S404, obtain the content of pending byte sequence.
According to the serialization information of prestrain, reading byte sequence, according to sequence of attributes information and attribute type, is property value by the Current Content of byte sequence according to the type conversion of attribute.
S405, be property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
Described content is formatd according to attribute type information, by in the property value of described content stored in described instance object of format, can for read corresponding byte number according to the size in serialization information in byte sequence, and be property value according to type conversion.
A kind of unserializing method provided by the invention, serializing configuration is by representing serialization information by explaining in general category, without the need to extra configuration file, support static compilation checks, reduce configuration to make mistakes possibility, support the self-defined attribute needing serializing, support multiple fundamental type and customization type, realization is simple, treatment effeciency is high, and expansion is convenient.
For unserializing method, a kind of application scenarios is provided to be introduced:
S1, interpolation serialization information
Utilize structurized describing mode to explain the class and attribute that need serializing, be specially:
Code snippet above uses@Serializable to explain the class of a serializability, and use@SerializableAttribute serializing to explain to each field, the information used is needed to use list to list after@SerializableAttribute in some serializings, @Serializable ,@SerializableAttribute is self-defining note.
@Serializable explains can act on general category, also can act on and generate class by succession mode.
@SerializableAttribute explains can act on int, the fundamental types such as float and array, also can act on String, the customization types such as Date; This note can add parameter, comprising: optional parameter index, for the order of collating sequence field; Optional parameter maxLen, is used to specify this attribute and takies how many bytes at most in byte stream; Optional parameter encoding, is used to specify the coded system that this attribute uses when serializing.
S2, preloading sequence information
Unserializing operation before, the serialization information in Water demand class file, could carry out unserializing to object in step afterwards, simultaneously by analyze after result cache to internal memory, raising serializing treatment effeciency.
Step S2 concrete steps:
S2.1, search in class.path@Serializable explain all classes.
S2.2, all SerializableAttribute comment fields searched in the class of searching for out in 2.1.
S2.3, obtain the serialization information such as type and sequence number, length, coding searching for out each attribute in S2.2, if attribute is declared as privately owned, other classes can not directly be accessed, can search corresponding get set method, use function call to substitute common assignment statement.
S2.4, last, the serialization informations such as field type are put into buffer memory.
S4, unserializing operate
S4.1, obtain the attribute of object successively, and by sorting in proper order
Corresponding serialization information is searched in the serialization information buffer memory of S4.2, use attribute name prestrain in step s 2
S4.3, according to serialization information and attribute type, from byte sequence, read the content of specified length, according to coded system, reading of content is formatd, by the content after format stored in property value, complete unserializing operation.
Above introduce for sequencing method, go back correspondence for sequencing method the present invention and provide serializing device, be specifically introduced below.
Shown in composition graphs 5, the invention provides a kind of embodiment of serializing device, described serializing device comprises:
First acquiring unit 501, for adding the annotating information of serializability in class declaration file to class and attribute declaration thereof, is labeled as serializability class by general category.
Preferably, described first acquiring unit 501 also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
Attribute flags, for being need the attribute of serializing to add serializability to explain in serializability class, is serializability attribute by the first indexing unit 502.
First loading unit 503, for serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
Second acquisition unit 504, for obtaining in instance object the attribute needing serializing.
First output unit 505, for needing the sequence of attributes of serializing according to the described serialization information loaded in described internal memory and attribute type information to described instance object, and exports the property value after described instance object serializing to byte sequence.
Preferably, described first output unit 505 is also for according to searching corresponding serialization information in the serialization information buffer memory of attribute name prestrain, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence.
Preferably, the property value after instance object serializing also adopts the formal mode of sequence number, length or coding to output in byte sequence for described by described first output unit 505.
Above introduce for unserializing method, go back correspondence for sequencing method the present invention and provide unserializing device, the invention provides a kind of embodiment of unserializing device, described unserializing device comprises:
Shown in composition graphs 6, a kind of embodiment of unserializing device provided by the invention, described serializing device comprises:
First acquiring unit 601, for adding the annotating information of serializability in class declaration file to class and attribute declaration thereof, is labeled as serializability class by general category.
Attribute flags, for being need the attribute of serializing to add serializability to explain in serializability class, is serializability attribute by the first indexing unit 602.
First loading unit 603, for serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information.
Second acquisition unit 604, for obtaining in instance object the attribute needing unserializing.
First query unit 605, for according to the described serialization information loaded in described internal memory and the attribute type information inquiry serialization information corresponding with attribute and attribute type information.
Second acquisition unit 606, for the content of pending byte sequence.
First converting unit 607, for being property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
Preferably, described first indexing unit 602 also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
Preferably, described first converting unit 607 also for described content is formatd according to attribute type information, by the property value of described content stored in described instance object of format.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiments that the application provides, should be understood that, disclosed system, apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is that the hardware that can carry out instruction relevant by program has come, this program can be stored in a computer-readable recording medium, storage medium can comprise: ROM (read-only memory) (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
One of ordinary skill in the art will appreciate that all or part of step realized in above-described embodiment method is that the hardware that can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be ROM (read-only memory), disk or CD etc.
Above a kind of sequencing method provided by the present invention, unserializing method and relevant device are described in detail, for one of ordinary skill in the art, according to the thought of the embodiment of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of a kind of embodiment of sequencing method of the present invention;
Fig. 2 is the process flow diagram of the another kind of embodiment of sequencing method of the present invention;
Fig. 3 is the process flow diagram of a kind of embodiment of unserializing method of the present invention;
Fig. 4 is the process flow diagram of the another kind of embodiment of unserializing method of the present invention;
Fig. 5 is the structural drawing of a kind of embodiment of serializing device of the present invention;
Fig. 6 is the structural drawing of a kind of embodiment of unserializing method of the present invention.
Embodiment
Embodiments provide a kind of sequencing method, unserializing method and relevant device, realize simple, treatment effeciency is high, expansion is convenient.
The present invention program is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the embodiment of a part of the present invention, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.

Claims (14)

1. a sequencing method, is characterized in that, described sequencing method comprises:
Class and attribute declaration thereof are added to the annotating information of serializability in class declaration file, general category is labeled as serializability class;
Serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags;
To serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
Serialization information obtains the attribute needing serializing in instance object;
According to the described serialization information loaded in described internal memory and attribute type information, the sequence of attributes of serializing is needed to described instance object, and export the property value after described instance object serializing to byte sequence.
2. method according to claim 1, is characterized in that, need in the attribute of serializing in described acquisition instance object, described method specifically comprises:
Obtain the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
3. method according to claim 1, it is characterized in that, according to the described serialization information loaded in described internal memory and attribute type information, the sequence of attributes of serializing is being needed to described instance object, and the property value after described instance object serializing is exported in byte sequence, described method specifically comprises:
Corresponding serialization information is searched, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence in serialization information buffer memory according to the prestrain of attribute name.
4. method according to claim 1, is characterized in that, described by the property value Formatting Output after instance object serializing in byte sequence, described method specifically comprises:
The described formal mode by property value employing sequence number, length or coding after instance object serializing outputs in byte sequence.
5. a unserializing method, is characterized in that, described sequencing method comprises:
Class and attribute declaration thereof are added to the annotating information of serializability in class declaration file, general category is labeled as serializability class;
Serializability class be need serializing attribute add serializability explain, be serializability attribute by attribute flags;
To serializability class, in loading classes information and class, all serializability attribute informations are to internal memory, form preloading sequence information;
According to preloading sequence information, obtain all serializability attributes in pending byte sequence, and sort according to serializing order;
Obtain the content of pending byte sequence;
Be property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
6. method according to claim 5, is characterized in that, need in the attribute of serializing in described acquisition instance object, described method specifically comprises:
Obtain the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
7. method according to claim 5, is characterized in that, described be in property value by the Content Transformation in described byte sequence, described method specifically comprises:
And described content is formatd according to attribute type information, by the property value of described content stored in described instance object of format.
8. a serializing device, is characterized in that, described serializing device comprises:
First acquiring unit, for obtaining the attribute and the attribute type information that need serializing of general category;
First indexing unit, for adding seriation descriptor, to make general category be labeled as serializability class by the described attribute of serializing that needs;
First loading unit, for loading described serialization information and attribute type information to internal memory;
Second acquisition unit, for obtaining in instance object the attribute needing serializing;
First output unit, for needing the sequence of attributes of serializing according to the described serialization information loaded in described internal memory and attribute type information to described instance object, and exports the property value after described instance object serializing to byte sequence.
9. device according to claim 8, is characterized in that, described first acquiring unit also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
10. device according to claim 8, it is characterized in that, described first output unit is also for according to searching corresponding serialization information in the serialization information buffer memory of attribute name prestrain, according to serialization information and attribute type information, by the property value Formatting Output after instance object serializing to byte sequence.
11. methods according to claim 8, is characterized in that, the property value after instance object serializing also adopts the formal mode of sequence number, length or coding to output in byte sequence for described by described first output unit.
12. 1 kinds of unserializing devices, is characterized in that, described serializing device comprises:
First acquiring unit, for obtaining the attribute and the attribute type information that need serializing of general category;
First indexing unit, for adding seriation descriptor, to make general category be labeled as serializability class by the described attribute of serializing that needs;
First loading unit, for loading described serialization information and attribute type information to internal memory;
Second acquisition unit, for the content of pending byte sequence;
First converting unit, for being property value according to the described serialization information loaded in described internal memory and attribute type information by the Content Transformation in described byte sequence.
13. devices according to claim 12, is characterized in that, described first indexing unit also for obtaining the attribute needing serializing of instance object successively, and by described attribute by sorting in proper order.
14. devices according to claim 12, is characterized in that, described first converting unit also for described content is formatd according to attribute type information, by the property value of described content stored in described instance object of format.
CN201410712481.9A 2014-11-28 2014-11-28 A kind of sequencing method, unserializing method and relevant device Active CN104360865B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410712481.9A CN104360865B (en) 2014-11-28 2014-11-28 A kind of sequencing method, unserializing method and relevant device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410712481.9A CN104360865B (en) 2014-11-28 2014-11-28 A kind of sequencing method, unserializing method and relevant device

Publications (2)

Publication Number Publication Date
CN104360865A true CN104360865A (en) 2015-02-18
CN104360865B CN104360865B (en) 2018-05-18

Family

ID=52528129

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410712481.9A Active CN104360865B (en) 2014-11-28 2014-11-28 A kind of sequencing method, unserializing method and relevant device

Country Status (1)

Country Link
CN (1) CN104360865B (en)

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468793A (en) * 2016-01-20 2016-04-06 北京华如科技股份有限公司 Automated management method for simulation model data
WO2017008654A1 (en) * 2015-07-13 2017-01-19 阿里巴巴集团控股有限公司 Deserialization method and apparatus
WO2017059798A1 (en) * 2015-10-10 2017-04-13 阿里巴巴集团控股有限公司 Methods, apparatus, and system for serialization and deserialization, and electronic devices
CN106648569A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Target serialization achieving method and device
CN106843819A (en) * 2015-12-03 2017-06-13 北京国双科技有限公司 The method and device of object serialization
CN106843851A (en) * 2016-12-28 2017-06-13 上海大汉三通数据通信有限公司 Implementation method and device based on ActiveMQ isomery Classloader unserializings
CN106933644A (en) * 2015-12-31 2017-07-07 北京国双科技有限公司 Data processing method and device
CN107451237A (en) * 2017-07-26 2017-12-08 阿里巴巴集团控股有限公司 Serializing and unserializing method, apparatus and equipment
CN107463668A (en) * 2017-08-02 2017-12-12 湖南新航动力信息科技有限公司 Serializing and method and device, computer equipment and the storage medium of unserializing
CN107818118A (en) * 2016-09-14 2018-03-20 北京百度网讯科技有限公司 Date storage method and device
CN108876628A (en) * 2018-06-28 2018-11-23 深圳数字动能信息技术有限公司 Financial quantitative analysis data transmission method
CN110914799A (en) * 2018-06-30 2020-03-24 华为技术有限公司 Deserialization method and device and computing equipment
CN111611235A (en) * 2020-05-27 2020-09-01 华中师范大学 Student space-time model based on campus WiFi big data and data cleaning method
CN111930531A (en) * 2020-07-01 2020-11-13 北京奇艺世纪科技有限公司 Data processing method, data production method, data consumption method, data production device, data consumption device and data consumption medium
CN111931200A (en) * 2020-07-13 2020-11-13 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN114500647A (en) * 2022-01-18 2022-05-13 聚好看科技股份有限公司 Data transmission method and device
CN116368788A (en) * 2021-04-30 2023-06-30 株式会社软技 Serialization method, deserialization method, information processing program, information processing apparatus, and communication system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567083A (en) * 2010-12-10 2012-07-11 金蝶软件(中国)有限公司 Object transmission method, object transmission device and object transmission system applying RPC (remote procedure call)
CN102750268A (en) * 2012-06-19 2012-10-24 山东中创软件商用中间件股份有限公司 Object serializing method as well as object de-serializing method, device and system
CN103036641A (en) * 2011-09-29 2013-04-10 北京新媒传信科技有限公司 Method and system of data exchange and deserialization method
CN103425632A (en) * 2013-08-30 2013-12-04 深圳市路畅科技股份有限公司 Serializing method, device and processor
CN103593194A (en) * 2013-11-21 2014-02-19 北京国双科技有限公司 Object serialization method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102567083A (en) * 2010-12-10 2012-07-11 金蝶软件(中国)有限公司 Object transmission method, object transmission device and object transmission system applying RPC (remote procedure call)
CN103036641A (en) * 2011-09-29 2013-04-10 北京新媒传信科技有限公司 Method and system of data exchange and deserialization method
CN102750268A (en) * 2012-06-19 2012-10-24 山东中创软件商用中间件股份有限公司 Object serializing method as well as object de-serializing method, device and system
CN103425632A (en) * 2013-08-30 2013-12-04 深圳市路畅科技股份有限公司 Serializing method, device and processor
CN103593194A (en) * 2013-11-21 2014-02-19 北京国双科技有限公司 Object serialization method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ONLYOU930: "未标记为可序列化什么意思呢?类的序列化[Serializable]", 《BLOG.CSDN.NET/ONLYOU930/ARTICLE/DETAILS/5566532》 *

Cited By (27)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017008654A1 (en) * 2015-07-13 2017-01-19 阿里巴巴集团控股有限公司 Deserialization method and apparatus
WO2017059798A1 (en) * 2015-10-10 2017-04-13 阿里巴巴集团控股有限公司 Methods, apparatus, and system for serialization and deserialization, and electronic devices
CN106570018A (en) * 2015-10-10 2017-04-19 阿里巴巴集团控股有限公司 Serialization method and apparatus, deserialization method and apparatus, serialization and deserialization system, and electronic device
CN106648569A (en) * 2015-11-02 2017-05-10 腾讯科技(深圳)有限公司 Target serialization achieving method and device
CN106648569B (en) * 2015-11-02 2021-04-20 腾讯科技(深圳)有限公司 Target serialization realization method and device
CN106843819A (en) * 2015-12-03 2017-06-13 北京国双科技有限公司 The method and device of object serialization
CN106933644A (en) * 2015-12-31 2017-07-07 北京国双科技有限公司 Data processing method and device
CN105468793B (en) * 2016-01-20 2019-02-22 北京华如科技股份有限公司 A kind of automatic management method of simulation model data
CN105468793A (en) * 2016-01-20 2016-04-06 北京华如科技股份有限公司 Automated management method for simulation model data
US10969971B2 (en) 2016-09-14 2021-04-06 Beijing Baidu Netcom Science And Technology Co., Ltd. Data storage method and apparatus
CN107818118A (en) * 2016-09-14 2018-03-20 北京百度网讯科技有限公司 Date storage method and device
CN107818118B (en) * 2016-09-14 2019-04-30 北京百度网讯科技有限公司 Date storage method and device
CN106843851A (en) * 2016-12-28 2017-06-13 上海大汉三通数据通信有限公司 Implementation method and device based on ActiveMQ isomery Classloader unserializings
CN107451237B (en) * 2017-07-26 2020-09-15 阿里巴巴集团控股有限公司 Serialization and deserialization method, device and equipment
CN107451237A (en) * 2017-07-26 2017-12-08 阿里巴巴集团控股有限公司 Serializing and unserializing method, apparatus and equipment
CN107463668A (en) * 2017-08-02 2017-12-12 湖南新航动力信息科技有限公司 Serializing and method and device, computer equipment and the storage medium of unserializing
CN108876628A (en) * 2018-06-28 2018-11-23 深圳数字动能信息技术有限公司 Financial quantitative analysis data transmission method
CN110914799A (en) * 2018-06-30 2020-03-24 华为技术有限公司 Deserialization method and device and computing equipment
CN110914799B (en) * 2018-06-30 2023-02-28 华为云计算技术有限公司 Deserialization method and device and computing equipment
CN111611235A (en) * 2020-05-27 2020-09-01 华中师范大学 Student space-time model based on campus WiFi big data and data cleaning method
CN111930531A (en) * 2020-07-01 2020-11-13 北京奇艺世纪科技有限公司 Data processing method, data production method, data consumption method, data production device, data consumption device and data consumption medium
CN111930531B (en) * 2020-07-01 2023-08-18 北京奇艺世纪科技有限公司 Data processing, data production and data consumption methods, devices, equipment and media
CN111931200A (en) * 2020-07-13 2020-11-13 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN111931200B (en) * 2020-07-13 2024-02-23 车智互联(北京)科技有限公司 Data serialization method, mobile terminal and readable storage medium
CN116368788A (en) * 2021-04-30 2023-06-30 株式会社软技 Serialization method, deserialization method, information processing program, information processing apparatus, and communication system
EP4254905A4 (en) * 2021-04-30 2024-02-14 Softgear Co Ltd Serializing method, deserializing method, information processing program, information processing device, and communication system
CN114500647A (en) * 2022-01-18 2022-05-13 聚好看科技股份有限公司 Data transmission method and device

Also Published As

Publication number Publication date
CN104360865B (en) 2018-05-18

Similar Documents

Publication Publication Date Title
CN104360865A (en) Serialization method, deserialization method and related equipment
CN106202207B (en) HBase-ORM-based indexing and retrieval system
CN107861728B (en) Method and system for converting traditional program language into modern program language
CN102541521B (en) Automatic operating instruction generating device based on structured query language and method
US20100251227A1 (en) Binary resource format and compiler
CN103412853A (en) Method for automatically generating test cases aiming at document converters
CN102750268A (en) Object serializing method as well as object de-serializing method, device and system
CN108829884B (en) Data mapping method and device
CN107168695B (en) Excel data analysis method and system
CN104298496A (en) Data-analysis-based software development framework system
CN102591787B (en) The data processing method of JAVA card and device
CN105706092A (en) Methods and systems of four-valued simulation
CN104216961A (en) Method and device for data processing
CN109656986A (en) A kind of householder method that business datum summarizes, device and electronic equipment
CN109766085A (en) A kind of method and device handling enumeration type code
CN101154227A (en) Code generation method based on ASN type object
CN101290622A (en) Database cleaning system and method
CN105468793A (en) Automated management method for simulation model data
CN101770367A (en) Compressing method and compressing device of .NET file
CN110347673A (en) Data file loading method, device, computer equipment and storage medium
CN116628066B (en) Data transmission method, device, computer equipment and storage medium
CN111522820A (en) Data storage structure, storage retrieval method, system, device and storage medium
CN102184286A (en) Method for generating instrument circuit diagram automatically
CN114238334A (en) Heterogeneous data encoding method and device, heterogeneous data decoding method and device, computer equipment and storage medium
CN114625372A (en) Automatic component compiling method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant