WO2012019388A1 - 文件的下载方法、系统及装置 - Google Patents

文件的下载方法、系统及装置 Download PDF

Info

Publication number
WO2012019388A1
WO2012019388A1 PCT/CN2010/078678 CN2010078678W WO2012019388A1 WO 2012019388 A1 WO2012019388 A1 WO 2012019388A1 CN 2010078678 W CN2010078678 W CN 2010078678W WO 2012019388 A1 WO2012019388 A1 WO 2012019388A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
downloaded
fat
useless data
data
Prior art date
Application number
PCT/CN2010/078678
Other languages
English (en)
French (fr)
Inventor
董鹏
袁景美
胡鹏
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2012019388A1 publication Critical patent/WO2012019388A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Definitions

  • the present invention relates to the field of communications, and in particular to a method, system, and apparatus for downloading a file.
  • BACKGROUND OF THE INVENTION Due to the need to provide multimedia services such as pictures, audio and video, the storage space required for terminal devices is increasing.
  • terminal device manufacturers widely use NG flash memories of 2 Gb or more.
  • the terminal device manufacturer plans a larger file system area when creating the terminal software version, thereby causing the terminal software version capacity to increase.
  • the terminal software version generally connects the terminal device to the computer physically, and transmits the data to the terminal device through a universal serial bus (USB) port.
  • USB universal serial bus
  • the computer directly converts the entire version file into a data packet and transmits the data packet to the terminal device through the USB port. ⁇ Downloading in this way, because the file system area of the terminal software version is too large, the available file capacity built into the file system may be small (for example, some file systems only build some directory structures, there is no such thing.
  • a primary object of the present invention is to provide a method, system and apparatus for downloading a file to solve at least one of the above problems.
  • a method for downloading a file including: obtaining a pending The useless data in the file is deleted; the useless data in the file to be downloaded is removed, and the file to be downloaded is compressed; and the compressed file to be downloaded is downloaded to the memory of the terminal device.
  • the obtaining the useless data in the file to be downloaded includes: determining a file format type of the file to be downloaded; and searching for the useless data in the file to be downloaded.
  • the file to be downloaded is a file allocation table FAT file system file.
  • the file type, the querying the useless data in the file to be downloaded includes: determining a FAT file system type of the file to be downloaded; and a FAT file system type of the file to be downloaded, Determining a FAT table of the downloaded file; acquiring the FAT table, obtaining a starting address of an unoccupied cluster in the user data area of the file to be downloaded; determining from the starting address to an ending address of the file to be downloaded The data stored in the area is the useless data.
  • the obtaining the start address of the unoccupied cluster in the user data area of the file to be downloaded includes: traversing the FAT table, obtaining an entry whose content indicates that the entry is not occupied; and obtaining the entry corresponding to the entry a cluster of the user data area, determining that the cluster is an unoccupied cluster; and obtaining a starting address of the unoccupied cluster.
  • the unnecessary data in the file to be downloaded is removed, and the remaining data of the file to be downloaded is compressed, including: retaining a basic structure of the FAT file system of the file to be downloaded, and reducing the Useless data, compressing the space occupied by the file to be downloaded.
  • a file downloading system including: a host, configured to remove useless data in a file to be downloaded, compress a file to be downloaded after removing the useless data, and compress the downloaded file to be downloaded
  • the file is downloaded to the terminal device; the terminal device is connected to the host through the communication interface, and is configured to receive the compressed file to be downloaded transmitted by the host, and write the received file to be downloaded into the memory of the terminal device.
  • the host includes: an obtaining module, configured to acquire useless data in the file to be downloaded; a compression module, configured to remove the useless data in the file to be downloaded, and compress the file to be downloaded; And a module, configured to send the to-be-downloaded file compressed by the compression module to the terminal device.
  • the obtaining module includes: a determining module, configured to determine a file format type of the file to be downloaded; and a querying module, configured to query, according to the file format type of the file to be downloaded, the file in the file to be downloaded Said useless data.
  • the to-be-downloaded file is a FAT file system file;
  • the query module includes: a first determining sub-module, configured to determine a FAT file system type of the file to be downloaded; The FAT file system type of the file to be downloaded, the FAT table of the file to be downloaded is read, and the obtaining sub-module is configured to obtain, according to the FAT table, a starting address of an unoccupied cluster in the user data area of the file to be downloaded.
  • a host including: an acquiring module, configured to acquire useless data in a file to be downloaded; a compression module, configured to remove the useless data in the file to be downloaded, and compress the to-be-downloaded a sending module, configured to send the file to be downloaded compressed by the compression module to the terminal device.
  • the unnecessary data in the file to be downloaded is removed, and then the file to be downloaded is compressed and transmitted to the terminal device, thereby shortening the time of file transmission and writing the data to the terminal device.
  • the time reduces the unnecessary data writing operation, thereby improving the efficiency of file transfer, saving the cost of production and after-sales service, and prolonging the memory life of the terminal device.
  • FIG. 1 is a schematic diagram of a download system of a file according to an embodiment of the present invention
  • FIG. 2 is a schematic structural view of a host according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a host according to a preferred embodiment of the present invention.
  • 4 is a schematic structural diagram of a query module of a host according to another preferred embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for downloading a file according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a FAT file system
  • Figure 7 is a flow chart showing a method of downloading a file in a preferred embodiment of the present invention
  • FIG. 8 is a schematic diagram of the correspondence between the entries in the FAT table and the cluster numbers of the user data area.
  • the downloading system includes: a host 2 and a terminal device 4.
  • the host 2 is configured to remove unnecessary data in the file to be downloaded, compress the file to be downloaded after removing the useless data, and download the compressed file to be downloaded to the terminal device 4; the terminal device 4, through the communication interface (for example, The USB interface is connected to the host 2, and is configured to receive the compressed file to be downloaded transmitted by the host 2, and write the received data into the memory.
  • the USB interface is connected to the host 2, and is configured to receive the compressed file to be downloaded transmitted by the host 2, and write the received data into the memory.
  • the host 2 can determine the file format of the file to be downloaded, parse the file to be downloaded according to the file format of the file to be downloaded, and obtain useless data in the file to be downloaded, for example, data used to fill the file system capacity structure, and then The part of the useless data in the original file to be downloaded is removed, and the downloaded file is effectively compressed, the new file to be downloaded is reconstructed, and the reconstructed file to be downloaded is sent to the terminal device 4.
  • a File Allocation Table (FAT) file system file is used as an example.
  • Host 2 can read the FAT table for disk file indexing and positioning in the FAT file system, and obtain the table content indication from the FAT table.
  • FAT File Allocation Table
  • FIG. 2 is a schematic structural diagram of a host 2 according to an embodiment of the present invention.
  • the host 2 may include: an obtaining module 20, a compressing module 22, and a sending module 24.
  • the obtaining module 20 is configured to obtain useless data in the file to be downloaded, and the compressing module 22 is configured to remove the file to be downloaded.
  • the useless data, the file to be downloaded is compressed, and the sending module 24 is configured to send the file to be downloaded compressed by the compression module 22 to the terminal device 4.
  • the obtaining module 20 can obtain the useless data in the file to be downloaded by analyzing the file format of the file to be downloaded.
  • the obtaining module 20 may include: a determining module 200 and a querying module 202.
  • the determining module 200 is configured to determine a file format type of the file to be downloaded, for example, determining that the file to be downloaded is a FAT file system file, an NTFS file system file, or a file of another format type; the query module 202 is configured to download the file.
  • the file format type is used to query the useless data in the file to be downloaded.
  • the useless data includes useless data filling the file system capacity structure, and the query module 202 can query according to the structure of the FAT file system file.
  • the file to be downloaded is a FAT file system file as an example.
  • FIG. 4 is a schematic structural diagram of the query module 202 of the host 2 in the preferred embodiment, as shown in FIG. 4, in the preferred implementation.
  • the query module 202 may include: a first determining submodule 2020, configured to determine a FAT file system type of the file to be downloaded, for example, determining that the file to be downloaded is a FAT12 type, a FAT 16 type, or a FAT32 type;
  • the module 2022 is configured to read the FAT file of the file to be downloaded according to the FAT file system type of the file to be downloaded.
  • the address of the sector where the FAT table is located and the size of the FAT table may be different, according to the first Determining the FAT file system type determined by the submodule 2020, the reading submodule 2022 may determine the address of the sector in which the FAT table is located and the size of the FAT table, thereby reading the FAT table of the file to be downloaded; and obtaining the submodule 2024 for using the FAT according to the FAT
  • the table obtains the starting address of the unoccupied cluster in the user data area of the file to be downloaded.
  • the FAT table records the situation that the user data area has occupied the cluster.
  • the table entry that is, the table entry value has a certain correspondence with the family name of the data area
  • the obtaining submodule 2024 can obtain the entry whose content indicates that the cluster does not occupy the cluster (for example, the value is 0) by traversing the FAT table. Therefore, the cluster corresponding to the entry is determined to be an unoccupied cluster, and then the starting address of the cluster is obtained; the second determining submodule 2026 is configured to determine the starting address from the starting address to the pending address.
  • the data stored in the area of the end address of the download file is useless data.
  • FIG. 5 is a flowchart of a method for downloading a file according to an embodiment of the present invention. As shown in FIG.
  • Step S 502 Host 2 acquires useless data in a file to be downloaded; For example, the host 2 can analyze the file format to be downloaded, analyze the downloaded file, and query the useless data in the file to be downloaded.
  • Step S504 the host 2 removes the useless data in the file to be downloaded, and compresses the file to be downloaded.
  • the host 2 can retain the basic structure of the file to be downloaded according to the file format type of the file to be downloaded, and reduce the useless data therein. Effectively compress the space occupied by the downloaded file and rebuild the new file to be downloaded.
  • step S506 the host 2 downloads the compressed file to be downloaded into the memory of the terminal device 4.
  • the host 2 can erase the memory of the terminal device 4 and then write the compressed file to be downloaded into the memory of the terminal device 4.
  • the host 2 compresses the downloaded file before downloading the file to the terminal device 4, and reduces the useless data therein, thereby reducing the time of data transmission and improving the efficiency of data transmission.
  • the unnecessary data writing operation to the memory of the terminal device 4 is avoided, and the life of the memory of the terminal device 4 is prolonged.
  • the technical solution provided by the embodiment of the present invention is described below by taking the structure of the FAT file system shown in FIG. 6 as an example. As shown in FIG.
  • the FAT file system structure includes a Dos Boot Record (DBR) 601, a FAT area 602, a directory 603, and a user data area 604.
  • DBR Dos Boot Record
  • the DBR area and the FAT area are accessed in units of sectors; in the FAT12 and FAT16 systems, the directory is accessed by sectors, and in the FAT32 system, the directory is accessed in units of clusters; the user data area 604 is accessed in units of clusters.
  • the DBR area 601 includes a DBR 6011 and a remaining reserved sector 6012.
  • the DBR 6011 is located in the 0th sector of the FAT file system, and the remaining reserved sector 6012 has a space size of 0.
  • Boot information for booting disk operations is stored in the DBR 6011. Usually each sector is 512 bytes in size.
  • the FAT area includes FAT1 6021 and FAT2 6022, usually FAT2 6022 is FAT1 6011 Copy copy, FAT table is a chain structure caused by disk file indexing and positioning.
  • the root directory 603 stores information such as the root directory name on the disk.
  • the user data area 604 stores the subdirectory name and the specific file data, and the storage manner is in units of clusters, and usually the cluster is an integer multiple of the sector.
  • FIG. 7 is a flowchart of a method for downloading a FAT file system file according to an embodiment of the present invention. As shown in FIG.
  • Step 701 Terminal device 4 is connected to the USB port of the host 2, and establishes a physical connection with the host 2;
  • the host 2 may read the first 512 bytes of the file to be downloaded (ie, the 0th sector of the FAT file system), that is, the boot record DBR 6011 of the FAT file system, and the relative offset DBR 6011 0th byte content.
  • the 2-byte content starting from offset 0x01FE represents the DBR valid end flag. If the mega-instruction is ⁇ or 0 ⁇ 9, and the valid end flag of the DBR is 0 ⁇ 55 ⁇ , if this condition is met, the terminal file is a FAT file system file.
  • Step 704 The host 2 determines the FAT file system type; wherein the DBR 6011 includes a data structure - the basic input parameter area (Bios Parameter
  • Block which records the basic information of the FAT file system structure, for example, the total number of FAT file system sectors, the FAT table size and number, and the reserved sector size. With this information, the FAT table can be calculated.
  • the sector address, the total number of user data area clusters, according to the size of the user data area cluster, the type of the file system can be determined. If the number of file clusters is less than 4085, the file is of type FAT12; if the number of file clusters is greater than or equal to 4085 and less than 65525, the file is of type FAT16; if the number of file clusters is greater than or equal to 65525, the file is For the FAT32 type.
  • Step 705 Acquire FAT1 6021 data according to the sector address and FAT table size of the FAT1 6021, and read the data in the FAT table into the memory;
  • Step 706 Obtain the user data area of the FAT file system file from the unoccupied cluster Starting address
  • the FAT table records the situation that the user area has occupied the cluster, and the table entry item, that is, the table item value has a corresponding relationship with the cluster number of the user data area, and FIG. 8 is the correspondence between the table item in the FAT table and the cluster number of the user data area.
  • the content of the entry corresponding to the file end cluster is OxFFFF.
  • the content of the entry corresponding to the file end cluster is OxOFFF.
  • the host 2 searches the last file ending cluster in the FAT table by traversing the FAT table, that is, searches for the last file chain header of the FAT table management file, and the data area cluster number corresponding to the entry index is the last occupied in the user data area.
  • the cluster so that the FAT file system user data area does not occupy the starting address of the cluster.
  • Step 707 Compress the FAT file system file to be downloaded; the host 2 determines that the data stored in the user data area of the FAT file system file does not occupy the cluster starting address to the end of the FAT file system is useless data.
  • the host 2 retains the basic structure of the FAT file system, that is, retains useful data in the DBR area, the FAT area, the ⁇ directory, and the user data area, reduces unnecessary data in the user data area, and effectively uses the original FAT file data area occupied space. Compress, shrink, and FAT file system volume, rebuild the file to be downloaded.
  • the above embodiment uses the FAT file system file as an example for description, it is not limited thereto. For files of other format types, as long as the host 2 can determine the useless data of the file by analyzing the file format type, Then, the file can be downloaded to the terminal device 4 in a similar manner to the FAT file system file.
  • the file to be downloaded to the terminal device is compressed, the useless data in the file is removed, and the file transfer and the file write storage are shortened.
  • the time of the device increases the file download speed, saves production and after-sales service costs, and prolongs the life of the memory.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

文件的下载方法、 系统 ^置 技术领域 本发明涉及通信领域, 具体而言, 涉及一种文件的下载方法、 系统及装 置。 背景技术 由于需要提供图片、 音视频等多媒体业务, 终端设备所需的存储空间越 来越大, 目前, 终端设备制造商广泛釆用 2Gb甚至更大容量的 NandFlash存 储器。 在实际应用中, 为了给终端设备预留充足的系统文件及用户文件存储空 间, 终端设备制造商在制作终端软件版本时, 会规划较大的文件系统区域, 从而导致终端软件版本容量增大。 而在研发、 生产和售后等各环节中, 在对 终端软件版本进行下载升级时, 由于终端软件版本容量的增大, 导致下载终 端软件版本的时间增加, 影响终端设备制造商的成本、 时间和效益。 终端软件版本一般是将终端设备与计算机进行物理连接, 通过通用串行 总线 ( USB ) 端口将数据传输到终端设备内。 目前, 在将终端软件版本下载 到终端设备时,计算机直接将整个版本文件打成数据包通过 USB端口传输到 终端设备。釆用这种方式进行下载, 由于终端软件版本的文件系统区域过大, 内置在文件系统中的可用文件容量可能很少 (例如, 有的文件系统仅仅只是 构建了一些目录结构, 并无才艮目录和子目录文件), 传输有用文件时, 同时也 传输了很多用于填充文件系统容量的无用数据, 降低了传输效率, 增加了终 端软件版本下载的时间。 另外, 文件系统中的无用数据也写入了终端设备的 存储器中, 对存储器进行了不必要的额外操作, 缩短了终端设备的存储器的 使用寿命。 发明内容 本发明的主要目的在于提供一种文件的下载方法、 系统及装置, 以至少 解决上述的问题之一。 根据本发明的一个方面, 提供了一种文件的下载方法, 包括: 获取待下 载文件中的无用数据; 去除待下载文件中的该无用数据, 压缩待下载文件; 将压缩后的待下载文件下载到终端设备的存储器中。 进一步地, 获取待下载文件中的无用数据包括: 判断所述待下载文件的 文件格式类型; 居所述文件类型, 查询所述待下载文件中的所述无用数据。 进一步地, 所述待下载文件为文件分配表 FAT文件系统文件。 进一步地, 居所述文件类型, 查询所述待下载文件中的所述无用数据 包括:确定所述待下载文件的 FAT文件系统类型; 居所述待下载文件的 FAT 文件系统类型, 读取所述待下载文件的 FAT表; 居所述 FAT表, 获取所述 待下载文件的用户数据区中未占用簇的起始地址; 确定从所述起始地址至所 述待下载文件的结束地址的区域存储的数据为所述无用数据。 进一步地, 获取所述待下载文件的用户数据区中未占用簇的起始地址包 括: 遍历所述 FAT表, 获取其表项内容指示未被占用的表项; 获取与所述表 项对应的所述用户数据区的簇, 确定所述簇为未占用簇; 获取所述未占用簇 的起始地址。 进一步地, 去除所述待下载文件中的所述无用数据, 压缩所述待下载文 件的剩余数据包括: 保留所述待下载文件的 FAT文件系统基本结构, 裁减所 述待下载文件中的所述无用数据, 将所述待下载文件占用的空间进行压缩。 根据本发明的另一方面, 提供了一种文件的下载系统, 包括: 主机, 用 于去除待下载文件中的无用数据, 压缩去除该无用数据后的待下载文件, 并 将压缩后的待下载文件下载到终端设备; 终端设备, 通过通信接口与主机连 接, 用于接收主机传输的压缩后的待下载文件, 并将接收到的待下载文件写 入终端设备的存储器中。 进一步地, 所述主机包括: 获取模块, 用于获取所述待下载文件中的无 用数据; 压缩模块, 用于去除所述待下载文件中的所述无用数据, 压缩所述 待下载文件; 发送模块, 用于将经所述压缩模块压缩的所述待下载文件发送 给所述终端设备。 进一步地, 所述获取模块包括: 判断模块, 用于判断所述待下载文件的 文件格式类型; 查询模块, 用于根据所述待下载文件的文件格式类型, 查询 所述待下载文件中的所述无用数据。 进一步地, 所述待下载文件为 FAT文件系统文件; 所述查询模块包括: 第一确定子模块, 用于确定所述待下载文件的 FAT文件系统类型; 读取子模 块, 用于 居所述待下载文件的 FAT文件系统类型, 读取所述待下载文件的 FAT表; 获取子模块, 用于根据所述 FAT表, 获取所述待下载文件的用户数 据区中未占用簇的起始地址; 第二确定子模块, 用于才艮据所述起始地址, 确 定从所述起始地址至所述待下载文件的结束地址的区域存储的数据为所述无 用数据。 才艮据本发明的再一个方面, 提供了一种主机, 包括: 获取模块, 用于获 取待下载文件中的无用数据; 压缩模块, 用于去除待下载文件中的该无用数 据, 压缩待下载文件; 发送模块, 用于将经压缩模块压缩的待下载文件发送 给终端设备。 通过本发明, 主机在将待下载文件下载给终端设备时, 去除待下载文件 中的无用数据, 然后压缩待下载文件, 再传输给终端设备, 从而可以缩短文 件传输的时间以及数据写入终端设备的时间, 减少了不必要的数据的写入操 作, 进而提高了文件传输的效率, 节约了生产及售后服务的成本, 延长了终 端设备的存储器的寿命。 附图说明 此处所说明的附图用来提供对本发明的进一步理解, 构成本申请的一部 分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的 不当限定。 在附图中: 图 1是^ f艮据本发明实施例的文件的下载系统的示意图; 图 2是根据本发明实施例的主机的结构示意图; 图 3是根据本发明优选实施例的主机的结构示意图; 图 4是根据本发明另一优选实施例的主机的查询模块的结构示意图; 图 5是 居本发明实施例的文件的下载方法的流程图; 图 6是 FAT文件系统的结构示意图; 图 7是 居本发明优选实施例的文件的下载方法的流程图; 图 8是 FAT表中表项与用户数据区簇号的对应关系示意图。 具体实施方式 下文中将参考附图并结合实施例来详细说明本发明。 需要说明的是, 在 不冲突的情况下, 本申请中的实施例及实施例中的特征可以相互组合。 图 1是 居本发明实施例的文件的下载系统的结构示意图, 该下载系统 包括: 主机 2和终端设备 4。 其中, 主机 2 , 用于去除待下载文件中的无用 数据, 压缩去除无用数据后的待下载文件, 并将压缩后的待下载文件下载到 终端设备 4; 终端设备 4 , 通过通信接口 (例如, USB接口) 与主机 2连接, 用于接收主机 2传输的压缩后的上述待下载文件, 并将接收到的数据写入其 存储器中。 在实际应用中, 主机 2可以判断待下载文件的文件格式, 根据待下载文 件的文件格式, 解析待下载文件, 获取待下载文件中无用数据, 例如, 用于 填充文件系统容量结构的数据, 然后去除原始待下载文件中的该部分无用数 据, 再对待下载文件进行有效压缩, 重新构建新的待下载文件, 将重新构建 的待下载文件发送给终端设备 4。 例如, 以文件分配表 ( File Allocation Table, 简称为 FAT )文件系统文件 为例, 主机 2可以读取 FAT文件系统中用于磁盘文件索引和定位的 FAT表, 从 FAT表中获取表项内容指示未被占用的表项, 从而确定与该表项对应的用 户数据区的簇未被占用, 进而确定从该簇的起始地址至 FAT文件系统尾的区 域存储的数据为无用数据, 将该部分无用数据去除, 在保留 FAT文件系统基 本结构的基础上, 将原始 FAT文件数据区占用的空间进行有效的压缩, 从而 缩小 FAT文件系统的体积, 重新构建新的待下载文件, 并将该待下载文件发 送给终端设备 4。 通过本发明实施例的上述文件的下载系统, 主机 2可以在将文件下载至 终端设备 4前, 去除该文件中的无用数据, 并对文件进行有效压缩, 从而可 以提高文件的传输效率, 减少对终端设备 4的存储器的不必要的数据写入操 作, 延长了存储器的寿命, 节约了生产和售后服务的成本。 图 2是根据本发明实施例的主机 2的结构示意图, 如图 2所示, 主机 2 可以包括: 获取模块 20、 压缩模块 22和发送模块 24。 其中, 获取模块 20 , 用于获取待下载文件中的无用数据; 压缩模块 22 , 用于去除待下载文件中的 无用数据, 压缩待下载文件; 发送模块 24 , 用于将经压缩模块 22压缩的待 下载文件发送给终端设备 4。 优选地, 获取模块 20 可以通过分析待下载文件的文件格式获取待下载 文件中的无用数据, 图 3为才艮据本发明优选实施例的主机 2的结构示意图, 如图 3所示, 在该优选实施例中, 获取模块 20可以包括: 判断模块 200和 查询模块 202。 其中, 判断模块 200用于判断待下载文件的文件格式类型, 例如, 判断待下载文件是 FAT文件系统文件、 NTFS文件系统文件或其它格 式类型的文件; 查询模块 202 , 用于 居待下载文件的文件格式类型, 查询 待下载文件中的无用数据, 例如, 对于 FAT文件系统文件, 其无用数据包括 填充文件系统容量结构的无用数据, 查询模块 202才艮据 FAT文件系统文件的 结构, 可以查询到其中的无用数据。 在本发明另一优选实施例中, 以待下载文件为 FAT文件系统文件为例, 图 4为该优选实施例中主机 2的查询模块 202的结构示意图, 如图 4所示, 在该优选实施例中, 查询模块 202可以包括: 第一确定子模块 2020 , 用于确 定待下载文件的 FAT文件系统类型, 例如, 确定待下载文件是 FAT12类型、 FAT 16类型或是 FAT32类型等; 读取子模块 2022 , 用于 艮据待下载文件的 FAT文件系统类型,读取待下载文件的 FAT表,对于不同 FAT文件系统类型, FAT表所在扇区的地址和 FAT表的大小可能不同,根据第一确定子模块 2020 确定的 FAT文件系统类型, 读取子模块 2022可以确定 FAT表所在扇区的地 址和 FAT表大小, 从而读取待下载文件的 FAT表; 获取子模块 2024 , 用于 根据该 FAT表, 获取待下载文件的用户数据区中未占用簇的起始地址, 在实 际应用中, FAT表中记载了用户数据区已占用簇的情况, 其表记录项即表项 值与数据区的族号存在一定的对应关系, 获取子模块 2024通过遍历 FAT表, 可以获取其表项内容指示不占用簇 (例如, 值为 0 ) 的表项, 从而确定与该 表项对应的簇为未占用簇, 进而获取该簇的起始地址; 第二确定子模块 2026 用于才艮据未占用簇的起始地址, 确定从该起始地址至待下载文件的结束地址 的区域存储的数据为无用数据。 如果待下载文件为 FAT文件系统文件, 则压缩模块 22在压缩待下载文 件时, 保留其 FAT文件系统的基本结构, 裁减用户数据区中的无用数据, 将 原始待下载文件在用户数据区占用的空间进行有效的压缩, 缩小 FAT文件系 统的体积, 重新构建新的待下载文件。 从而可以实现 FAT文件系统文件的有 效压缩, 减少 FAT文件系统文件下载传输的时间。 图 5是^ f艮据本发明实施例的文件的下载方法的流程图, 如图 5所示, 该 方法主要包括以下步 4聚: 步骤 S 502 , 主机 2获取待下载文件中的无用数据; 例如, 主机 2可以通过判断待下载文件的文件格式类型, 对待下载文件 进行分析, 查询待下载文件中的无用数据。 步骤 S504, 主机 2去除待下载文件中的无用数据, 压缩该待下载文件; 例如, 主机 2可以根据待下载文件的文件格式类型, 保留该待下载文件 的基本结构, 裁减其中的无用数据, 再对待下载文件占用的空间进行有效的 压缩, 重新构建新的待下载文件。 步骤 S506,主机 2将压缩后的待下载文件下载到终端设备 4的存储器中。 例如, 主机 2可以擦除终端设备 4的存储器, 然后将压缩后的待下载文 件写入到终端设备 4的存储器中。 通过本发明实施例提供的上述方法, 主机 2在将文件下载到终端设备 4 之前, 先对待下载的文件进行压缩, 裁减其中的无用数据, 从而减少了数据 传输的时间, 提高了数据传输的效率, 避免了对终端设备 4的存储器进行不 必要数据的写入操作, 延长了终端设备 4的存储器的寿命。 下面以图 6所示的 FAT文件系统结构为例, 对本发明实施例提供的技术 方案进行说明。 如图 6所示, FAT文件系统结构包括引导记录区 ( Dos Boot Record, 简 称为 DBR ) 601、 FAT区 602、 才艮目录 603和用户数据区 604。 其中, DBR 区和 FAT区以扇区为单位访问; 在 FAT12和 FAT16系统中才艮目录以扇区访 问, 在 FAT32系统中才艮目录以簇为单位访问; 用户数据区 604以簇为单位访 问。
DBR区 601中包括 DBR 6011和剩余保留扇区 6012 , 通常 DBR 6011位 于 FAT文件系统中的第 0扇区,剩余保留扇区 6012空间大小为 0。 DBR 6011 中存储了磁盘操作启动的引导信息。 通常每个扇区大小为 512字节。
FAT区包括 FAT1 6021和 FAT2 6022, 通常 FAT2 6022是 FAT1 6011的 复制拷贝, FAT表为用于磁盘文件索引和定位引起的一种链式结构。 根目录 603存储了磁盘中的根目录名称等信息。 用户数据区 604存储了子目录名称和具体的文件数据, 其存储方式以簇 为单位, 通常簇是扇区的整数倍。 图 7是才艮据本发明实施例的 FAT文件系统文件的下载方法的流程图, 如 图 7所示, FAT文件系统文件从主机 2下载到终端设备 4主要包括以下步骤: 步骤 701: 终端设备 4连接到主机 2的 USB端口上, 与主机 2建立物理 连接; 步骤 702: 主机 2实时侦测 USB端口上终端设备 4的接入, 控制终端设 备 4进入下载模式,并将 Flash驱动读入到终端设备 4的 RAM中,运行 Flash 驱动程序, 与驱动建立数据连接; 步骤 703 : 主机 2解析待下载的终端文件是否满足 FAT文件系统类型, 如果满足, 则执行步骤 704; 否则, 执行步骤 708。 具体地, 主机 2可以为读取待下载的文件的前 512字节(即 FAT文件系 统的第 0扇区),即 FAT文件系统的引导记录 DBR 6011 ,相对偏移 DBR 6011 第 0字节内容代表跳转指令, 相对偏移 0x01FE开始的 2字节内容代表 DBR 有效结束标志。 如果兆转指令为 ΟχΕΒ或 0χΕ9, 并且 DBR的有效结束标志 为 0χ55ΑΑ, 满足此条件, 则说明该终端文件是 FAT文件系统文件。 步骤 704: 主机 2确定 FAT文件系统类型; 其中, DBR 6011中包含一个数据结构 -基本输入参数区(Bios Parameter
Block , 简称为 ΒΡΒ) , 其记录了 FAT文件系统结构基本信息, 例如, FAT文 件系统扇区总数、 FAT表大小和个数以及保留扇区大小等信息, 通过这些信 息, 可以计算出 FAT表所在扇区地址, 用户数据区簇的总数, 根据用户数据 区簇的大小, 可以确定文件系统的类型。 如果文件簇的个数小于 4085 , 则该文件为 FAT12类型; 如果文件簇的个 数大于等于 4085 , 并且小于 65525 , 则该文件为 FAT16类型; 如果文件簇的 个数大于等于 65525 , 则该文件为 FAT32类型。 步骤 705 :才艮据 FAT1 6021所在扇区地址和 FAT表大小,获取 FAT1 6021 数据, 将 FAT表中数据读入到内存中; 步骤 706: 获取 FAT文件系统文件的用户数据区未占用簇的起始地址;
FAT表中记录了用户区已占用簇的情况, 其表记录项即表项值与用户数 据区的簇号存在对应关系, 图 8为 FAT表中表项与用户数据区的簇号的对应 关系的示意图, 其中, FAT表的表项 801和用户数据区的簇号 802之间的映 射关系为: 用户数据区的簇号 = FAT表的表项 -2。 若用户数据区的簇已被占 用, 则相应的表项内容不为 0。 对于 FAT16、 FAT32类型文件系统, 文件结 束簇所对应的表项内容为 OxFFFF; 对于 FAT12类型文件系统, 文件结束簇 所对应的表项内容为 OxOFFF。 主机 2通过遍历 FAT表, 搜索 FAT表中最后一个文件结束簇, 即搜索 FAT表管理文件的最后一个文件链表尾, 其表项索引对应的数据区簇号即为 用户数据区中最后一个被占用的簇, 从而可以得知 FAT文件系统用户数据区 未占用簇的起始地址。 步骤 707: 压缩待下载的 FAT文件系统文件; 主机 2确定 FAT文件系统文件的用户数据区未占用簇的起始地址至 FAT 文件系统尾的区域存储的数据为无用数据。 则主机 2保留 FAT文件系统基本 结构, 即保留 DBR 区、 FAT 区、 才艮目录和用户数据区中的有用数据, 裁减 用户数据区中的无用数据,将原始 FAT文件数据区占用空间进行有效的压缩, 缩 '〗、 FAT文件系统体积, 重新构建待下载的文件。 步骤 708: 主机 2擦除终端设备 4的 Flash, 将待下载文件写入终端设备 Flash中; 步 4聚 709: 重启终端设备, 确定下载成功。 需要说明的是, 虽然上述实施例以 FAT文件系统文件为例进行说明, 但 并不限于此, 对于其它格式类型的文件, 只要主机 2可以通过分析其文件格 式类型确定出该文件的无用数据, 则可以釆用与 FAT文件系统文件相似的方 法下载文件至终端设备 4。
从以上的描述中, 在本发明实施例中, 通过对待下载到终端设备的文件 进行了压缩, 去除该文件中的无用数据, 缩短了文件传输以及文件写入存储 器的时间, 提高了文件下载速度, 节约了生产、 售后服务成本, 同时延长了 存储器的寿命。 显然, 本领域的技术人员应该明白, 上述的本发明的各模块或各步骤可 以用通用的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布 在多个计算装置所组成的网络上, 可选地, 它们可以用计算装置可执行的程 序代码来实现, 从而, 可以将它们存储在存储装置中由计算装置来执行, 并 且在某些情况下, 可以以不同于此处的顺序执行所示出或描述的步骤, 或者 将它们分别制作成各个集成电路模块, 或者将它们中的多个模块或步骤制作 成单个集成电路模块来实现。 这样, 本发明不限制于任何特定的硬件和软件 结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本 领域的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的 ^"神和 原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的保护 范围之内。

Claims

权 利 要 求 书 一种文件的下载方法, 其特征在于, 包括:
获取待下载文件中的无用数据;
去除所述待下载文件中的所述无用数据, 压缩所述待下载文件; 将压缩后的所述待下载文件下载到终端设备的存储器中。 根据权利要求 1所述的方法, 其特征在于, 获取待下载文件中的无用数 据包括:
判断所述待下载文件的文件格式类型;
才艮据所述文件类型, 查询所述待下载文件中的所述无用数据。 才艮据权利要求 2所述的方法, 其特征在于, 所述待下载文件为文件分配 表 FAT文件系统文件。 才艮据权利要求 3所述的方法, 其特征在于, 居所述文件类型, 查询所 述待下载文件中的所述无用数据包括:
确定所述待下载文件的 FAT文件系统类型;
才艮据所述待下载文件的 FAT文件系统类型, 读取所述待下载文件的 FAT表;
才艮据所述 FAT表, 获取所述待下载文件的用户数据区中未占用簇的 起始地址;
确定从所述起始地址至所述待下载文件的结束地址的区域存储的数 据为所述无用数据。 才艮据权利要求 4所述的方法, 其特征在于, 获取所述待下载文件的用户 数据区中未占用簇的起始地址包括:
遍历所述 FAT表, 获取其表项内容指示未被占用的表项; 获取与所述表项对应的所述用户数据区的簇, 确定所述簇为未占用 簇;
获取所述未占用簇的起始地址。 才艮据权利要求 3所述的方法, 其特征在于, 去除所述待下载文件中的所 述无用数据, 压缩所述待下载文件的剩余数据包括:
保留所述待下载文件的 FAT文件系统基本结构, 裁减所述待下载文 件中的所述无用数据, 将所述待下载文件占用的空间进行压缩。 一种文件的下载系统, 其特征在于, 包括:
主机, 用于去除待下载文件中的无用数据, 压缩去除所述无用数据 后的待下载文件, 并将压缩后的所述待下载文件下载到终端设备;
所述终端设备, 通过通信接口与所述主机连接, 用于接收所述主机 传输的压缩后的所述待下载文件, 并将接收到的所述待下载文件写入所 述终端设备的存储器中。 才艮据权利要求 7所述的系统, 其特征在于, 所述主机包括:
获取模块, 用于获取所述待下载文件中的无用数据; 压缩模块, 用于去除所述待下载文件中的所述无用数据, 压缩所述 待下载文件;
发送模块, 用于将经所述压缩模块压缩的所述待下载文件发送给所 述终端设备。 根据权利要求 8所述的系统, 其特征在于, 所述获取模块包括:
判断模块, 用于判断所述待下载文件的文件格式类型;
查询模块, 用于根据所述待下载文件的文件格式类型, 查询所述待 下载文件中的所述无用数据。 才艮据权利要求 9所述的系统, 其特征在于, 所述待下载文件为 FAT文件 系统文件; 所述查询模块包括:
第一确定子模块, 用于确定所述待下载文件的 FAT文件系统类型; 读取子模块, 用于 居所述待下载文件的 FAT文件系统类型, 读取 所述待下载文件的 FAT表;
获取子模块, 用于根据所述 FAT表, 获取所述待下载文件的用户数 据区中未占用簇的起始地址; 第二确定子模块, 用于 居所述起始地址, 确定从所述起始地址至 所述待下载文件的结束地址的区域存储的数据为所述无用数据。
11. 一种主机, 其特征在于, 包括:
获取模块, 用于获取待下载文件中的无用数据; 压缩模块, 用于去除所述待下载文件中的所述无用数据, 压缩所述 待下载文件;
发送模块, 用于将经所述压缩模块压缩的所述待下载文件发送给终 端设备。
PCT/CN2010/078678 2010-08-12 2010-11-12 文件的下载方法、系统及装置 WO2012019388A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010253704.1A CN101917474B (zh) 2010-08-12 2010-08-12 文件的下载方法、系统及装置
CN201010253704.1 2010-08-12

Publications (1)

Publication Number Publication Date
WO2012019388A1 true WO2012019388A1 (zh) 2012-02-16

Family

ID=43324856

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/078678 WO2012019388A1 (zh) 2010-08-12 2010-11-12 文件的下载方法、系统及装置

Country Status (2)

Country Link
CN (1) CN101917474B (zh)
WO (1) WO2012019388A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105224386B (zh) * 2015-09-06 2018-11-23 浪潮(北京)电子信息产业有限公司 一种提高虚拟机模板传输效率的方法及装置
CN105224698A (zh) * 2015-11-17 2016-01-06 盛趣信息技术(上海)有限公司 图片存储系统及方法
CN107168962A (zh) * 2016-03-07 2017-09-15 深圳市中兴微电子技术有限公司 一种文件处理方法、客户端及用户设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1255014A (zh) * 1998-10-09 2000-05-31 松下电器产业株式会社 从mpeg-2比特流中去除填充比特的可编程滤波器
US6427143B1 (en) * 1998-04-10 2002-07-30 Computer Associates Think, Inc. Method for loading rows into a database table while enforcing constraints
CN1393849A (zh) * 2001-07-04 2003-01-29 英业达集团(南京)电子技术有限公司 电子装置上语音播放的方法
CN101661415A (zh) * 2009-09-21 2010-03-03 中兴通讯股份有限公司 一种保存快照数据的方法及存储快照系统
CN101876948A (zh) * 2009-04-30 2010-11-03 国际商业机器公司 在本地存储器中支持数据的不连续访问的方法和设备

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101056209A (zh) * 2007-05-25 2007-10-17 杭州华三通信技术有限公司 一种无线终端映像文件维护方法及设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6427143B1 (en) * 1998-04-10 2002-07-30 Computer Associates Think, Inc. Method for loading rows into a database table while enforcing constraints
CN1255014A (zh) * 1998-10-09 2000-05-31 松下电器产业株式会社 从mpeg-2比特流中去除填充比特的可编程滤波器
CN1393849A (zh) * 2001-07-04 2003-01-29 英业达集团(南京)电子技术有限公司 电子装置上语音播放的方法
CN101876948A (zh) * 2009-04-30 2010-11-03 国际商业机器公司 在本地存储器中支持数据的不连续访问的方法和设备
CN101661415A (zh) * 2009-09-21 2010-03-03 中兴通讯股份有限公司 一种保存快照数据的方法及存储快照系统

Also Published As

Publication number Publication date
CN101917474A (zh) 2010-12-15
CN101917474B (zh) 2015-08-12

Similar Documents

Publication Publication Date Title
US8832161B2 (en) Interface for extending functionality of memory cards
US8150890B2 (en) File system that manages files according to content
US6823417B2 (en) Memory controller for memory card manages file allocation table
US8326811B2 (en) File management method and computer system
US20070112891A1 (en) Converting file-systems that organize and store data for computing systems
CN102939593B (zh) 无限存储器
CN101882132A (zh) 虚拟fat文件系统的创建及读取方法以及装置
US10166467B2 (en) Information processing device, data structure of game data, and recording medium
WO2020199760A1 (zh) 数据存储方法、存储器和服务器
WO2023226314A1 (zh) 应用的缓存可伸缩处理方法、装置、设备及介质
US9015444B2 (en) Access apparatus and available storage space calculation method
CN102541969B (zh) 基于fat文件系统的文件保护方法、系统及存储器
CN112615917A (zh) 存储系统中存储设备的管理方法及存储系统
WO2012019388A1 (zh) 文件的下载方法、系统及装置
JP2007080240A (ja) ファイル割り当てテーブルのアクセス手法
CN111803917A (zh) 资源的处理方法和装置
WO2014153931A1 (zh) 文件存储方法、装置、访问客户端及元数据服务器系统
CN101089842A (zh) 复制文件到嵌入式设备中的方法
US8200936B2 (en) Systems and methods for recording information to a memory card
CN114416656A (zh) 一种远程操作文件夹的方法、设备及存储介质
CN113918519A (zh) 一种文件夹挂载方法、装置及终端设备
KR20070030646A (ko) Fat의 접속 메커니즘
CN114356224B (zh) 文件地址优化方法、终端、服务器及计算机可读存储介质
US20100274828A1 (en) Electronic Device, Storage Area Allocation Method for File System, and Computer Product
WO2023087231A1 (zh) 一种目录读取系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10855809

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10855809

Country of ref document: EP

Kind code of ref document: A1