CN101951401B - Method and device for uploading files in WebKit browser - Google Patents
Method and device for uploading files in WebKit browser Download PDFInfo
- Publication number
- CN101951401B CN101951401B CN 201010283545 CN201010283545A CN101951401B CN 101951401 B CN101951401 B CN 101951401B CN 201010283545 CN201010283545 CN 201010283545 CN 201010283545 A CN201010283545 A CN 201010283545A CN 101951401 B CN101951401 B CN 101951401B
- Authority
- CN
- China
- Prior art keywords
- file
- bit stream
- stream data
- sent
- length
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a method for uploading files, which is used for realizing the file uploading function of the WebKit browser of an Android operation system, enabling the WebKit browser to upload files, facilitating the use of users and making the functions of the WebKit browser more complete. The method comprises: extracting code stream data in a file to be transmitted; and transmitting the extracted code stream data from the file to be transmitted in a code steam form to realize the uploading of the file. The invention also discloses a device for implementing the method.
Description
Technical field
The present invention relates to computer and built-in field, particularly a kind of method of upload file in the WebKit browser and device.
Background technology
The literal sense of Android one speech refers to " robot ", simultaneously also is a kind of title of the mobile terminal operating system of increasing income based on Linux (a kind of operating system) platform.This operating system is made up of operating system, middleware, user interface and application software, adopts the framework of software heap layer (Software Stack has another name called the software lamination), mainly is divided into three parts.Bottom by C (a kind of programming language) language development, only provides basic function based on linux kernel work; The intermediate layer comprises function library (Library) and virtual machine (Virtual Machine), by C++ (a kind of programming language) language development.The superiors are various application software, comprise voice procedure, and note program etc. are developed by each company, voluntarily with a part of language of Java (a kind of programming language) language as coding.There is not any patent rights obstacle that in the past hindered mobile re-invent industry in this operating system, be known as first real opening of making for portable terminal and complete operating system.
WebKit is a browser kernel of increasing income, and Android operating system is used its kernel as built-in browser.WebKit kernel efficient stable, compatible good, and the source code clear in structure, be easy to safeguard.
At present, it is very extensive that Android operating system is used, mobile phone especially, and major part has adopted Android operating system.As a kind of browser of mobile terminal, the user may visit Web (World Wide Web) mailbox, all kinds of websites or the like at any time, file is uploaded becomes a kind of essential function, yet, the WebKit browser of Android operating system does not but possess the function that file is uploaded, this is very inconvenient for user's use, influences user experience.
Summary of the invention
The embodiment of the invention provides a kind of method and device of upload file in the WebKit browser, be used to realize the function that the WebKit browser file of Android operating system is uploaded, make the WebKit browser can upload file, user-friendly, make the WebKit browser function more perfect.
A kind of method of upload file in browser kernel WebKit browser may further comprise the steps:
Extract the bit stream data in the file to be sent;
With the bit stream data in the described file to be sent that extracts of code stream form transmission, realize uploading of file.
A kind of device of upload file in browser kernel WebKit browser comprises:
Processing module is used for extracting the bit stream data of file to be sent;
Transceiver module is used for the bit stream data with the described file to be sent that extracts of code stream form transmission, realizes uploading of file.
The embodiment of the invention is by extracting the bit stream data in the file to be sent, and with the bit stream data in the described file to be sent that extracts of code stream form transmission, thereby realized the function of upload file in the WebKit of Android operating system browser, make the more perfect function of WebKit browser, be more conducive to practical application.
Description of drawings
Fig. 1 be in the embodiment of the invention in the WebKit browser primary structure figure of the device of upload file;
Fig. 2 A is the primary structure figure that has acquisition module in the embodiment of the invention in the WebKit browser in the upload file device;
Fig. 2 B be in the embodiment of the invention in the WebKit browser detailed structure view of the device of upload file;
Fig. 3 be in the embodiment of the invention in the WebKit browser the main flow chart of the method for upload file;
Fig. 4 A be when directly obtaining data length information to be sent in the embodiment of the invention in the WebKit browser detail flowchart of the method for upload file;
Fig. 4 B be when being added to the length information of data to be sent in first length variable in the embodiment of the invention in the WebKit browser detail flowchart of the method for upload file;
Fig. 5 adds after the deterministic process detail flowchart of the method for upload file in the WebKit browser in the embodiment of the invention;
Fig. 6 is the main flow chart of file in download in the embodiment of the invention.
Embodiment
The embodiment of the invention is by extracting the bit stream data in the file to be sent, and with the bit stream data in the described file to be sent that extracts of code stream form transmission, thereby realized the function of upload file in the WebKit of Android operating system browser, make the more perfect function of WebKit browser, be more conducive to practical application.
In the embodiment of the invention, the data of code stream type are called bit stream data, for example message; The data of file type are called file.Content in the file also is to be made of bit stream data.File and bit stream data are referred to as data.
Referring to Fig. 1, in the embodiment of the invention in the WebKit browser device of upload file comprise processing module 101 and transceiver module 102.
Referring to Fig. 2 A, can also comprise acquisition module 103 in the described device.
WebFrame::startLoadingResource (Webcore::ResourceHandle*loader, const//be used to submit to form data class data;
WebCore::ResourceRequest﹠request, bool synchronous)/and comprising the ResourceRequest function in the form data class, WebCore calls the ResourceRequest in the form data class.
Form data class data, file promptly to be sent or bit stream data need acquisition module 103 to obtain from ResourceRequest.
Wherein, when acquisition module 103 obtains data to be sent and is transferred to processing module 101 from ResourceRequest after, processing module 101 at first need be obtained is the length information of bit stream data to be sent, and passes to first length variable in the transceiver module 102.Wherein, processing module 101 can be learnt its length information according to file to be sent or bit stream data.For example, processing module 101 can be according to the data of being obtained to be sent its length information that adds up, for example, acquisition module 103 will be given processing module 101 from the file transfer to be sent that ResourceRequest obtains, processing module 101 opens file, whenever extract a character, all the value with self-contained second length variable adds 1, the value of resulting second length variable is exactly the length information of these data to be sent after data extract finishes, for example, the initial value of second length variable is 0 in the processing module 101, processing module 101 whenever extracts a character, and all the value with second length variable adds 1, after bit stream data extraction to be sent is finished, the value of second length variable is exactly the length information of data to be sent, and processing module 101 passes to first length variable with the value of second length variable.Comprise the wherein length information of bit stream data in the file perhaps to be sent, processing module 101 is directly extracted this length information from file to be sent, and it is passed to first length variable.And, the length information that also can comprise file to be sent among the ResourceRequest, acquisition module 103 can at first obtain the length information of this file to be sent from ResourceRequest, distribute a segment length to be not less than the memory headroom of described length information for processing module 101 according to this length information, wherein, the length of this length information is not less than the length of file to be sent.Acquisition module 103 is given processing module 101 with file transfer to be sent more then, and processing module 101 opens file again, extracts bit stream data wherein.If comprise the wherein length information of bit stream data in the file to be sent, then directly it is passed to first length variable, if do not comprise the wherein length information of bit stream data in the file to be sent, then processing module 101 needs when extracting wherein bit stream data its length information to be added in second length variable, treats that bit stream data extracts again the value of second length variable to be passed to first length variable after finishing.Wherein, the length information that first length variable is obtained bit stream data to be sent is in order to make transceiver module 102 distribute a segment length to be not less than the memory headroom of the length information that is received, to deposit file to be sent or bit stream data, wherein, the length of this length information can not be less than the length of data to be sent.Simultaneously, if processing module 101 according to the add up length information of these data of the data of being obtained, then described second length variable can be the pointer type variable, points to bit stream data to be sent.Processing module 101 is extracted bit stream data to be sent according to this second length variable from file to be sent.
Referring to Fig. 2 B, described device can also comprise judge module 104.
Judge module 104 is used to judge the type of data to be sent.It is file or bit stream data that judge module 104 specifically is used for the data type that file (file) the command determination acquisition module 103 according to ResourceRequest obtains.If have the file order among the ResourceRequest, then these data to be sent are file, and processing module 101 opens it, extract bit stream data wherein, described bit stream data is transferred to transceiver module 102, sends, promptly finished the file upload procedure by transceiver module 102.
If file in download, then other end receiving system be responsible for will receive the bit stream data packing, wherein, sign is all arranged on each bit stream data, which bit stream data to form a file with sign by, and have the sign of sign this document, will belong to a bit stream data packing in the file originally for the file of which kind of form, format combination according to original becomes original, has promptly finished the download of file.If to be sent is bit stream data, then directly bit stream data is transferred to receiving system successively, during download also not with the process of packing data.
Introduce the method for upload file below by realization flow.
The embodiment of the invention is presented in the main method of upload file in the WebKit browser.Referring to Fig. 3, the main method flow process is as follows:
At first need from ResourceRequest, to obtain file to be sent.
Step 301: extract the bit stream data in the file to be sent.
Step 302: with the bit stream data in the described file to be sent that extracts of code stream form transmission.
At first need from ResourceRequest, to obtain the length information of file to be sent.
Step 4A01: processing module 101 is according to the length information storage allocation space of this file to be sent.
Wherein the length of this memory headroom is not less than the length information of described file to be sent.
Step 4A02: acquisition module 103 is given processing module 101 with file transfer to be sent.
Wherein, comprise the wherein length information of bit stream data in this file to be sent.
Step 4A03: processing module 101 is opened file to be sent, obtains the length information of bit stream data to be sent from file.
Step 4A04: processing module 101 passes to first length variable with the length information of bit stream data to be sent.
Step 4A05: processing module 101 extracts the bit stream data in the described file to be sent, and is transferred to transceiver module 102.
Step 4A06: transceiver module 102 sends the bit stream data that this extracts with the code stream form.
So just finished the upload procedure of file, its key extracts the bit stream data in the file exactly, sends bit stream data with the code stream form.
Do not comprise the length information of file to be sent in the embodiment of the invention among the ResourseRequest, and do not comprise the length information of bit stream data to be sent in the file to be sent yet.Processing module 101 is added to the length information of bit stream data to be sent in second length variable.Referring to Fig. 4 B, the detailed method flow process is as follows:
Step 4B01: acquisition module 103 is given processing module 101 with file transfer to be sent.In the present embodiment with the code stream form one by one character be transferred to processing module 101.
Step 4B02: processing module 101 whenever extracts a bit stream data to be sent from file to be sent, then the value with second length variable adds 1.
Step 4B03: judge module 104 is judged whether bit stream data to be sent extracts and is finished.When judged result when being, continue step 4B04, otherwise continue step 4B01.
Step 4B04: processing module 101 passes to first length variable with the value of second length variable.
Step 4B05: processing module 101 is transferred to transceiver module 102 with the bit stream data in the described file to be sent.
Step 4B06: transceiver module 102 sends the bit stream data that this extracts with the code stream form.
Add deterministic process in the embodiment of the invention, what the needs judgement was to be sent is file or bit stream data.Referring to Fig. 5, the detailed method flow process is as follows:
Step 501: acquisition module 103 is given processing module 101 with transfer of data to be sent.
Step 502: judge module 104 judges whether the file order is arranged in the information of obtaining.If judged result continues step 503 for being, otherwise continue step 506.
Step 503: judge module 104 determines that data to be sent are file.
Step 504: processing module 101 whenever extracts a bit stream data to be sent from file to be sent, then the value with second length variable adds 1.
Step 505: processing module 101 is judged whether bit stream data to be sent extracts and is finished.When judged result when being, continue step 506, otherwise continue step 504.
Step 506: processing module 101 passes to first length variable with the value of second length variable.
Step 507: processing module 101 is transferred to transceiver module 102 with the bit stream data in the described file to be sent.
Step 508: transceiver module 102 sends bit stream data to be sent with the code stream form.
The embodiment of the invention is the downloading process of file.Referring to Fig. 6, the main method flow process of download is as follows:
Step 601: receiving code flow data.
Step 602:, the packing data in the identical file is reduced into original according to the sign that bit stream data had.Wherein, sign of the form of the sign of original and original etc.
Wherein, described sign can comprise the sign etc. of form of sign, the original of original, so that the form of the bit stream data in the identical file according to original reconfigured, avoids makeing mistakes.
The embodiment of the invention is by extracting the bit stream data in the file to be sent, and with the bit stream data in the described file to be sent that extracts of code stream form transmission, thereby realized the function of upload file in the WebKit of Android operating system browser, make the more perfect function of WebKit browser, be more conducive to practical application.Wherein, processing module 101 can be learnt its length information according to file to be sent or bit stream data.For example, processing module 101 can be according to the data of being obtained to be sent its length information that adds up, and then second length variable can be the pointer type variable, points to bit stream data to be sent.Processing module 101 is extracted bit stream data to be sent according to this second length variable from file to be sent.And pass to first length variable, with the accuracy of the length information that guarantees to be obtained; Comprise the wherein length information of bit stream data in the file perhaps to be sent, processing module 101 is directly extracted this length information from file to be sent, and it is passed to first length variable, and process is fairly simple, quick.Wherein, the length information that first length variable is obtained bit stream data to be sent is in order to make transceiver module 102 distribute a segment length to be not less than the memory headroom of the length information that is received according to this length information, to deposit file to be sent or bit stream data, wherein, the length of this length information can not be less than the length of data to be sent.And, the length information that also can comprise file to be sent among the ResourceRequest, acquisition module 103 can at first obtain the length information of this file to be sent and it is passed to second length variable from ResourceRequest, distribute a segment length to be not less than the memory headroom of described length information for processing module 101 according to this length information, wherein, the length of this length information is not less than the length of file to be sent, makes the work of processing module 101 more reasonable.Simultaneously, if processing module 101 is according to the add up length information of these data of the data of being obtained, the process that can also add judgement, according to whether having file in the data message to be sent order and judge that data to be sent are file or bit stream data, if judged result is for being that data then to be sent are file, extract the bit stream data in the file to be sent and send with the code stream form, when being judged as not, data then to be sent are bit stream data, then directly send described bit stream data.And introduced the file process of downloading, the bit stream data packing with belonging in the bit stream data that receives in the identical file is reduced into original, has just finished the file process of downloading.Wherein, bit stream data can have sign, for example each bit stream data that extracts from file can have the sign of original, the sign etc. that can also have the form of original, so that the bit stream data in the identical file is reduced into original again according to the form of original, avoids makeing mistakes.
Those skilled in the art should understand that embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt complete hardware embodiment, complete software implementation example or in conjunction with the form of the embodiment of software and hardware aspect.And the present invention can adopt the form that goes up the computer program of implementing in one or more computer-usable storage medium (including but not limited to magnetic disc store and optical memory etc.) that wherein include computer usable program code.
The present invention is that reference is described according to the flow chart and/or the block diagram of method, equipment (system) and the computer program of the embodiment of the invention.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or the block diagram and/or square frame and flow chart and/or the block diagram and/or the combination of square frame.Can provide these computer program instructions to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, make the instruction of carrying out by the processor of computer or other programmable data processing device produce to be used for the device of the function that is implemented in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame appointments.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, make the instruction that is stored in this computer-readable memory produce the manufacture that comprises command device, this command device is implemented in the function of appointment in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame.
These computer program instructions also can be loaded on computer or other programmable data processing device, make on computer or other programmable devices and to carry out the sequence of operations step producing computer implemented processing, thereby the instruction of carrying out on computer or other programmable devices is provided for being implemented in the step of the function of appointment in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.
Claims (7)
1. the method for a upload file in browser kernel WebKit browser is characterized in that, may further comprise the steps:
When include file file orders in upload request, determine that data to be sent are file, the content in the file is made of bit stream data;
With File Open to be sent, extract the bit stream data in the file to be sent;
With the bit stream data in the described file to be sent that extracts of code stream form transmission, realize uploading of file.
2. the method for claim 1 is characterized in that, and is described with before the bit stream data in the described file to be sent that extracts of code stream form transmission, also comprises step:
The length of the bit stream data that acquisition extracts for bit stream data distributes the memory headroom that is not less than this length, and is stored bit stream data to be sent in this memory headroom.
3. method as claimed in claim 2 is characterized in that:
The described step that extracts the bit stream data in the file to be sent comprises: from file to be sent one by one character extract bit stream data;
The step of the length of the bit stream data that described acquisition extracts comprises: when character of every extraction length variable is added 1, extracting the length that the value of passing through length variable when finishing obtains bit stream data.
4. method as claimed in claim 2 is characterized in that:
The length information that comprises bit stream data in the file;
The step of the length of the bit stream data that acquisition extracts comprises: the length that obtains the bit stream data that extracts according to the length information of bit stream data in the file to be sent.
5. the device of a upload file in browser kernel WebKit browser is characterized in that, comprising:
Judge module is used for judging according to whether include file file order of upload request whether data to be sent are file, and when comprising the file order in upload request, determines that data to be sent are file, and wherein, the content in the file is made of bit stream data;
Processing module is used for File Open to be sent is extracted the bit stream data in the file to be sent;
Transceiver module is used for the bit stream data with the described file to be sent that extracts of code stream form transmission, realizes uploading of file.
6. device as claimed in claim 5 is characterized in that, described transceiver module is used to the length of the bit stream data that obtains to extract, for bit stream data distributes the memory headroom that is not less than this length, and in this memory headroom storage bit stream data to be sent.
7. device as claimed in claim 5 is characterized in that, described processing module be used for from file to be sent one by one character extract bit stream data; When character of every extraction, second length variable is added 1, extracting the length that the value of passing through second length variable when finishing obtains bit stream data, and the value of second length variable is passed to first length variable; Perhaps
The length information that comprises bit stream data in the file; Described processing module is used for obtaining according to the length information of file bit stream data to be sent the length of the bit stream data that extracts.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010283545 CN101951401B (en) | 2010-09-15 | 2010-09-15 | Method and device for uploading files in WebKit browser |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010283545 CN101951401B (en) | 2010-09-15 | 2010-09-15 | Method and device for uploading files in WebKit browser |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101951401A CN101951401A (en) | 2011-01-19 |
CN101951401B true CN101951401B (en) | 2013-07-24 |
Family
ID=43454759
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201010283545 Expired - Fee Related CN101951401B (en) | 2010-09-15 | 2010-09-15 | Method and device for uploading files in WebKit browser |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101951401B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103685379B (en) * | 2012-09-12 | 2018-04-20 | 腾讯科技(深圳)有限公司 | File uploading method and device based on webkit kernel browsers |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101626376A (en) * | 2009-08-04 | 2010-01-13 | 中国联合网络通信集团有限公司 | Set-top box (STB) file uploading methods, STB file uploading device and STB file uploading system based on internet protocol television (IPTV) |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6938042B2 (en) * | 2002-04-03 | 2005-08-30 | Laplink Software Inc. | Peer-to-peer file sharing |
-
2010
- 2010-09-15 CN CN 201010283545 patent/CN101951401B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101626376A (en) * | 2009-08-04 | 2010-01-13 | 中国联合网络通信集团有限公司 | Set-top box (STB) file uploading methods, STB file uploading device and STB file uploading system based on internet protocol television (IPTV) |
Non-Patent Citations (2)
Title |
---|
基于Webkit 的嵌入式浏览器的研究与实现;赵经纬等;《嵌入式技术》;20090331;第34卷(第3期);第135-138页 * |
赵经纬等.基于Webkit 的嵌入式浏览器的研究与实现.《嵌入式技术》.2009,第34卷(第3期),第135-138页. |
Also Published As
Publication number | Publication date |
---|---|
CN101951401A (en) | 2011-01-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
RU2355044C2 (en) | Sequential multimodal input | |
US10026041B2 (en) | Interoperable machine learning platform | |
JP2007523418A (en) | Data container for user interface data | |
CN101583072B (en) | Middleware product for realizing Mobile Internet and method thereof | |
CN110457256A (en) | Date storage method, device, computer equipment and storage medium | |
US20090199213A1 (en) | Automatic Connections Between Application Components | |
US11240290B2 (en) | Application download method and apparatus, application sending method and apparatus, and system | |
CN101815093A (en) | Method for adapting webpage to mobile terminal and mobile terminal page adaptation device | |
CN1922572A (en) | System and method for building mixed mode execution environment for component applications | |
US9557880B2 (en) | Shared user interface services framework | |
CN103577611A (en) | Data unifying device and data unifying method | |
CN109992284A (en) | Method and device for providing hot update program and electronic equipment | |
CN103324605A (en) | Method, equipment and system for collaborative editing of multiple users | |
US12061859B2 (en) | Markdown data content with action binding | |
KR100763526B1 (en) | Device and method for management of application context | |
CN101778362A (en) | Method, equipment and system for monitoring data of mobile terminal | |
CN101951401B (en) | Method and device for uploading files in WebKit browser | |
CN106535349A (en) | Combined electromagnetic wave data transmission method and system | |
CN101702732A (en) | Document synchronous method and document synchronous system | |
KR101482149B1 (en) | Apparatus for executing application, method thereof and computer recordable medium storing the method | |
CN103294874B (en) | For Web service method for packing and the system of Electromagnetic Simulation computing system FEKO | |
CN100512277C (en) | Method and apparatus for providing content to media devices | |
CN117014528A (en) | Message processing method, electronic device, storage medium, and computer program product | |
CN107294948A (en) | Handle computer implemented method, device and the data handling system of media data | |
CN113779151A (en) | Big data stream transfer method and device, electronic 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 | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20130724 Termination date: 20190915 |
|
CF01 | Termination of patent right due to non-payment of annual fee |