CN112685044A - Webpage compression and storage method and system based on ROM - Google Patents
Webpage compression and storage method and system based on ROM Download PDFInfo
- Publication number
- CN112685044A CN112685044A CN202011512987.7A CN202011512987A CN112685044A CN 112685044 A CN112685044 A CN 112685044A CN 202011512987 A CN202011512987 A CN 202011512987A CN 112685044 A CN112685044 A CN 112685044A
- Authority
- CN
- China
- Prior art keywords
- web
- code
- file
- rom
- sequence
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 230000006835 compression Effects 0.000 title claims abstract description 21
- 238000007906 compression Methods 0.000 title claims abstract description 21
- 238000006243 chemical reaction Methods 0.000 claims abstract description 18
- 108091026890 Coding region Proteins 0.000 claims abstract description 13
- 238000004590 computer program Methods 0.000 claims description 13
- 238000007781 pre-processing Methods 0.000 claims description 8
- 238000003491 array Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000010276 construction Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
The invention provides a webpage compression and storage method and system based on a ROM, which comprises the following steps: performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file; converting the coding sequence into a code file written by a programming language; and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client. According to the webpage compression and storage method and system based on the ROM, more and richer web resources can be stored through the method, hardware does not need to be changed, and the web resources are coded, so that the method is also suitable for equipment without a file system.
Description
Technical Field
The invention relates to the technical field of network communication, in particular to a webpage compression and storage method and system based on a Read Only Memory (ROM).
Background
The embedded device is widely applied in the field of network technology, more and more embedded devices provide parameter setting and display interfaces based on a B/S architecture, but the hardware resources of the embedded device are often limited, which limits the design of web pages, and particularly for some products with formed hardware architectures, the web pages are further added, but the situation that the storage space is insufficient is often encountered.
Therefore, a method and system for compressing and storing web pages based on ROM is needed to solve the problem.
Disclosure of Invention
The invention provides a webpage compression and storage method and system based on a ROM (read only memory), which can store more and richer web resources without changing hardware and code the web resources, so that the method is also suitable for equipment without a file system.
In a first aspect, an embodiment of the present invention provides a method for compressing and storing a web page based on a ROM, including:
performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file;
converting the coding sequence into a code file written by a programming language;
and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client.
Wherein the method further comprises:
and preprocessing the web file and reserving a code part.
Preprocessing the web file, and reserving a code part, wherein the preprocessing the web file comprises the following steps:
and eliminating all line feed, blank spaces and comments of the text document in the web file, and only reserving a code part needing machine execution.
The method for converting the codes of the web files based on the pre-programmed code table to obtain the code sequence of each web file comprises the following steps:
the code table is made by counting the occurrence probability of each character in the web file in advance to define the code sequence of the character, wherein the higher the occurrence probability of the character is, the shorter the code sequence is.
Wherein converting the code sequence into a code file written in a programming language comprises:
storing binary numbers corresponding to the coding sequences by using arrays, wherein each web file corresponds to one binary number array;
the binary array is generated as a code file.
Wherein, the decoding system based on pre-construction decodes the code file into corresponding web resources, and feeds back the web resources to the client, and comprises:
traversing the coding array to find corresponding web resources;
and restoring the binary sequence in the array into characters based on the pre-constructed decoding system, replying the characters to the web server, and finally feeding back the characters to the client.
In a second aspect, an embodiment of the present invention provides a ROM-based web page compression and storage system, including:
the code conversion module is used for performing code conversion on the web files based on a pre-compiled code table to obtain a code sequence of each web file;
the code conversion module is used for converting the coding sequence into a code file written by a programming language;
and the decoding module is used for decoding the code file into the corresponding web resource based on the pre-constructed decoding system and feeding back the web resource to the client.
In a third aspect, an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the method for compressing and storing a ROM-based web page provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing the steps of the ROM-based web page compression and storage method as provided in the first aspect above.
According to the webpage compression and storage method and system based on the ROM, more and richer web resources can be stored through the method, hardware does not need to be changed, and the web resources are coded, so that the method is also suitable for equipment without a file system.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flowchart illustrating a method for compressing and storing a web page based on a ROM according to an embodiment of the present invention;
FIG. 2 is a flow chart of a system provided by an embodiment of the present invention;
FIG. 3 is a schematic diagram of a ROM-based web page compression and storage system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Fig. 1 is a schematic flowchart of a method for compressing and storing a web page based on a ROM according to an embodiment of the present invention, as shown in fig. 1, including:
101. performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file;
102. converting the coding sequence into a code file written by a programming language;
103. and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client.
Fig. 2 is a system flowchart provided by the embodiment of the present invention, and as shown in fig. 2, when a storage space is insufficient, the embodiment of the present invention encodes and compresses a web file by using an encoding algorithm, stores more richer web page files in a fixed ROM, and further converts the encoded file into a C code, so as to get rid of dependency on a file system.
Specifically, in step 101, the embodiment of the present invention performs transcoding on the written web file, then performs C-transcoding in step 102, and finally performs decoding in step 103, where step 101 and step 102 are completed in the compiling environment, and step 103 is completed in the target device.
According to the webpage compression and storage method and system based on the ROM, more and richer web resources can be stored through the method, hardware does not need to be changed, and the web resources are coded, so that the method is also suitable for equipment without a file system.
On the basis of the above embodiment, the method further includes:
and preprocessing the web file and reserving a code part.
On the basis of the above embodiment, preprocessing the web file, and reserving a code portion includes:
and eliminating all line feed, blank spaces and comments of the text document in the web file, and only reserving a code part needing machine execution.
Specifically, the embodiment of the invention preprocesses the written web file, and mainly aims at text files such as html, CSS, js and the like. In the preprocessing stage, all line feed, blank spaces, comments and the like in the text documents are removed in a unified way, so that people can conveniently view the symbols and texts of the codes, and only the most core code parts needing machine execution are reserved.
On the basis of the above embodiment, the transcoding web files based on a pre-programmed coding table to obtain a coding sequence of each web file includes:
the code table is made by counting the occurrence probability of each character in the web file in advance to define the code sequence of the character, wherein the higher the occurrence probability of the character is, the shorter the code sequence is.
In particular, web documents are typically described in terms of codes such as utf-8, unicode, or gbk, with each character corresponding to a fixed length code sequence, and the code sequences are stored in the storage medium. For a written web file, the probability of each character appearing is different, and if each character is coded and stored according to a certain length, space is wasted. Based on this, the probability of each character appearing in these documents can be counted in advance, the coding sequence of these characters is defined, a coding table is compiled, and the principle is as follows: the higher the probability of occurrence of a character, the shorter its code sequence. After the web files are coded in this way, the web files are compressed, and the coded sequence of each web file can be temporarily stored in the file as a subsequent input.
On the basis of the above embodiment, the converting the code sequence into a code file written in a programming language includes:
storing binary numbers corresponding to the coding sequences by using arrays, wherein each web file corresponds to one binary number array;
the binary array is generated as a code file.
Specifically, the above-described encoded file is converted. The coding sequence in the coding file is a continuous binary number, in the programming language, the binary number can be stored by using an array, each web file corresponds to an array, and finally a code file is formed. The code file can be compiled with the web server program, so that the web file becomes a part of the executive program and is stored in the ROM, and the dependency on a file system is eliminated.
On the basis of the above embodiment, the decoding system based on pre-construction decodes the code file into a corresponding web resource, and feeds back the web resource to the client, and includes:
traversing the coding array to find corresponding web resources;
and restoring the binary sequence in the array into characters based on the pre-constructed decoding system, replying the characters to the web server, and finally feeding back the characters to the client.
Specifically, the embodiment of the present invention constructs a decoding system, and after receiving a request from a client, a web server sends a corresponding request to the decoding system, and the decoding system finds a corresponding web resource by traversing a coding array, decodes the web resource by using a coding table, reduces a binary sequence in the array into a character, replies the character to the web server, and finally feeds the character back to the client.
Fig. 3 is a schematic structural diagram of a ROM-based web page compression and storage system according to an embodiment of the present invention, as shown in fig. 3, including: a transcoding module 301, a transcoding module 302, and a decoding module 303, wherein:
the code conversion module 301 is configured to perform code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file;
the code conversion module 302 is used for converting the code sequence into a code file written by a programming language;
the decoding module 303 is configured to decode the code file into a corresponding web resource based on a pre-constructed decoding system, and feed back the web resource to the client.
For details, how to compress and store the web page based on the ROM by using the code conversion module 301, the code conversion module 302, and the decoding module 303 may refer to the above method embodiments, and the embodiments of the present invention are not described herein again.
In an embodiment, based on the same concept, an embodiment of the present invention further provides an electronic device, as shown in fig. 4, where fig. 4 illustrates a schematic structural diagram of the electronic device, and the electronic device may include: a processor (processor)401, a communication Interface (communication Interface)402, a memory (memory)403 and a bus 404, wherein the processor 401, the communication Interface 402 and the memory 403 complete communication with each other through the bus 404. Processor 401 may invoke logic instructions in memory 403 to perform the steps of a road network matching method between heterogeneous high-precision maps, for example, including: performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file; converting the coding sequence into a code file written by a programming language; and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client.
In one embodiment, based on the same concept, the present embodiment further provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a computer, the computer can execute the steps of the road network matching method between the heterogeneous high-precision maps provided by the above-mentioned method embodiments, for example, the steps include: performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file; converting the coding sequence into a code file written by a programming language; and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client. In one embodiment, based on the same concept, the embodiment of the present invention further provides a non-transitory computer-readable storage medium, which stores a computer program, and when the computer program is executed by a computer, the computer program causes the computer to perform the steps of the road network matching method between the heterogeneous high-precision maps provided by the above embodiments, for example, the steps include: performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file; converting the coding sequence into a code file written by a programming language; and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client.
The embodiments of the present invention can be arbitrarily combined to achieve different technical effects.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (9)
1. A webpage compression and storage method based on ROM is characterized by comprising the following steps:
performing code conversion on the web files based on a pre-programmed code table to obtain a code sequence of each web file;
converting the coding sequence into a code file written by a programming language;
and decoding the code file into corresponding web resources based on a pre-constructed decoding system, and feeding back the web resources to the client.
2. The ROM-based web page compression and storage method of claim 1, wherein the method further comprises:
and preprocessing the web file and reserving a code part.
3. The ROM-based web page compression and storage method of claim 2, wherein preprocessing the web file, preserving a code portion, comprises:
and eliminating all line feed, blank spaces and comments of the text document in the web file, and only reserving a code part needing machine execution.
4. The ROM-based web page compression and storage method of claim 1, wherein the transcoding web files based on a pre-programmed coding table to obtain a coding sequence of each web file comprises:
the code table is made by counting the occurrence probability of each character in the web file in advance to define the code sequence of the character, wherein the higher the occurrence probability of the character is, the shorter the code sequence is.
5. The ROM-based web page compression and storage method of claim 1, wherein converting the encoded sequence into a code file written in a programming language comprises:
storing binary numbers corresponding to the coding sequences by using arrays, wherein each web file corresponds to one binary number array;
the binary array is generated as a code file.
6. The ROM-based web page compression and storage method of claim 5, wherein the pre-built decoding system decodes the code file into the corresponding web resource for feedback to the client, and comprises:
traversing the coding array to find corresponding web resources;
and restoring the binary sequence in the array into characters based on the pre-constructed decoding system, replying the characters to the web server, and finally feeding back the characters to the client.
7. A ROM-based web page compression and storage system, comprising:
the code conversion module is used for performing code conversion on the web files based on a pre-compiled code table to obtain a code sequence of each web file;
the code conversion module is used for converting the coding sequence into a code file written by a programming language;
and the decoding module is used for decoding the code file into the corresponding web resource based on the pre-constructed decoding system and feeding back the web resource to the client.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the ROM-based web page compression and storage method according to any one of claims 1 to 6 are implemented when the program is executed by the processor.
9. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the ROM-based web page compression and storage method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011512987.7A CN112685044A (en) | 2020-12-20 | 2020-12-20 | Webpage compression and storage method and system based on ROM |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011512987.7A CN112685044A (en) | 2020-12-20 | 2020-12-20 | Webpage compression and storage method and system based on ROM |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112685044A true CN112685044A (en) | 2021-04-20 |
Family
ID=75450502
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011512987.7A Pending CN112685044A (en) | 2020-12-20 | 2020-12-20 | Webpage compression and storage method and system based on ROM |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112685044A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101783788A (en) * | 2009-01-21 | 2010-07-21 | 联想(北京)有限公司 | File compression method, file compression device, file decompression method, file decompression device, compressed file searching method and compressed file searching device |
CN103458037A (en) * | 2013-09-06 | 2013-12-18 | 南京南自信息技术有限公司 | Method and device for providing complex web applications in resource-constrained environment |
CN106790334A (en) * | 2015-11-25 | 2017-05-31 | 广州市动景计算机科技有限公司 | A kind of page data transmission method and system |
-
2020
- 2020-12-20 CN CN202011512987.7A patent/CN112685044A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101783788A (en) * | 2009-01-21 | 2010-07-21 | 联想(北京)有限公司 | File compression method, file compression device, file decompression method, file decompression device, compressed file searching method and compressed file searching device |
CN103458037A (en) * | 2013-09-06 | 2013-12-18 | 南京南自信息技术有限公司 | Method and device for providing complex web applications in resource-constrained environment |
CN106790334A (en) * | 2015-11-25 | 2017-05-31 | 广州市动景计算机科技有限公司 | A kind of page data transmission method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100614677B1 (en) | Method for compressing/decompressing a structured document | |
US10701150B2 (en) | Method and apparatus for storing network data | |
US20110153531A1 (en) | Information processing apparatus and control method for the same | |
CN102880703B (en) | Chinese web page data encoding, coding/decoding method and system | |
CN111131403A (en) | Message coding and decoding method and device for Internet of things equipment | |
WO2013097802A1 (en) | Method and device for compressing, decompressing and querying document | |
CN110545106A (en) | Method and device for coding time series data | |
CN111159394A (en) | Text abstract generation method and device | |
CN110674488A (en) | Verification code identification method and system based on neural network and computer equipment | |
CN103605730A (en) | XML (extensible markup language) compressing method and device based on flexible-length identification codes | |
CN110020343B (en) | Method and device for determining webpage coding format | |
CN112685044A (en) | Webpage compression and storage method and system based on ROM | |
CN113163198A (en) | Image compression method, decompression method, device, equipment and storage medium | |
US9235610B2 (en) | Short string compression | |
WO2023159820A1 (en) | Image compression method, image decompression method, and apparatuses | |
CN114254585A (en) | Font generation method and device, electronic equipment and storage medium | |
US10534855B2 (en) | EXI grammars to represent JSON schemas | |
KR102186172B1 (en) | Method and Apparatus for Processing HL7 Message for Version-Compatibility | |
CN111475679B (en) | HTML document processing method, page display method and equipment | |
CN112749353A (en) | Processing method and device of webpage icon | |
CN105574569B (en) | Method and device for generating bar code and server | |
CN105450504A (en) | Processing method and system for picture link | |
CN106933852B (en) | Webpage updating request generation method and device and response method and device thereof | |
CN109302467B (en) | Message distribution method, device, terminal and storage medium | |
CN117149713A (en) | Method, device, equipment and storage medium for processing coded data |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210420 |