File information reading method and device, and storage medium
By reading the data blocks of the target file in 3D modeling software, determining and using the external link address to read the file's external link content, the problem of low efficiency in reading external link information of binary files in existing technologies is solved, and efficient and economical file information reading is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2026-03-27
AI Technical Summary
Existing technologies are inefficient when reading external links to binary files from 3D modeling software, especially when processing large scene files, as the file opening time is too long, affecting reading efficiency.
By reading multiple data blocks in the target file, the external link address of the file external link stored in the target data block is determined, and the file content corresponding to the file external link is read through the external link address. The binary file external link information is analyzed directly using text method without the need for 3D modeling software support.
This improves the efficiency and cost-effectiveness of reading external link information from binary files, avoids the time consumption of opening files in 3D modeling software, and increases reading speed.
Smart Images

Figure CN116467259B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of big data, and in particular, to a file information reading method and device and storage medium. BACKGROUND
[0002] At present, when reading external chain information of a three-dimensional modeling software binary file in the prior art, a three-dimensional modeling software needs to be opened and a specific script needs to be written to obtain the external chain information of the binary file, where the three-dimensional modeling software can include Maya, Blender, Rhino and the like. However, when a large scene file is encountered, the time for opening the file is relatively long, thereby affecting the reading efficiency of the external chain information of the binary file.
[0003] At present, no effective solution has been proposed for the above problems. SUMMARY
[0004] Embodiments of the present disclosure provide a file information reading method and device and storage medium to at least solve the technical problem that the way of reading external chain information of a binary file provided in the related art lacks efficiency and economy.
[0005] According to an embodiment of the present disclosure, a file information reading method is provided, including: reading a target file, where the target file is a binary file composed of a plurality of data blocks, each data block at least including an information data block and a content data block, the information data block at least storing the type and length of data stored in the content data block; determining a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, where the target data block at least stores an external chain address of a file external chain; reading the external chain address of the file external chain stored in the content data block corresponding to the target data block; and reading file content corresponding to the file external chain through the external chain address.
[0006] According to an embodiment of the present disclosure, a file information reading device is also provided, including: a first reading module configured to read a target file, where the target file is a binary file composed of a plurality of data blocks, each data block at least including an information data block and a content data block, the information data block at least storing the type and length of data stored in the content data block; a determining module configured to determine a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, where the target data block at least stores an external chain address of a file external chain; a second reading module configured to read the external chain address of the file external chain stored in the content data block corresponding to the target data block; and a third reading module configured to read file content corresponding to the file external chain through the external chain address.
[0007] According to one of the embodiments of the present disclosure, a computer readable storage medium is also provided, and the computer readable storage medium stores a computer program. The computer program is configured to execute the file information reading method in any of the above embodiments when running.
[0008] According to one of the embodiments of the present disclosure, an electronic device is also provided. The electronic device comprises a memory and a processor. The memory stores a computer program. The processor is configured to execute the computer program to perform the file information reading method in any of the above embodiments.
[0009] In at least some embodiments of the present disclosure, a target file is read. The target file is a binary file composed of a plurality of data blocks. Each data block comprises at least an information data block and a content data block. The information data block stores at least the type and length of the data stored in the content data block. The target data block is determined from the plurality of data blocks according to the information data block and the content data block contained in each data block. The target data block stores at least an external link address of a file external link. The file external link corresponding to the content data block of the target data block is read according to the external link address. The file content corresponding to the file external link is read according to the external link address. The purpose of reading the binary file external link information in a text mode is achieved. The technical effects of improving the efficiency and economy of the method of reading the binary file external link information are achieved. The technical problem of lack of efficiency and economy in the method of reading the binary file external link information provided in the related art is solved. BRIEF DESCRIPTION OF DRAWINGS
[0010] The accompanying drawings, which are included to provide a further understanding of the present disclosure and constitute a part of this application, illustrate certain illustrative embodiments of the present disclosure and are used to explain the present disclosure. In the drawings:
[0011] Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a file information reading method according to an embodiment of the present disclosure;
[0012] Figure 2 FIG. 2 is a flowchart of a file information reading method according to an embodiment of the present disclosure;
[0013] Figure 3 FIG. 3 is a flowchart of reading file information according to an embodiment of the present disclosure;
[0014] Figure 4 FIG. 4 is a structure block diagram of a file information reading device according to an embodiment of the present disclosure;
[0015] Figure 5 FIG. 5 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0016] In order to better understand the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work should fall within the scope of protection of the present disclosure.
[0017] It should be noted that the terms "first", "second", and the like in the specification and claims of the present disclosure and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0018] First, some of the nouns or terms that appear in the description of the embodiments of the present application are explained as follows:
[0019] (1) Struct: interpret byte string as packed binary data. It can convert binary data into corresponding string through fixed character combination.
[0020] (2) Unpack: convert binary data into text data.
[0021] (3) Data unit length: the unit length of Maya mb file data memory reading is 8 bytes.
[0022] (4) Data alignment: if the data is not enough to be a multiple of the data unit length, the data will be padded with null bytes. For example, 19-byte data is not enough to be 8x3 = 24 bytes long, so the last 5 bytes of the data will be padded with 5 null bytes (\x00).
[0023] (5) StructKey: The binary format character translation value corresponding to the information data block value of the Maya mb file. The header binary data encountered is unpacked using this value, and converted into a text value. This value is fixed in the 64-bit Maya software, and the value is: > LxxxxQ. The length of the binary data accepted during unpacking is 16 bytes. The character > represents the byte order is big-endian. The character L represents unsigned long, and the corresponding python type is int integer, with a length of 4 bytes. The character x represents a padding byte, with a length of 1 byte. The character Q represents unsigned long long, and the corresponding python type is int integer, with a length of 8 bytes. Therefore, the total length of the data is 16 = 4 + 1 + 1 + 1 + 1 + 8.
[0024] (6) TypeId Key: The binary format character translation value corresponding to the node type value of the Maya mb file.
[0025] The header binary data encountered is unpacked using this value, and converted into a text value. This value is fixed in the 64-bit Maya software, and the value is: > L, and the length of the binary data accepted during unpacking is 4 bytes. The character > represents the byte order is big-endian. The character L represents unsigned long, and the corresponding python type is int integer, with a length of 4 bytes. Therefore, the total length of the data is 4 = 4.
[0026]
[0027] (7) Unit Data Block: The information of a data node or a single operation stored in the Maya mb file. It contains two parts, namely the information data block and the content data block, and the content data block can contain sub-unit data blocks.
[0028] (8) Information Data Block: The first 16 bytes of data in the unit data block, which can be unpacked using Struct Key to obtain a 4-byte string (Data Type) and an 8-byte unsigned long integer (Data Length).(9) Header Data Type: The value representing the type of the subsequent content data. Among them, there are two values that need to be noticed, which are FOR8 and LIS8. These two types of values represent that the subsequent data contains multiple sub-data blocks (multiple information data blocks and content data blocks), and can also be analyzed and read according to the analysis process of the unit data block. (Similar to the nesting of data structures, such as a data list containing another data list, multiple small lists forming a large list).
[0029] (10) Node Oper Type: When the Data Type is FOR8 or LIS8, the 4 bytes of data following the chunk of information data represent the Node Oper Type. The Node Oper Type indicates the type of Maya node or the operation performed on the node.
[0030] (11) Data Type Classification: The header data is classified into two types, Type A and Type B. Type A is when the Data Type is FOR8 or LIS8, and the following data contains nested sub-data. Type B is when the Data Type is other, and the following data is pure operation data without nested sub-data.
[0031] (12) Out Source Node Type: This is the node type symbol that contains the file external link. In Maya mb files, the value of the Node Oper Type of the node type that contains the external link file is similar to RTFT, DIPL, and AUDI, which contain map files, audio files, and so on.
[0032] (13) Out Source Oper: This is the operation type symbol of the node that contains the file external link. In Maya mb files, the node that contains the file external link has a series of operation types, and one of the operation types represents the information of the file path of the external link file. Similar to the operation types of the RTFT node that contains map files or the AUDI node that contains audio files, the operation type is STR.
[0033] (14) Out Source Attr: This is the operation attribute symbol of the node that contains the file external link. In Maya mb files, the node that contains the file external link has a series of attributes that are set by operations, and the value of one of the attributes is the information of the file path of the external link file. Similar to the operation attribute of the RTFT node that contains map files, the operation attribute is ftn.
[0034] (15) Data Struct: Each chunk of data outputs an array of three elements, where the first element is the Node Oper Type. The second element is an array of two integers that represents the start position and the end position of the current chunk of data. The third element is an empty array for the nested sub-data structure Data Struct.
[0035] (16) Output data stack Stack: Stack is a data structure, and also a data structure in which data items are arranged in order, and data items can only be inserted and deleted at one end (called the top). Here, the Data Struct of each unit data block is stored on the Stack in the form of a stack.
[0036] (17) Array pointer Ptr: Pointer to the array.
[0037] (18) File read position File Pos: The absolute position of the current read point in the file, that is, the byte position in the file. For example, if File Pos is equal to 100, it means that the current read point is at the 100th byte position from the file header.
[0038] (19) Data read position Data Pos: The absolute position of the current read point in the entire data, that is, the byte position in the memory data. For example, if Data Pos is equal to 100, it means that the current read point is at the 100th byte position from the data start point.
[0039] (20) Difference between File Pos and Data Pos: File Pos is the data position of the entire file, and Data Pos is the data position of a certain piece of information in the file. A File will be read multiple times Data, so File Pos >= DataPos. At the same time, the position of Data Pos 0 also corresponds to multiple File Pos.
[0040] (21) Structure of Maya binary STR operator record external chain file path: OutSourceAttr + null character (\x00) + space + external chain file path + null character (\x00).
[0041] In one possible implementation, the method commonly used for reading binary file external chain information in the context of using three-dimensional modeling software for film and game production is to open the three-dimensional modeling software and then write a specific script to obtain it. After careful research and practice, the inventors still have the technical problems of lack of efficiency and economy. Based on this, the game scene to which the embodiments of the disclosure are applied can be an animation or three-dimensional modeling scene, and the game type targeted is generally a large 3D game. A file information reading method is proposed, and the technical concept adopted is to read the file in text mode through python, without the support of three-dimensional modeling software, which realizes the purpose of reading and analyzing binary file external chain information based on text, thereby solving the technical problems of lack of efficiency and economy in reading binary file external chain information in related technologies, and further achieving the technical effects of improving the efficiency and economy of reading binary file external chain information.
[0042] The method embodiments of the above-mentioned method of the present disclosure can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking the case of running on a mobile terminal, the mobile terminal can be a smart phone, a tablet computer, a palm computer, a mobile Internet device, a PAD, a game console or the like terminal device. Figure 1 is a hardware structure block diagram of a mobile terminal of an XXXXX method of an embodiment of the present disclosure. As shown in Figure 1 , the mobile terminal can include one or more (only one is shown in the figure) processors 102 (the processor 102 can include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc. Processing device) and memory 104 for storing data, in an embodiment of the present disclosure, can also include: input and output device 108 and display device 110. Figure 1 In some optional embodiments mainly in game scenarios, the above-mentioned device can also provide a human-computer interaction interface with a touch-sensitive surface, which can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction function can include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music and / or web browsing, etc. Executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in one or more processor executable computer program products or readable storage media.
[0043] Those skilled in the art can understand that
[0044] The structure shown in the figure is only schematic, and does not limit the structure of the above-mentioned mobile terminal. For example, the mobile terminal can include more or fewer components than those shown in the figure, or have a different configuration from that shown in the figure. Figure 1 Figure 1 Figure 1
[0045] According to an embodiment of the present disclosure, an embodiment of a file information reading method is provided. It should be noted that the steps shown in the flowchart of the figure can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that here.
[0046] Figure 2 is a flowchart of a file information reading method according to an embodiment of the present disclosure, as Figure 2 As shown, the method comprises the following steps:
[0047] In step S202, a target file is read, wherein the target file is a binary file composed of a plurality of data blocks, each data block comprising at least an information data block and a content data block, the information data block storing at least the type and length of the data stored in the content data block.
[0048] Optionally, the execution subject of the embodiment is a target reading system, and other electronic devices and processors can also be the execution subject, wherein the target reading system can execute the method through programming languages such as Python, C++, Java, and the like, and no more limitation is made herein.
[0049] In the technical solution provided in the above step S202 of the disclosure, the target reading system first reads the external chain file generated by the three-dimensional modeling software, wherein the external chain file is a file stored in the form of a binary file, each external chain file contains two data blocks (an information data block and a content data block), wherein the content data block is used to store the specific content of the data, and the information data block is used to store the type and length of the data in the content data block.
[0050] Optionally, in the present solution, the three-dimensional modeling software can be Maya software, and it should be noted that in real scene applications, as long as it is a three-dimensional modeling software, it can be applied to the present solution, and no specific limitation is made herein, and the application object of the three-dimensional modeling software is professional film and television advertisement, character animation, film special effect, etc., which is a high-end production software of film level. The suffix of the file in which the engineering content of the Maya software is stored in binary form is mb.
[0051] Optionally, the specific content of the data stored in the content data block can include the information of the external chain file of the Maya binary file, wherein the external chain file is a file used to assist in realizing the final effect, such as texture maps, animation audio, video files, etc. contained in the file.
[0052] Optionally, the information data block stores the type and length of the data, wherein the file type of the external chain file of the Maya binary file can be many, such as texture maps, animation audio, video files, etc. contained in the file.
[0053] In step S204, a target data block is determined from the plurality of data blocks according to the information data block and the content data block contained in each data block, wherein the target data block at least stores an external chain address of a file external chain.
[0054] In the technical solution provided in the step S204 of the present disclosure, the target reading system can screen the plurality of data blocks in the read external chain file, record the positions of the data blocks with useful information, so as to achieve the technical effect of quickly reading information and obtaining the target data block, wherein the target data block stores the address of the external chain file, and the external chain file is a file used to assist in achieving the final effect.
[0055] Optionally, in the process of screening the data blocks by the target reading system, the screening module integrated in the target reading system can be used for screening, or the data blocks can be output to other systems with screening function for screening of the target data blocks, which is not limited here.
[0056] Optionally, the screening of the target data block can be a preset condition, wherein the setting of the preset condition can be changed according to different situations, for example, when the technical personnel need to obtain the texture in the animation made by using the Maya software, the preset condition should be changed to screen the data blocks related to the texture; when the technical personnel need to obtain the audio in the animation made by using the Maya software, the preset condition should be changed to screen the data blocks related to the audio in the animation.
[0057] In step S206, the external chain address of the file external chain stored in the content data block corresponding to the target data block is read.
[0058] In the technical solution provided in the step S206 of the present disclosure, the target reading system can read the external chain address of the file external chain in the target data block, wherein the external chain address is stored in the content data block corresponding to the target data block.
[0059] Optionally, the target reading system can read the data blocks one by one to accurately obtain the information required by the entire Maya binary file, and further record the start point and end point of the position of the file where the information is located, and output a position file about the content of the data block as the external chain address of the file external chain.
[0060] Optionally, it is worth noting that the recording of the above-mentioned external chain address can have various forms, the obtained external chain address can be recorded in a text file, or the address can be written into an API document for calling by other modules, which is not limited here.
[0061] In step S208, the file content corresponding to the file external chain is read through the external chain address.
[0062] In the technical solution provided in the step S208 of the present disclosure, the target reading system obtains the file content corresponding to the external chain file through the read external chain address of the useful external chain file, so as to achieve the purpose of obtaining the external chain file path of the binary file.
[0063] Optionally, after obtaining the file path of the required external chain file, the skilled person can accurately find the required external chain file in the plurality of external chain files and further obtain the content information stored in the required external chain file.
[0064] The above steps S202 to S208, as shown in Figure 3 It can be seen that, in the present disclosure, the target file generated by the software project is read, wherein the target file is a binary file composed of a plurality of data blocks, each data block at least includes an information data block and a content data block, the information data block at least stores the type and length of the data stored in the content data block, the target data block is determined from the plurality of data blocks according to the information data block and the content data block contained in each data block, the target data block at least stores the address of the file external chain, the file external chain is a file used to assist in implementing the software project, the external chain address of the file external chain stored in the content data block corresponding to the target data block is read, and the file content corresponding to the file external chain is read through the external chain address.
[0065] It is easy to note that, in the embodiment of the present disclosure, the target reading system can directly read the length and information of the corresponding content of the current content data block of the binary external chain file through the information data block of the binary external chain file, and then read the file according to the length of the content information block obtained by the information data block to obtain the specific content of the corresponding content information, thereby avoiding the technical problem in the prior art that the binary external chain file information needs to be installed first when reading the binary external chain file information, and when opening the three-dimensional modeling file, the opening time is longer when encountering a complex large scene file, thereby improving the efficiency and economy of reading the binary external chain file information.
[0066] The above method of the embodiment will be further described in detail.
[0067] As an optional implementation, step S204, determining the target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, includes: determining a reading start position of the data contained in the target file, determining a to-be-read data block from the plurality of data blocks according to the reading start position, performing parsing processing on the to-be-read data block to obtain the information data block of the to-be-read data block, and determining the to-be-read data block as the target data block when the type corresponding to the information data block of the to-be-read data block is an external chain operation type.
[0068] In this embodiment, the process of determining the target data block from the plurality of data blocks can include the following steps: reading the start position of the data contained in the Maya file, reading each data block from the start position, screening the data block to be read from the plurality of data blocks, parsing the plurality of data blocks to be read to obtain the information data block contained therein, determining the type of the information data block, and determining that the data block to be read corresponding to the information data block is the target data block when the type of the information data block is the type containing the external chain operation.
[0069] As an optional implementation, after determining the data block to be read from the plurality of data blocks according to the read start position, the method further includes: determining the length of the unread data in the data block to be read; determining that the data block to be read is a residual data block when the length of the unread data is less than the length recorded in the information data block of the data block to be read; and integrating the unread data in the residual data block and the unread data in the next data block to be read to obtain the integrated data block to be read.
[0070] In this embodiment, after the target reading system obtains the data block to be read, it should also determine the length of the data in the data block to be read that has not been read. When the length of the unread data is less than the length of the data block to be read, the data block to be read is determined as a residual data block. Then the next data block to be read is read, and finally the data in the residual data block and the next data block to be read are integrated to obtain the integrated complete data block to be read.
[0071] Optionally, for example, the target reading system can use the python script language to read the binary file, and each time the length of the data read can be 10M, and stored as data DataA. (When encountering a file of G level or above, the length of the data read each time can be 100M), because the position of the end of reading when reading is not necessarily the end of the data block, part of the data of the last data block will be left as a residual data block, which is recorded as Data Res. At this time, Data Res and DataA are integrated to obtain the data Data of this analysis, Data = DataRes + DataA.
[0072] Optionally, the target reading system takes the last reading end point as the start point of the current data reading each time it restarts reading the next segment of data, and performs data reading analysis. It is worth noting that when analyzing data, there will be some difference between the read data block and the position of the real complete unit data block, for example, if the length of the read data is 10 Mb, the first data block may occupy 9 Mb, and the remaining 1 Mb is not a complete unit data block. At this time, the next 10 Mb of data needs to be read to make up a complete data block, so there will be some residual data block left over from the last analysis. That is, after the last analysis, the remaining data is not a complete data block, so the residual data block and the next read data are combined for the next analysis.
[0073] Optionally, for example, the first 16 bytes of data (i.e. the information data block) of the read data block at position Pos are stored as DataHead1, and the current reading point position Pos1 = Pos0 + 16. The DataHead1 is unpacked using structKey to obtain two values Val1 and Val2, where the first value Val1 is the node type value, which can be converted to text by typeIdKey and represented by DataType1, and the second value Val2 is the total length of the data of this node type, represented by DataLen1. The target reading system then determines whether the total length of the data is less than the length recorded in the information data block, i.e. whether the length of the data is less than DataLen1 + 16. If the length of the data is less than DataLen1 + 16, the current data is set as the current residual data DataRes, and the next segment of data of a fixed length is read to integrate the new data for single file information analysis.
[0074] As an optional implementation, after determining the length of the unread data in the to-be-read data block, the above method further includes: when the length of the unread data is greater than the length recorded in the information data block of the to-be-read data block, performing parsing processing on the to-be-read data block to obtain the information data block of the to-be-read data block.
[0075] In this embodiment, after obtaining the to-be-read data block, the target reading system should also determine the length of the unread data in the to-be-read data block. If the length of the unread data is greater than the length of the to-be-read data block, it indicates that the unread data contains the information of a complete data block, so the to-be-read data block can be directly parsed to obtain the corresponding information data block in the to-be-read data block.
[0076] Optionally, for example, the length of the read data is 10Mb, which contains a data block, and the length of the data block is 9Mb, thus indicating that all the content information of the data block is contained in the read data, and thus the data block to be read can be directly parsed.
[0077] As an optional embodiment, after the data block to be read is parsed to obtain the information data block of the data block to be read, the method further comprises: determining the data type of the data contained in the data block to be read according to the information data block of the data block to be read; when the data type is a first type, reading first data, wherein the first type represents that the content data block of the data block to be read contains a sub data block, the first data is the data of the first preset bytes after the information data block corresponding to the data block to be read, and the first data is used to represent the operation type corresponding to the data block to be read; when the operation type contained in the first data is a target type, creating a first data structure, wherein the elements corresponding to the first data structure at least include the target type, the start position information and the end position information of the data block to be read, and an empty array; writing the first data structure into the position after the top layer data pointer in the target data stack, and writing the empty array into the top layer of the target data stack.
[0078] In this embodiment, the target reading system needs to determine the data type of the data in the data block to be read according to the information data block obtained by the above method, and when the data type is FOR8 or LIS8, it indicates that the content data block in the data block to be read contains a sub data block, and when the target reading system determines that the type is a type containing a sub data block, the first data (4 bytes) of the information data block corresponding to the data block to be read is read, and when the type represented by the first data is a type that needs to be further analyzed, a first data structure is created, wherein the first data structure includes the target type, the start and end positions of the data block, and an empty array, and the first data structure is written into the position after the top layer data pointer in the target data stack, and the empty array is written into the top layer of the target data stack.
[0079] Optionally, for example, the target reading system needs to determine the type of the current Data Type 1, if Data Type 1 is FOR8 or LIS8, i.e. the type of the subsequent data contains sub-data, then read 4 bytes of data, and get the node or operation type data NodeOperType1, the current reading position is Pos2 = Pos1 + 4 = Pos0 + 16 + 4 = Pos0 + 20, and then determine whether the current NodeOperType1 belongs to the OutSourceNodeType that needs to be further analyzed. If the current NodeOperType1 belongs to the node type that needs to be further analyzed (such as NodeOperType1 is a map node RTFT, which belongs to the data node of the external chain that needs to be analyzed), a DataStruct1 is created, in which three elements can be set as [NodeOperType1, [FilePos0 + Pos1, FilePos0 + Pos1 + DataLen1], [](Ptr2)], and DataStruct1 is added to the back of the array Ptr1. The third element here is the array pointer Ptr2 (empty array []) as a pointer is pushed to the top of the Stack stack and taken out, so that all subsequent operation data modifications are performed on Ptr2.
[0080] Optionally, in the first data structure DataStruct, each unit data block outputs an array of three elements, where the first element is NodeOperType, the second element is a two-element integer array representing the start position and end position of the current unit data block, and the third element is an empty array for nested sub-structure DataStruct. The data organization is as follows, which embodies the subordinate relationship, i.e. NodeOperType is HEAD, XFRM, DCAM, etc. sub-data block belongs to MAYA large data block.
[0081]
[0082] Optionally, the data structure created needs to contain three elements, and it is worth noting that the second element representing the start position of the data should be represented by adding an absolute position. Since the current Pos1 corresponds to the position of the data read, and FilePos0 is the absolute position of the data in the file. It can be understood that Pos1 is a relative offset value based on FilePos0. For example, Pos1 may be 64, but FilePos0 is 1000. That is, the current data is based on the document position 1000 bytes, and then offset by 64 bytes. The data read by subsequently offsetting 64 bytes is incorrect. The absolute position of the document, i.e. 1064, needs to be used to read the real data.
[0083] Optionally, the array pointer is stored in the stack, and becomes the only array pointer in the stack and the top layer. The array is used to store the data of the DataStruct, and the third element of the DataStruct is also an empty array, which is used to store the data of the sub-DataStruct, thus forming a recursive nested data structure.
[0084] The form is as follows.
[0085]
[0086]
[0087] Optionally, the stack is a special data structure, and is a data structure in which data items are arranged in sequence, and has the obvious feature that data items can only be inserted and deleted at one end, referred to as the top.
[0088] As an optional implementation, after the first data is read, the method further includes: when the operation type contained in the first data is another type, determining a first position, wherein the another type is a type other than the target type, and the first position is determined by a reading position of the first data, a data length corresponding to the data block to be read, and the first preset byte; and reading data at the first position.
[0089] In this embodiment, when the target reading system determines that the type is not the type containing the sub-data block, the target reading system jumps to the first position and reads the data at the first position.
[0090] Optionally, for example, if the current NodeOperType1 does not belong to the node type that needs to be further analyzed, the reading jumps to a position Pos3 after DataLen1-4 (because DataLen1 contains 4 bytes of NodeOperType1 data) and then reads. That is, Pos3 = Pos2 + DataLen1-4 = Pos1 + DataLen1 = Pos0 + 16 + DataLen1. At this time, the single reading analysis is completed, and the next single reading analysis is repeated by jumping to the position of Pos3.
[0091] Optionally, NodeOperType is node or operation type data, when the header data type is FOR8 or LIS8, the 4 bytes of data after the header data block represent the node or operation type data NodeOperType. The type of the Maya node or the operation on the node is marked by NodeOperType.
[0092] As an optional implementation, after determining the data type of the data contained in the to-be-read data block according to the information data block of the to-be-read data block, the method further comprises: when the data type is a second type, determining whether the data type of the data contained in the information data block of the to-be-read data block is an external chain operation type, wherein the second type is a type other than the first type.
[0093] In this embodiment, after determining the data type of the data contained in the to-be-read data block according to the information data block of the to-be-read data block, the method further comprises the following step: when the target reading system determines that the data type contained in the to-be-read data block is not FOR8 or LIS8, it is further determined whether the data type of the data contained in the information data block of the to-be-read data block is an external chain operation type.
[0094] Optionally, when DataType1 is not of the FOR8 and LIS8 types, the data of the current type is data without sub-cell data blocks. Since the current data is data without sub-cell data blocks, the length of the data content of the current cell data block is not zero, so DataStruct1 must be a non-empty array at this time, and the first element thereof is of a node type that needs to be analyzed, wherein the node type can be HEAD, XFRM or DCAM, which are not limited here.
[0095] As an optional implementation, the external chain address of the file external chain stored in the content data block corresponding to the target data block comprises: when the type corresponding to the information data block of the to-be-read data block is an external chain operation type, determining that the to-be-read data block is the target data block, calculating the sum of the reading start position, the second preset byte and the length of the content data block corresponding to the target data block to obtain a second position, reading the data at the second position to obtain second data, when the header data corresponding to the second data includes target header data, determining the external chain address of the file external chain according to the reading start position, the second preset byte, the length of the second data, the character length of the plurality of null bytes and the character length of the space, creating a second data structure, wherein the second data structure corresponds to at least the external chain operation type, the start position information of the second data and the end position information of the second data, and writing the second data structure into a position after the data pointer at the top layer of the target data stack.
[0096] In this embodiment, when the target reading system determines that the type of the information data block of the data block to be read corresponds to the external chain operation type, it indicates that the data block to be read is the target data block, and then jumps to the second position to read the data at the second position to obtain second data. When the head data of the second data is an operation attribute symbol of a node containing a file external chain, the external chain address of the current file external chain is recorded, and a second data structure is created, and the second data structure is written into the position after the data pointer at the top of the target data stack.
[0097] Optionally, for example, if the current operator OutSourceOper is a legal operator of external chain information, the characters of length DataLen1 after the position Pos1 are read and stored as RealData. The target reading system needs to determine whether RealData starts with the legal attribute symbol OutSourceAttr of the external chain information, for example, the legal external chain attribute symbol OutSourceAttr of the node RTFT containing the map file is ftn.
[0098] If the current RealData starts with its legal attribute symbol OutSourceAttr, it can be determined that it is the target data. The starting position of the real address of the data of the external chain file is Pos5 = Pos1 + the character length of OutSourceAttr + the character length of null byte + the character length of space + the character length of null byte. For example, if OutSourceAttr is ftn, Pos5 = Pos1 + 3 + 1 + 1 + 1 = Pos1 + 6. The end position of the real address is Pos6 = Pos1 + DataLen1.
[0099] At the same time, a DataStruct2 is created, and its three elements are set to [OutSourceOper, [FilePos0+Pos1, FilePos0+Pos6], [FilePos0+Pos5, FilePos0+Pos6]]. DataStruct2 is added to the back of the array Ptr1. Since it does not contain sub-data, the empty array of the third element of DataStruct2 does not need to be pressed into the top layer of the stack, and therefore does not need to follow the data structure of DataStruct. Since the subsequent unit data does not contain sub-unit data, the Ptr2 pointer in DataStruct2 does not need to be used, and therefore the array pointer of the subsequent operation is still Ptr1.
[0100] Optionally, the target reading system can subsequently directly read the data of FilePos0+Pos5 to FilePos0+Pos6 of the Maya mb file to directly obtain the address of the target file external chain.
[0101] Optionally, when the reading and analyzing of the target data is finished, the target reading system should jump to a position Pos4 = Pos1 + DataAlign(DataLen1) and repeat the next single data reading and analyzing.
[0102] As an optional embodiment, after reading the data at the second position to obtain the second data, the method further comprises: when the head data corresponding to the second data does not include the target head data, determining a third position according to the reading start position, the second preset byte and the length of the content data block corresponding to the target data block, and reading the data at the third position.
[0103] In this embodiment, when the target reading system determines that the type corresponding to the information data block of the to-be-read data block is not the external chain operation type, it indicates that the to-be-read data block is not the target data block, and then the target reading system jumps to the third position to further read the data at the third position.
[0104] Optionally, for example, if the current RealData does not start with its legal attribute symbol OutSourceAttr. Then it is not the target data, and since the current data does not contain sub-unit data, its data length is not subjected to data alignment operation. Maya stipulates that the data content should be subjected to data alignment, i.e., the data length is a multiple of 8, and if the length is less than a multiple of 8, the missing bits need to be filled with empty characters to make the entire data length a multiple of 8. For example, if DataLen1 is 19, it needs to fill 5 empty characters to make the entire data length 24, i.e., 3 times of 8, and thus DataLen1 needs to be subjected to data alignment DataAlign to end the current single data reading and analyzing.
[0105] As an optional embodiment, reading the external chain address of the file external chain stored in the content data block corresponding to the target data block comprises: when the type corresponding to the information data block of the to-be-read data block is not the external chain operation type, performing data alignment operation on the data in the content data block corresponding to the target data block to obtain an aligned content data block, determining a third position according to the reading start position, the second preset byte and the length of the aligned content data block, and further reading the data at the third position.
[0106] In this embodiment, when the target reading system determines that the type corresponding to the information data block of the to-be-read data block is not the external chain operation type, it performs data alignment operation on the data in the content data block corresponding to the target data block to obtain an aligned content data block, and then the target reading system jumps to the third position to read the data at the third position.
[0107] Optionally, for example, if the current operator OutSourceOper is not a legal operator of the external chain information, the current unit data is not target data, and since the current data is data without subunits, the data length thereof is not subjected to data alignment, Maya software stipulates that the data content is subjected to data alignment, that is, the data length is a multiple of 8, and if the length is less than a multiple of 8, the missing bits need to be filled with empty characters to make the entire data length a multiple of 8. For example, if DataLenl is 19, 5 empty characters need to be filled to make the entire data length 24, that is, 3 times of 8, and thus DataLenl needs to be subjected to data alignment DataAlign. After DataLenl is subjected to data alignment, the target reading system jumps to Pos4 = Posl + DataAlign(DataLenl) and repeats the next single data reading analysis.
[0108] Optionally, Maya files record the real length of data for the accuracy of data, and the real effective data is similar to “D: / def / ghij / abc.jpg”, the length of which is 19 bits. If the data is subjected to data alignment, the result is 24 bits, which includes 5 bits of redundant empty bytes. However, Maya only records the current effective 19-bit data for the accuracy of reading content, and due to the influence of binary file memory alignment and other software reading speed reasons, the next sub-data should start at data position 20, but due to data alignment, the recording position of the next data is 24, and 5 bits of empty characters are inserted between the two sub-data. If the current unit data includes subunit data, since all subunit data is subjected to data alignment, the length of all subunit data is the same as the aligned data. That is, n1x8+...+n9x8 is still a multiple of 8.
[0109] From the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and a necessary general hardware platform, and of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the disclosure can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the methods of the various embodiments of the disclosure.
[0110] A file information reading device is also provided in the embodiments, which is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation of hardware, or a combination of software and hardware, is also possible and contemplated.
[0111] Figure 4 is a structural block diagram of a file information reading device according to an embodiment of the present disclosure, as shown in Figure 4 The device includes a first reading module 401, a determination module 402, a second reading module 403, and a third reading module 404.
[0112] The first reading module 401 is configured to read a target file generated by a target application in a software project, where the target file is a binary file composed of a plurality of data blocks, each data block including at least an information data block and a content data block, and the information data block at least stores the type and length of the data stored in the content data block.
[0113] The determination module 402 is configured to determine a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, where the target data block at least stores an address of an external file link, and the external file link is a file used to assist in implementing the software project.
[0114] The second reading module 403 is configured to read the external link address of the external file link stored in the content data block corresponding to the target data block.
[0115] The third reading module 404 is configured to read the file content corresponding to the external file link through the external link address.
[0116] Optionally, the determination module 402 includes a first determination unit configured to determine a reading start position of the data contained in the target file, a second determination unit configured to determine a to-be-read data block from the plurality of data blocks according to the reading start position, an analysis unit configured to perform analysis processing on the to-be-read data block to obtain the information data block of the to-be-read data block, and a third determination unit configured to determine that the to-be-read data block is the target data block when the type corresponding to the information data block of the to-be-read data block is an external link operation type.
[0117] Optionally, the determining module 402 further includes: a fourth determining unit, configured to determine a length of the unread data in the to-be-read data block; a fifth determining unit, configured to determine that the to-be-read data block is a left-behind data block when the length of the unread data is less than the length recorded in the information data block of the to-be-read data block; and a first processing unit, configured to perform integration processing on the unread data in the left-behind data block and the unread data in a next to-be-read data block, to obtain an integrated to-be-read data block.
[0118] Optionally, the determining module 402 further includes a second processing unit, configured to perform parsing processing on the to-be-read data block to obtain the information data block of the to-be-read data block when the length of the unread data is greater than the length recorded in the information data block of the to-be-read data block.
[0119] Optionally, the determining module 402 further includes: a sixth determining unit, configured to determine a data type of data contained in the to-be-read data block according to the information data block of the to-be-read data block; a first reading unit, configured to read first data when the data type is a first type, wherein the first type indicates that the content data block of the to-be-read data block contains a sub data block, the first data is data of a first preset byte after the information data block corresponding to the to-be-read data block, and the first data is used to indicate an operation type corresponding to the to-be-read data block; a first creating unit, configured to create a first data structure when the operation type contained in the first data is a target type, wherein the first data structure corresponds to at least the target type, start position information and end position information of the to-be-read data block, and an empty array; and a first writing unit, configured to write the first data structure into a position after a data pointer of a top layer in a target data stack, and write the empty array into the top layer of the target data stack.
[0120] Optionally, the determining module 402 further includes: a seventh determining unit, configured to determine a first position when the operation type contained in the first data is a type other than the target type, wherein the first position is determined by a reading position of the first data, a data length corresponding to the to-be-read data block, and the first preset byte; and a second reading unit, configured to read data at the first position.
[0121] Optionally, the determining module 402 further includes a judging unit, configured to judge whether a data type of data contained in the information data block of the to-be-read data block is an external chain operation type when the data type is a second type, wherein the second type is a type other than the first type.
[0122] Optionally, the second reading module 403 comprises: an eighth determining unit configured to determine that the to-be-read data block is the target data block when the type corresponding to the information data block of the to-be-read data block is the external chain operation type; a calculating unit configured to calculate a sum of the reading start position, the second preset byte, and a length of a content data block corresponding to the target data block to obtain a second position; a third reading unit configured to read data at the second position to obtain second data; a ninth determining unit configured to determine an external chain address of a file external chain according to the reading start position, the second preset byte, a length of the second data, a character length of the plurality of null bytes, and a character length of the space when the header data corresponding to the second data comprises the target header data; a second creating unit configured to create a second data structure, wherein the second data structure comprises at least the external chain operation type, start position information of the second data, and end position information of the second data; and a second writing unit configured to write the second data structure into a position after a data pointer of a top layer in the target data stack.
[0123] Optionally, the second reading module 403 further comprises: a tenth determining unit configured to determine a third position according to the reading start position, the second preset byte, and the length of the content data block corresponding to the target data block when the header data corresponding to the second data does not comprise the target header data; and a fourth reading unit configured to read data at the third position.
[0124] Optionally, the second reading module 403 comprises: an aligning unit configured to perform a data alignment operation on data in the content data block corresponding to the target data block to obtain an aligned content data block when the type corresponding to the information data block of the to-be-read data block is the non-external chain operation type; an eleventh determining unit configured to determine a third position according to the reading start position, the second preset byte, and the length of the aligned content data block; and a fifth reading unit configured to read data at the third position.
[0125] It should be noted that the above units and modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: the above units and modules are located in the same processor; or the above units and modules are located in different processors in any combination.
[0126] Embodiments of the present disclosure further provide a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0127] Optionally, in the embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various computer program storage media.
[0128] Optionally, in the embodiment, the computer readable storage medium can be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
[0129] Optionally, in the embodiment, the computer readable storage medium can be configured to store a computer program for performing the following steps:
[0130] reading a target file generated by a target application in a software project, wherein the target file is a binary file composed of a plurality of data blocks, each data block at least includes an information data block and a content data block, and the information data block at least stores the type and length of the data stored in the content data block;
[0131] determining a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, wherein the target data block at least stores an address of an out-of-file link, and the out-of-file link is a file used for assisting in implementing the software project;
[0132] reading the out-of-link address of the out-of-file link stored in the content data block corresponding to the target data block;
[0133] reading the file content corresponding to the out-of-file link through the out-of-link address.
[0134] Optionally, the computer readable storage medium is further configured to store program code for performing the following steps:
[0135] determining a reading start position of the data contained in the target file; determining a data block to be read from the plurality of data blocks according to the reading start position; performing parsing processing on the data block to be read to obtain an information data block of the data block to be read; and determining that the data block to be read is the target data block when the type corresponding to the information data block of the data block to be read is an out-of-link operation type.
[0136] Optionally, the computer readable storage medium is further configured to store program code for performing the following steps:
[0137] Determine the length of the unread data in the to-be-read data block; when the length of the unread data is less than the length recorded in the information data block of the to-be-read data block, determine that the to-be-read data block is a residual data block; and perform integration processing on the unread data in the residual data block and the unread data in the next to-be-read data block to obtain an integrated to-be-read data block.
[0138] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0139] When the length of the unread data is greater than the length recorded in the information data block of the to-be-read data block, perform parsing processing on the to-be-read data block to obtain the information data block of the to-be-read data block.
[0140] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0141] Determine the data type of the data contained in the to-be-read data block according to the information data block of the to-be-read data block; when the data type is a first type, read first data, wherein the first type indicates that the content data block of the to-be-read data block contains a sub data block, the first data is the data of a first preset byte after the information data block corresponding to the to-be-read data block, and the first data is used to indicate the operation type corresponding to the to-be-read data block; when the operation type contained in the first data is a target type, create a first data structure, wherein the elements corresponding to the first data structure at least include the target type, the start position information and the end position information of the to-be-read data block, and an empty array; write the first data structure into a position after the data pointer of the top layer in the target data stack, and write the empty array into the top layer of the target data stack.
[0142] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0143] When the operation type contained in the first data is a type other than the target type, determine a first position, wherein the first position is determined by the reading position of the first data, the data length corresponding to the to-be-read data block, and the first preset byte; and read the data at the first position.
[0144] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0145] When the data type is a second type, determine whether the data type of the data contained in the information data block of the to-be-read data block is an external chain operation type, wherein the second type is a type other than the first type.
[0146] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0147] When the type corresponding to the information data block of the data block to be read is the external chain operation type, the data block to be read is determined as the target data block; a sum of the reading start position, the second preset byte and the length of the content data block corresponding to the target data block is calculated to obtain a second position; data at the second position is read to obtain second data; when the header data corresponding to the second data includes the target header data, an external chain address of the file external chain is determined according to the reading start position, the second preset byte, the length of the second data, the character length of the plurality of null bytes and the character length of the space; a second data structure is created, wherein the elements corresponding to the second data structure at least include the external chain operation type, the start position information of the second data and the end position information of the second data; the second data structure is written into a position after the data pointer of the top layer in the target data stack.
[0148] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0149] When the header data corresponding to the second data does not include the target header data, a third position is determined according to the reading start position, the second preset byte and the length of the content data block corresponding to the target data block; data at the third position is read.
[0150] Optionally, the computer readable storage medium is further configured to store program codes for performing the following steps:
[0151] When the type corresponding to the information data block of the data block to be read is the non-external chain operation type, data alignment operation is performed on the data in the content data block corresponding to the target data block to obtain an aligned content data block; a third position is determined according to the reading start position, the second preset byte and the length of the aligned content data block; data at the third position is read.
[0152] In the computer readable storage medium of the embodiment, a technical solution of file information reading is provided. The target file generated by the target application in the software project is read, the target file is a binary file composed of multiple data blocks, each data block at least includes an information data block and a content data block, the information data block at least stores the type and length of the data stored in the content data block, and the target data block is determined from the multiple data blocks according to the information data block and the content data block contained in each data block, the target data block at least stores the address of the file external link, the file external link is a file used for assisting in implementing the software project, the external link address of the file external link stored in the content data block corresponding to the target data block is read, the file content corresponding to the file external link is read through the external link address, the purpose of reading the Maya binary file external link information in a text mode is achieved, and the technical effects of improving the efficiency and economy of the way of reading the Maya binary file external link information are achieved, and the technical problem of lack of efficiency and economy of the way of reading the Maya binary file external link information provided in the related art is solved.
[0153] Through the description of the above embodiments, those skilled in the art can easily understand that the example embodiments described herein can be implemented by software or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a computer readable storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.) or a network, and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, a terminal device, or a network device, etc.) execute the method according to the embodiments of the present disclosure.
[0154] In the example embodiments of the present application, a computer readable storage medium stores a program product capable of implementing the above-mentioned method of the embodiment. In some possible embodiments, various aspects of the embodiments of the present disclosure can also be implemented in the form of a program product, which includes program code for causing a terminal device to execute the steps according to various example embodiments of the present disclosure described in the above-mentioned “example method” section when the program product is run on the terminal device.
[0155] The program product for implementing the above-mentioned method according to the embodiments of the present disclosure can adopt a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the embodiments of the present disclosure is not limited to this, and in the embodiments of the present disclosure, the computer readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or apparatus.
[0156] The program product can adopt any combination of one or more computer readable media. The computer readable storage medium may, for example, be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any combination of the above. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0157] It should be noted that the program code contained on the computer readable storage medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0158] Embodiments of the present disclosure also provide an electronic device comprising a memory and a processor, the memory storing a computer program, and the processor being configured to execute the computer program to perform the steps in any of the above method embodiments.
[0159] Optionally, the electronic device described above can further comprise a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0160] Optionally, in the present embodiment, the processor can be configured to perform the following steps through the computer program:
[0161] reading a target file generated by the target application in the software project, wherein the target file is a binary file composed of a plurality of data blocks, each data block comprising at least an information data block and a content data block, the information data block storing at least the type and length of the data stored in the content data block;
[0162] determining a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, wherein the target data block stores at least the address of an external link of a file, the external link of the file being used to assist in implementing the software project;
[0163] reading the external link address of the external link of the file stored in the content data block corresponding to the target data block;
[0164] reading the file content corresponding to the external link of the file through the external link address.
[0165] Optionally, the processor can be further configured to perform the following steps through the computer program:
[0166] The read starting position of the data contained in the target file is determined; the data block to be read is determined from the plurality of data blocks according to the read starting position; the data block to be read is parsed to obtain an information data block of the data block to be read; when the type corresponding to the information data block of the data block to be read is an external chain operation type, the data block to be read is determined as the target data block.
[0167] Optionally, the processor can be further configured to execute the following steps by using the computer program:
[0168] The length of the unread data in the data block to be read is determined; when the length of the unread data is less than the length recorded in the information data block of the data block to be read, the data block to be read is determined as a residual data block; the unread data in the residual data block and the unread data in the next unread data block are integrated to obtain an integrated data block to be read.
[0169] Optionally, the processor can be further configured to execute the following steps by using the computer program:
[0170] When the length of the unread data is greater than the length recorded in the information data block of the data block to be read, the data block to be read is parsed to obtain an information data block of the data block to be read.
[0171] Optionally, the processor can be further configured to execute the following steps by using the computer program:
[0172] The data type of the data contained in the data block to be read is determined according to the information data block of the data block to be read; when the data type is a first type, the first data is read, wherein the first type represents that the content data block of the data block to be read contains a sub data block, the first data is the data of the first preset bytes after the information data block corresponding to the data block to be read, and the first data is used to represent the operation type corresponding to the data block to be read; when the operation type contained in the first data is a target type, a first data structure is created, wherein the elements corresponding to the first data structure at least include the target type, the starting position information and the ending position information of the data block to be read, and an empty array; the first data structure is written into the position after the data pointer of the top layer in the target data stack, and the empty array is written into the top layer of the target data stack.
[0173] Optionally, the processor can be further configured to execute the following steps by using the computer program:
[0174] When the operation type contained in the first data is another type, a first position is determined, wherein the another type is a type other than the target type, and the first position is determined by the read position of the first data, the data length corresponding to the data block to be read, and the first preset bytes; the data at the first position is read.
[0175] Optionally, the processor can be further configured to execute the following steps by means of the computer program:
[0176] When the data type is the second type, it is judged whether the data contained in the information data block of the data block to be read is of the external chain operation type, wherein the second type is a type other than the first type.
[0177] Optionally, the processor can be further configured to execute the following steps by means of the computer program:
[0178] When the type corresponding to the information data block of the data block to be read is the external chain operation type, it is determined that the data block to be read is the target data block; the sum of the reading start position, the second preset byte and the length of the content data block corresponding to the target data block is calculated to obtain a second position; data at the second position is read to obtain second data; when the header data corresponding to the second data includes the target header data, the external chain address of the file external chain is determined according to the reading start position, the second preset byte, the length of the second data, the character length of the plurality of null bytes and the character length of the space; a second data structure is created, wherein the elements corresponding to the second data structure at least include the external chain operation type, the start position information of the second data and the end position information of the second data; the second data structure is written into a position after the data pointer of the top layer in the target data stack.
[0179] Optionally, the processor can be further configured to execute the following steps by means of the computer program:
[0180] When the header data corresponding to the second data does not include the target header data, a third position is determined according to the reading start position, the second preset byte and the length of the content data block corresponding to the target data block; data at the third position is read.
[0181] Optionally, the processor can be further configured to execute the following steps by means of the computer program:
[0182] When the type corresponding to the information data block of the data block to be read is the non-external chain operation type, data alignment operation is performed on the data in the content data block corresponding to the target data block to obtain an aligned content data block; a third position is determined according to the reading start position, the second preset byte and the length of the aligned content data block; data at the third position is read.
[0183] In the electronic device of the embodiment, a technical solution of file information reading is provided. A target file generated by a target application in a software project is read, the target file being a binary file composed of multiple data blocks, each data block including at least an information data block and a content data block, wherein the information data block stores at least the type and length of the data stored in the content data block, and a target data block is determined from the multiple data blocks according to the information data block and the content data block included in each data block, wherein the target data block at least stores an address of a file external link, the file external link being a file used to assist in implementing the software project, the external link address of the file external link stored in the content data block corresponding to the target data block is read, the file content corresponding to the file external link is read through the external link address, the purpose of reading the Maya binary file external link information in a text mode is achieved, thereby realizing the technical effect of improving the efficiency and economy of the way of reading the Maya binary file external link information, and further solving the technical problem that the way of reading the Maya binary file external link information provided in the related art lacks efficiency and economy.
[0184] Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present disclosure. As shown in Figure 5 , the electronic device 500 is merely one example and should not be taken as limiting the functionality or use of embodiments of the present disclosure.
[0185] As shown in Figure 5 , the electronic device 500 is in the form of a general computing device. The components of the electronic device 500 can include, but are not limited to, the at least one processor 510, the at least one memory 520, a bus 530 connecting different system components including the memory 520 and the processor 510, and a display 540.
[0186] The memory 520 stores program code that can be executed by the processor 510, so that the processor 510 performs the steps according to various exemplary embodiments of the present disclosure described in the above method part of the present application.
[0187] The memory 520 can include a readable medium in the form of a volatile storage unit, such as a random access memory (RAM) 5201 and / or a cache memory 5202, and can further include a read-only memory (ROM) 5203, and can also include a non-volatile memory such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories.
[0188] In some examples, the memory 520 can also include a programs / utilities 5204 having a set of one or more program modules 5205, such as an operating system, one or more application programs, other program modules, and program data, and each or a combination thereof can include an implementation of a network environment. The memory 520 can further include memory that is remote from the processor 510, which can be connected to the electronic device 500 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0189] The bus 530 can be one or more of several types of bus structures including a memory bus or memory controller, a peripheral bus, a graphics bus, a processor or local bus using any of a variety of bus architectures.
[0190] The display 540 can be, for example, a liquid crystal display (LCD) that is touch screen type, which can enable a user to interact with a user interface of the electronic device 500.
[0191] Optionally, the electronic device 500 can also communicate with one or more external devices 600 such as a keyboard or a pointing device, a Bluetooth device, etc., and can communicate with one or more devices that enable a user to interact with the electronic device 500 and / or any devices (e.g., a router, a modem, etc.) that enable the electronic device 500 to communicate with one or more other computing devices. Such communication can occur via an input / output (I / O) interface 550. Still yet, the electronic device 500 can communicate with one or more networks such as a local area network (LAN), a wide area network (WAN), and / or the Internet through a network adapter 560. As Figure 5 illustrated, the network adapter 560 can communicate with the other components of the electronic device 500 through the bus 530. It should be appreciated that although the network adapter 560 is illustrated as a separate component, the network Figure 5 microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data archival storage systems, etc.
[0192] The electronic device 500 described above can also include a keyboard, a cursor control device (e.g., a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.
[0193] Those of ordinary skill in the art can understand, Figure 5 The structure shown is merely an example and does not limit the structure of the electronic device described above. For example, the electronic device 500 can also include more or fewer components than those shown in FIG. 5. For example, the electronic device 500 can include a plurality of processors 510 and a plurality of memories 520.Figure 5 more or less components than shown, or configured differently from that shown in the drawings. The memory 520 can be used to store computer programs and corresponding data, such as the computer program and corresponding data of the file information reading method in the embodiments of the present disclosure. The processor 510 performs various functional applications and data processing by running the computer program stored in the memory 520, that is, implements the file information reading method described above.
[0194] The serial numbers of the embodiments of the present disclosure described above are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0195] In the above-described embodiments of the present disclosure, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0196] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0197] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment scheme.
[0198] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0199] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present disclosure, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in the various embodiments of the present disclosure. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, etc.
[0200] The above is only the preferred embodiment of the present disclosure, and it should be pointed out that, for those skilled in the art, without departing from the principles of the present disclosure, a number of improvements and refinements can be made, and these improvements and refinements should also be considered as the protection scope of the present disclosure.
Claims
1. A method of reading file information, characterized by, The method comprises: reading a target file, wherein the target file is a binary file composed of a plurality of data blocks, each data block comprising at least an information data block and a content data block, the information data block storing at least the type and length of the data stored in the content data block; determining a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block, wherein the target data block stores at least an outlink address of a file outlink; reading the outlink address of the file outlink stored in the content data block corresponding to the target data block; reading the file content corresponding to the file outlink through the outlink address; wherein reading the outlink address of the file outlink stored in the content data block corresponding to the target data block comprises: when the type corresponding to the information data block of the data block to be read is an outlink operation type, determining that the data block to be read is the target data block; calculating the sum of the reading start position, the second preset byte and the length of the content data block corresponding to the target data block to obtain a second position; reading the data at the second position to obtain second data; when the header data corresponding to the second data comprises target header data, determining the outlink address of the file outlink according to the reading start position, the second preset byte, the length of the second data, the character length of a plurality of null bytes and the character length of a space; creating a second data structure, wherein the elements corresponding to the second data structure comprise at least the outlink operation type, the start position information of the second data and the end position information of the second data; and writing the second data structure into the position after the data pointer at the top layer in the target data stack.
2. The method of claim 1, wherein, Determining a target data block from the plurality of data blocks according to the information data block and the content data block contained in each data block comprises: determining the reading start position of the data contained in the target file; determining the data block to be read from the plurality of data blocks according to the reading start position; performing parsing processing on the data block to be read to obtain the information data block of the data block to be read; when the type corresponding to the information data block of the data block to be read is an outlink operation type, determining that the data block to be read is the target data block.
3. The method of claim 2, wherein, After determining the data block to be read from the plurality of data blocks according to the reading start position, the method further comprises: determining the length of the unread data in the data block to be read; when the length of the unread data is less than the length recorded in the information data block of the data block to be read, determining that the data block to be read is a residual data block; performing integration processing on the unread data in the residual data block and the unread data in the next data block to be read to obtain an integrated data block to be read.
4. The method of claim 3, wherein, After determining the length of the unread data in the data block to be read, the method further comprises: when the length of the unread data is greater than the length recorded in the information data block of the data block to be read, performing parsing processing on the data block to be read to obtain the information data block of the data block to be read.
5. The method according to claim 2 or 4, characterized in that, After the information data block of the to-be-read data block is parsed to obtain the information data block of the to-be-read data block, the method further comprises: determining a data type of data contained in the to-be-read data block according to the information data block of the to-be-read data block; when the data type is a first type, reading first data, wherein the first type represents that a sub data block is contained in a content data block of the to-be-read data block, the first data is data of a first preset byte after an information data block corresponding to the to-be-read data block, and the first data is used to represent an operation type corresponding to the to-be-read data block; when the operation type contained in the first data is a target type, creating a first data structure, wherein elements corresponding to the first data structure at least include the target type, starting position information and ending position information of the to-be-read data block, and an empty array; writing the first data structure into a position after a data pointer of a top layer in a target data stack, and writing the empty array into the top layer of the target data stack.
6. The method of claim 5, wherein, After the first data is read, the method further comprises: when the operation type contained in the first data is another type, determining a first position, wherein the another type is a type other than the target type, and the first position is determined by a reading position of the first data, a data length corresponding to the to-be-read data block, and the first preset byte; reading data at the first position.
7. The method of claim 5, wherein, After the data type of the data contained in the to-be-read data block is determined according to the information data block of the to-be-read data block, the method further comprises: when the data type is a second type, judging whether the data type of data contained in the information data block of the to-be-read data block is the external chain operation type, wherein the second type is a type other than the first type.
8. The method of claim 1, wherein, After the data at the second position is read to obtain second data, the method further comprises: when the header data corresponding to the second data does not include the target header data, determining a third position according to the reading starting position, the second preset byte, and a length of a content data block corresponding to the target data block; reading data at the third position.
9. The method of claim 7, wherein, The external chain address of the file external chain stored in the content data block corresponding to the target data block is read, comprising: when the type corresponding to the information data block of the to-be-read data block is a non-external chain operation type, performing a data alignment operation on data in the content data block corresponding to the target data block to obtain an aligned content data block; determining a third position according to the reading starting position, the second preset byte, and the length of the aligned content data block; reading data at the third position.
10. A file information reading apparatus characterized by comprising: The file information reading device comprises: a first reading module configured to read a target file, wherein the target file is a binary file composed of a plurality of data blocks, each data block at least includes an information data block and a content data block, and the information data block at least stores a type and a length of data stored in the content data block; determining a target data block from the plurality of data blocks according to an information data block and a content data block contained in each data block, wherein the target data block at least stores an outlink address of a file outlink; a second reading module, configured to read the outlink address of the file outlink stored in the content data block corresponding to the target data block; a third reading module, configured to read file content corresponding to the file outlink through the outlink address; wherein the second reading module is further configured to: determine the to-be-read data block as the target data block when a type corresponding to an information data block of the to-be-read data block is an outlink operation type; calculate a sum of a reading start position, a second preset byte, and a length of the content data block corresponding to the target data block to obtain a second position; read data at the second position to obtain second data; determine the outlink address of the file outlink according to the reading start position, the second preset byte, a length of the second data, a character length of a plurality of null bytes, and a character length of a space when header data corresponding to the second data includes target header data; create a second data structure, wherein elements corresponding to the second data structure at least include the outlink operation type, start position information of the second data, and end position information of the second data; and write the second data structure into a position after a data pointer of a top layer in a target data stack.
11. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein the computer program is configured to be run by the processor to execute the file information reading method in any one of claims 1 to 9. 12.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to run the computer program to execute the file information reading method in any one of claims 1 to 9.
Citation Information
Patent Citations
Serial query method and system for block chain with corrigenda outside block chain
CN107391557A
External link file reading method and device, computer equipment and storage medium
CN114691623A