CN108933968B - Message format conversion method and device, storage medium and android terminal - Google Patents

Message format conversion method and device, storage medium and android terminal Download PDF

Info

Publication number
CN108933968B
CN108933968B CN201810719671.1A CN201810719671A CN108933968B CN 108933968 B CN108933968 B CN 108933968B CN 201810719671 A CN201810719671 A CN 201810719671A CN 108933968 B CN108933968 B CN 108933968B
Authority
CN
China
Prior art keywords
information
key
infobean
value
value pair
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.)
Active
Application number
CN201810719671.1A
Other languages
Chinese (zh)
Other versions
CN108933968A (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810719671.1A priority Critical patent/CN108933968B/en
Publication of CN108933968A publication Critical patent/CN108933968A/en
Application granted granted Critical
Publication of CN108933968B publication Critical patent/CN108933968B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/81Monomedia components thereof
    • H04N21/8126Monomedia components thereof involving additional data, e.g. news, sports, stocks, weather forecasts
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Abstract

The embodiment of the invention discloses a method and a device for converting message formats, a storage medium and an android terminal. The method comprises the following steps: when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message; constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information; and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data. By adopting the technical scheme provided by the application, the effect of converting the bullet screen message format into the Json data format can be realized, and the purpose of data transmission of the bullet screen message is realized through the Json data format.

Description

Message format conversion method and device, storage medium and android terminal
Technical Field
The embodiment of the invention relates to the technical field of android, in particular to a method and a device for converting a message format, a storage medium and an android terminal.
Background
The rapid development of the internet nowadays, the demand change of network users is fast and large, and the transmission and conversion efficiency of data messages has become one of the more concerned problems in the field.
Currently, barrage messages are the current interest of users in watching online videos, online live broadcasts, and other video-type programs. Data transmission is usually in a Json format, and how to convert bullet screen messages into the Json data format for data transmission becomes a technical problem which is urgently needed to be broken through by technicians.
Disclosure of Invention
The embodiment of the invention provides a message format conversion method, a message format conversion device, a storage medium and an android terminal, which can realize the effect of converting a bullet screen message format into a Json data format, so that the aim of data transmission of bullet screen messages is fulfilled through the Json data format.
In a first aspect, an embodiment of the present invention provides a method for converting a message format, where the method includes:
when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message;
constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information;
and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data.
Further, when receiving the bullet screen message to be converted, obtaining the key value pair information of the bullet screen message, including:
acquiring a key value pair information character string of the bullet screen message;
and dividing the key value pair information character string by calling a split method to obtain the key value pair information.
Further, constructing an InfoBean object by a predefined InfoBean type, storing value information in the key-value pair information into a field corresponding to the key information in the InfoBean object according to a corresponding relationship with the key information, and including:
sequentially taking out value information corresponding to the key information by calling an mInfoBean.get () method;
set () method value information is called to be stored into a corresponding key information field in an InfoBean object, wherein the InfoBean object key information field is a field of a predefined private access type.
Further, acquiring a key information character string and a value information character string in the called InfoBean object, and splicing the key information character string and the value information character string through a preset format to obtain Json data, wherein the method comprises the following steps:
acquiring a key information character string and a value information character string in the called InfoBean object;
and adding Json data format standard characters between all the key information character strings and the value information character strings by calling an apend () method to obtain Json data.
Further, acquiring a key information character string and a value information character string in the called InfoBean object, including:
and calling the key information and the value information in the InfoBean object through a get () function to be used as a key information character string and a value information character string.
Further, the calling the key information and the value information in the InfoBean object by the get () function as a key information string and a value information string includes:
and calling the key information in the InfoBean object through a get () function, taking the object of the get () function as a key information character string, and taking the return value of the get () function as a value information character string.
In a second aspect, an embodiment of the present invention further provides a device for converting a message format, where the device includes:
the system comprises a key value pair information acquisition module, a key value pair information conversion module and a conversion module, wherein the key value pair information acquisition module is used for acquiring the key value pair information of a bullet screen message when the bullet screen message to be converted is received;
the key value pair information storage module is used for constructing an InfoBean object through a predefined InfoBean type and storing the value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information;
and the Json data generation module is used for acquiring a key information character string and a value information character string in the called InfoBean object, and splicing the key information character string and the value information character string through a preset format to obtain Json data.
Further, the key-value pair information obtaining module includes:
the key value pair information character string acquisition unit is used for acquiring a key value pair information character string of the bullet screen message;
and the key value pair information dividing unit divides the key value pair information character string by calling a split method to obtain the key value pair information.
In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements a method for converting a message format according to an embodiment of the present application.
In a fourth aspect, an embodiment of the present application provides an android terminal, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method for converting a message format according to the embodiment of the present application when executing the computer program.
According to the technical scheme provided by the embodiment of the application, when the bullet screen message to be converted is received, the key value pair information of the bullet screen message is obtained; constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information; and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data. By adopting the technical scheme provided by the application, the effect of converting the bullet screen message format into the Json data format can be realized, and the purpose of data transmission of the bullet screen message is realized through the Json data format.
Drawings
Fig. 1 is a flowchart of a method for converting a message format according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a message format conversion apparatus according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an android terminal provided in an embodiment of the present application.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a message format conversion method provided in an embodiment of the present invention, where the present embodiment is applicable to a case of message format conversion, and the method may be executed by a message format conversion device provided in an embodiment of the present invention, and the device may be implemented by software and/or hardware, and may be integrated in an android terminal.
As shown in fig. 1, the method for converting the message format includes:
s110, when receiving the bullet screen message to be converted, obtaining the key value pair information of the bullet screen message.
The bullet screen message to be converted may be acquired in a network connection manner, and there are many types and contents of the bullet screen message. Illustratively, the bullet screen message content is as follows: name @ zhangsan/age @ 20/height @ 180/sex @ male, where name and zhangsan are just one key-value pair information, age and 20 are another key-value pair information, and similarly, height and 180, and sex and male are both one key-value pair information.
In this embodiment, optionally, when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message, including: acquiring a key value pair information character string of the bullet screen message; and dividing the key value pair information character string by calling a split method to obtain the key value pair information. The bullet screen message content is analyzed and divided into specific key value pair information through a multi-time character string division split method, and the method has the advantages that the specific key value pair information can be acquired, and standard symbols such as '@' and '/' are removed.
S120, constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information.
It can be known that the present embodiment may construct an InfoBean object by using an existing InfoBean type or by defining a type in advance.
For example, the Json data format may be: jsonnstr { "name": zhangsan "," age ": 20", "height": 180"," sex ": male" }, the definition of the InfoBean type may be as follows:
Figure BDA0001718353560000061
Figure BDA0001718353560000071
the information can be obtained by an InfoBean mlnfbean ═ new InfoBean (); the method constructs an InfoBean object.
In this embodiment, optionally, the obtaining a corresponding relationship between key information and value information in key-value pair information in the InfoBean object, and then storing the value information in the key-value pair information into a field corresponding to the key information according to the corresponding relationship includes: sequentially taking out value information corresponding to the key information by calling an mInfoBean.get () method; and storing the InfoBean () method value information into a corresponding key information field in the InfoBean object by calling the InfoBean () method value information, wherein the InfoBean object key information field is a field of a predefined private access type.
The method may sequentially fetch value information corresponding to a key in mlnfbean. Setname ("zhangsan") method is called to store a value into the same field information corresponding to the mlnfbean object, i.e., the name field of the mlnfbean object.
S130, obtaining a key information character string and a value information character string in the called InfoBean object, and splicing through a preset format to obtain Json data.
In this embodiment, optionally, a key information character string and a value information character string in the InfoBean object are obtained and called; and adding Json data format standard characters between all the key information character strings and the value information character strings by calling an apend () method to obtain Json data. The advantage of this arrangement is that the synthesis of the Json data can be realized by complementing the format after obtaining the key information and the value information in the key-value pair information.
In this embodiment, optionally, the obtaining of the key information character string and the value information character string in the InfoBean object includes: and calling the key information and the value information in the InfoBean object through a get () function to be used as a key information character string and a value information character string. The method has the advantages that the key information and the value information can be called through a get () function, the method is simple and convenient, and developers can realize the key information and the value information through a simple programming process.
In this embodiment, optionally, the calling the key information and the value information in the InfoBean object by the get () function as a key information string and a value information string includes: and calling the key information in the InfoBean object through a get () function, taking the object of the get () function as a key information character string, and taking the return value of the get () function as a value information character string. This has the advantage that the field information, i.e. the key information, and the content stored in the field, i.e. the value information, can be obtained in one go by the get () function.
The Json data format may be a pre-obtained format that can be used for data transmission, such as adding some specific identifier between key-value pair information. Illustratively, the Json data format is as follows: jsonnstr { "name": zhangsan "," age ": 20", "height": 180"," sex ": male" }, where it can be known that "can be inserted between each key-value pair by calling the ap pend () method: "character, and need to insert between each group of key-value pairs", "character, and double quotation marks are added to the character string of each key information and value information. This results in the Json data content. Adding a piece of data by calling stringbuilder.apend (":"). apend (value) in stringBuilder, wherein the apend method indicates that a character string is added in the stringBuilder. The above-mentioned key-value pair information may be added during each round of mMap objects, and an end character may be added by calling the stringbuilder. appended (",") method at the end of each round. Thus all data is stored in stringBuilder when the entire round is completed. The final String type exclusive tmpResultStr is then obtained by calling the String builder. tostring method in the String builder object. It can be known from the above analysis that, in the above generation process, a "/" separator is added to the last bit, at this time, we need to remove the last character by calling tmpesultstr.substring (0, tmpesultstr.length-1) in tmpesultstr, and the intercepted character is marked as resultStr, at this time, resultStr is the specific information content of the bullet screen protocol we need.
According to the technical scheme provided by the embodiment of the application, when the bullet screen message to be converted is received, the key value pair information of the bullet screen message is obtained; constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information; and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data. By adopting the technical scheme provided by the application, the effect of converting the bullet screen message format into the Json data format can be realized, and the purpose of data transmission of the bullet screen message is realized through the Json data format.
In the embodiment of the invention, firstly, the method comprises the steps of (1) obtaining a new InfoBean () through an InfoBean mInfoBean; the method constructs an mlnfobean object. And analyzing and segmenting the content of the bullet screen message to obtain specific key value pair information by a multi-time character string segmentation split method, and sequentially extracting value information corresponding to a key in the mlnfbean. Getname ("zhangsan") method is called to store a value into the same field information corresponding to the mlnfbean object, i.e., the name field of the mlnfbean object. Finally, after the key-value pair information is stored in the mlnfbean object, the field in the mlnfbean object can be acquired through a get function to serve as the key information, the content stored in the field is acquired to serve as the value information, and then the key-value pair is formed again, so that the conversion of the data format is realized.
Example two
Fig. 2 is a schematic structural diagram of a message format conversion apparatus according to a second embodiment of the present invention. As shown in fig. 2, the message format conversion device includes:
a key value pair information obtaining module 210, configured to obtain key value pair information of a bullet screen message when the bullet screen message to be converted is received;
a key-value pair information storage module 220, configured to construct an InfoBean object according to a predefined InfoBean type, and store value information in the key-value pair information into a field, corresponding to key information, in the InfoBean object according to a correspondence relationship with the key information;
and the Json data generating module 230 is configured to acquire a key information character string and a value information character string in the called InfoBean object, and perform splicing according to a preset format to obtain Json data.
According to the technical scheme provided by the embodiment of the application, when the bullet screen message to be converted is received, the key value pair information of the bullet screen message is obtained; constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information; and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data. By adopting the technical scheme provided by the application, the effect of converting the bullet screen message format into the Json data format can be realized, and the purpose of data transmission of the bullet screen message is realized through the Json data format.
On the basis of the foregoing technical solutions, optionally, the key-value pair information obtaining module includes: the key value pair information character string acquisition unit is used for acquiring a key value pair information character string of the bullet screen message; and the key value pair information dividing unit divides the key value pair information character string by calling a split method to obtain the key value pair information.
The product can execute the method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE III
Embodiments of the present application also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for converting a message format, the method comprising:
when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message;
constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information;
and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the computer system in which the program is executed, or may be located in a different second computer system connected to the computer system through a network (such as the internet). The second computer system may provide the program instructions to the computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations, such as in different computer systems that are connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the message format conversion operation described above, and may also perform related operations in the message format conversion method provided in any embodiments of the present application.
Example four
The embodiment of the application provides an android terminal, and a conversion device of a message format provided by the embodiment of the application can be integrated in the android terminal. Fig. 3 is a schematic structural diagram of an android terminal provided in an embodiment of the present application. As shown in fig. 3, the android terminal may include: a memory 301, a Central Processing Unit (CPU) 302 (also called a processor, hereinafter referred to as CPU), a circuit board (not shown), and a power circuit (not shown). The circuit board is arranged in a space enclosed by the shell; the CPU302 and the memory 301 are disposed on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the android terminal; the memory 301 is used for storing executable program codes; the CPU302 executes a computer program corresponding to the executable program code by reading the executable program code stored in the memory 301 to implement the steps of:
when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message;
constructing an InfoBean object through a predefined InfoBean type, and storing value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information;
and acquiring a key information character string and a value information character string in the called InfoBean object, and splicing by a preset format to obtain Json data.
The android terminal further comprises: peripheral interface 303, RF (Radio Frequency) circuitry 305, audio circuitry 306, speakers 311, power management chip 308, input/output (I/O) subsystems 309, touch screen 312, other input/control devices 310, and external ports 304, which communicate via one or more communication buses or signal lines 307.
It should be understood that the illustrated android terminal 300 is merely one example of an android terminal, and the android terminal 300 may have more or fewer components than shown in the figures, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The following describes in detail the android terminal for message format conversion provided by this embodiment, where the android terminal takes a mobile phone as an example.
A memory 301, the memory 301 being accessible by a CPU302, a peripheral interface 303, or the like, the memory 301 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic disk storage devices, flash memory devices, or other volatile solid state storage devices.
A peripheral interface 303, said peripheral interface 303 being capable of connecting input and output peripherals of the device to the CPU302 and the memory 301.
I/O subsystem 309, the I/O subsystem 309 may connect input and output peripherals on the device, such as touch screen 312 and other input/control devices 310, to the peripheral interface 303. The I/O subsystem 309 may include a display controller 3091 and one or more input controllers 3092 for controlling other input/control devices 310. Where one or more input controllers 3092 receive electrical signals from or send electrical signals to other input/control devices 310, the other input/control devices 310 may include physical buttons (push buttons, rocker buttons, etc.), dials, slide switches, joysticks, click wheels. It is noted that the input controller 3092 may be connected to any of the following: a keyboard, an infrared port, a USB interface, and a pointing device such as a mouse.
And a touch screen 312, wherein the touch screen 312 is an input interface and an output interface between the android terminal of the user and the user, and displays visual output to the user, and the visual output can comprise graphics, text, icons, videos and the like.
The display controller 3091 in the I/O subsystem 309 receives electrical signals from the touch screen 312 or transmits electrical signals to the touch screen 312. The touch screen 312 detects a contact on the touch screen, and the display controller 3091 converts the detected contact into an interaction with a user interface object displayed on the touch screen 312, i.e., implements a human-machine interaction, and the user interface object displayed on the touch screen 312 may be an icon for running a game, an icon networked to a corresponding network, or the like. It is worth mentioning that the device may also comprise a light mouse, which is a touch sensitive surface that does not show visual output, or an extension of the touch sensitive surface formed by the touch screen.
The RF circuit 305 is mainly used to establish communication between the mobile phone and the wireless network (i.e., the network side), and implement data reception and transmission between the mobile phone and the wireless network. Such as sending and receiving short messages, e-mails, etc. In particular, the RF circuitry 305 receives and transmits RF signals, also referred to as electromagnetic signals, through which the RF circuitry 305 converts electrical signals to or from electromagnetic signals and communicates with communication networks and other devices. RF circuitry 305 may include known circuitry for performing these functions including, but not limited to, an antenna system, an RF transceiver, one or more amplifiers, a tuner, one or more oscillators, a digital signal processor, a CODEC (CODEC) chipset, a Subscriber Identity Module (SIM), and so forth.
The audio circuit 306 is mainly used to receive audio data from the peripheral interface 303, convert the audio data into an electric signal, and transmit the electric signal to the speaker 311.
And a speaker 311 for converting the voice signal received by the handset from the wireless network through the RF circuit 305 into sound and playing the sound to the user.
And the power management chip 308 is used for supplying power and managing power to the hardware connected with the CPU302, the I/O subsystem, and the peripheral interface.
The android terminal provided by the embodiment of the application can convert the bullet screen message format into the Json data format effect, so that the aim of data transmission of the bullet screen message is fulfilled through the Json data format.
The message format conversion device, the storage medium and the android terminal provided in the above embodiments can execute the message format conversion method provided in any embodiment of the present application, and have corresponding functional modules and beneficial effects for executing the method. For technical details not described in detail in the above embodiments, reference may be made to a message format conversion method provided in any embodiment of the present application.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (9)

1. A method for converting a message format, comprising:
when receiving a bullet screen message to be converted, acquiring key value pair information of the bullet screen message;
constructing an InfoBean object through a predefined InfoBean type, acquiring the corresponding relation between key information and value information in the key value pair information in the InfoBean object, and storing the value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation with the key information;
acquiring a key information character string and a value information character string in a called InfoBean object, splicing through a preset format, and adding Json data format standard characters between all the key information character strings and value information character strings by calling an apend () method; obtaining unique tmpesultStr of a last String type by calling a stringBuilder.tostring method in a stringBuilder object, adding a separator to the last bit of the unique tmpesultStr, removing the last character by calling tmpesultStr.substring (0, tmpesultStr.length-1) in the tmpesultStr, marking the intercepted character as resultStr to serve as specific information content of a bullet screen protocol, wherein the specific information content of the bullet screen protocol is Json data required to be obtained.
2. The method of claim 1, wherein obtaining key-value pair information of a bullet screen message when the bullet screen message to be converted is received comprises:
acquiring a key value pair information character string of the bullet screen message;
and dividing the key value pair information character string by calling a split method to obtain the key value pair information.
3. The method as claimed in claim 1, wherein constructing an InfoBean object by a predefined InfoBean type, obtaining a correspondence between key information and value information in the key-value pair information in the InfoBean object, and storing the value information in the key-value pair information in a field corresponding to the key information in the InfoBean object according to the correspondence with the key information, comprises:
sequentially taking out value information corresponding to the key information by calling an mInfoBean.get () method;
and storing the value information into a corresponding key information field in the InfoBean object by calling an mInfoBean.set () method, wherein the InfoBean object key information field is a field of a predefined private access type.
4. The method as claimed in claim 1, wherein obtaining the key information string and the value information string in the call InfoBean object comprises:
and calling the key information and the value information in the InfoBean object through a get () function to be used as a key information character string and a value information character string.
5. The method as claimed in claim 4, wherein the retrieving the key information and the value information in the InfoBean object as a key information string and a value information string by get () function comprises:
and calling the key information in the InfoBean object through a get () function, taking the object of the get () function as a key information character string, and taking the return value of the get () function as a value information character string.
6. An apparatus for converting a message format, comprising:
the system comprises a key value pair information acquisition module, a key value pair information conversion module and a conversion module, wherein the key value pair information acquisition module is used for acquiring the key value pair information of a bullet screen message when the bullet screen message to be converted is received;
the key value pair information storage module is used for constructing an InfoBean object through a predefined InfoBean type, acquiring the corresponding relation between key information and value information in the key value pair information in the InfoBean object, and storing the value information in the key value pair information into a field corresponding to the key information in the InfoBean object according to the corresponding relation between the value information and the key information;
the Json data generation module is used for acquiring key information character strings and value information character strings in the called InfoBean object, splicing the key information character strings and the value information character strings through a preset format, and adding Json data format standard characters between all the key information character strings and the value information character strings through calling an apend () method; obtaining unique tmpesultStr of a last String type by calling a stringBuilder.tostring method in a stringBuilder object, adding a separator to the last bit of the unique tmpesultStr, removing the last character by calling tmpesultStr.substring (0, tmpesultStr.length-1) in the tmpesultStr, marking the intercepted character as resultStr to serve as specific information content of a bullet screen protocol, wherein the specific information content of the bullet screen protocol is Json data required to be obtained.
7. The apparatus of claim 6, wherein the key-value pair information obtaining module comprises:
the key value pair information character string acquisition unit is used for acquiring a key value pair information character string of the bullet screen message;
and the key value pair information dividing unit divides the key value pair information character string by calling a split method to obtain the key value pair information.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of converting a message format according to any one of claims 1 to 5.
9. An android terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method for converting a message format according to any one of claims 1 to 5 when executing the computer program.
CN201810719671.1A 2018-07-03 2018-07-03 Message format conversion method and device, storage medium and android terminal Active CN108933968B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810719671.1A CN108933968B (en) 2018-07-03 2018-07-03 Message format conversion method and device, storage medium and android terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810719671.1A CN108933968B (en) 2018-07-03 2018-07-03 Message format conversion method and device, storage medium and android terminal

Publications (2)

Publication Number Publication Date
CN108933968A CN108933968A (en) 2018-12-04
CN108933968B true CN108933968B (en) 2022-02-08

Family

ID=64446651

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810719671.1A Active CN108933968B (en) 2018-07-03 2018-07-03 Message format conversion method and device, storage medium and android terminal

Country Status (1)

Country Link
CN (1) CN108933968B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111626018B (en) * 2019-02-28 2023-07-28 北京数聚鑫云信息技术有限公司 Method and device for constructing JSON formatted data
CN110096379B (en) * 2019-04-30 2022-09-09 武汉斗鱼鱼乐网络科技有限公司 Message distribution method, device, equipment and storage medium based on general protocol
CN113779018A (en) * 2020-08-03 2021-12-10 北京沃东天骏信息技术有限公司 Data processing method and device
CN113468866B (en) * 2021-06-30 2022-09-16 建信金融科技有限责任公司 Method and device for analyzing non-standard JSON string

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106973332A (en) * 2017-03-10 2017-07-21 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method, analytic method and system

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7945904B2 (en) * 2005-08-22 2011-05-17 Microsoft Corporation Embedding expression in XML literals
US8938520B2 (en) * 2012-04-03 2015-01-20 Salesforce.Com, Inc. Methods and systems for smart adapters in a social media content analytics environment
CN103886078B (en) * 2014-03-25 2017-05-10 烟台中科网络技术研究所 Universal news comment collection method and device
US10176234B2 (en) * 2014-11-05 2019-01-08 Ab Initio Technology Llc Impact analysis
WO2016170798A1 (en) * 2015-04-22 2016-10-27 Sharp Kabushiki Kaisha Systems and methods for content information communication
CN105468777A (en) * 2015-12-14 2016-04-06 江苏鼎峰信息技术有限公司 Database connection structure based on json format
CN106598922B (en) * 2016-12-23 2020-01-14 Tcl集团股份有限公司 Character string conversion method and system
CN108174276B (en) * 2018-01-04 2020-10-20 北京奇艺世纪科技有限公司 Bullet screen display method and display device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106973332A (en) * 2017-03-10 2017-07-21 武汉斗鱼网络科技有限公司 A kind of barrage message treatment method, analytic method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JSON数据格式解析 转;未知;《豆丁网》;20110624;第6页 *

Also Published As

Publication number Publication date
CN108933968A (en) 2018-12-04

Similar Documents

Publication Publication Date Title
CN108933968B (en) Message format conversion method and device, storage medium and android terminal
US20220053068A1 (en) Methods, apparatuses and computer storage media for applet state synchronization
CN106990912B (en) Method for controlling SIM card and SD card and electronic equipment for realizing the card
CN108710515B (en) Application preloading method and device, storage medium and terminal
CN107770759B (en) Bluetooth voice link establishing method and device, storage medium and mobile terminal
CN108681474B (en) Application preloading method and device, storage medium and terminal
CN108347719B (en) Bluetooth device connection method, device, storage medium, mobile terminal and server
CN106776259B (en) Mobile terminal frame rate detection method and device and mobile terminal
CN106874131B (en) Broadcast queue adjusting method and device and terminal equipment
US10863521B1 (en) Broadcast receiver control method and apparatus, and mobile terminal
US11048568B2 (en) Broadcast sending control method and apparatus, storage medium, and electronic device
CN106851016A (en) Broadcast the message method, device and the terminal queued up
CN108833033B (en) Method and device for determining radio frequency calibration parameters, storage medium and mobile terminal
CN109005469B (en) Message format conversion method and device, storage medium and android terminal
CN108769232A (en) Application resource method for pushing, device, equipment and storage medium
CN106776847B (en) Method and device for deleting media file and mobile terminal
CN106791090B (en) Mobile terminal restart control method and device and mobile terminal
CN107708183B (en) Decoding algorithm determination method, device, terminal and storage medium
CN107992302B (en) Button configuration method and device, storage medium and intelligent terminal
CN109753262B (en) Frame display processing method and device, terminal equipment and storage medium
CN109107148B (en) Control method, control device, storage medium and mobile terminal
CN106708637B (en) Method, device and terminal for sending startup broadcast
CN107025058B (en) Information writing method and device of mobile terminal and mobile terminal
CN108153676A (en) Debugging management method, apparatus, storage medium and terminal device
CN107729302B (en) Decoding algorithm determination method, device, terminal and storage medium

Legal Events

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