在一个文件中创建多个数据类型并覆盖其中的内容 [英] Create multiple data type in just one file and cover the content of it

查看:56
本文介绍了在一个文件中创建多个数据类型并覆盖其中的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的好友:

我想知道您是否可以指导我创建一个文件,该文件仅在一个文件中包含所有数据类型,例如图片,字符串,mp3和MathType方程.

我可以使用rtf格式来执行此操作.但是,这些数据类型的数量巨大,例如仅在一个文件中收集了1000个[字符串,图片,视频和声音],结果读取时间花了很多.

1.最好的方法是什么?

2.有什么方法可以将声音和视频以及方程式转换为计算机语言,以便快速读取数据?

3.我还必须使用用户无法修改或访问或理解文件内容的格式.我应该如何应对这一挑战?


您真诚的
GRACIAS.

解决方案

我的意思是您需要将每个文件部分都写为二进制图像,即从其原始位置以二进制流的形式复制到新文件中.添加每个部分时,将创建一个(属于您自己设计的)索引,其中包含文件的偏移量,长度和任何其他相关信息.将最后一个二进制映像添加到文件后,您可以编写索引(记下其文件偏移量),然后最后将该偏移量位置写入文件,以便在读取时可以找到索引.您的文件将如下所示:

数据文件1(mp3)
数据文件2(txt)
数据文件3(avi)
数据文件4(pdf)
索引
指向索引的指针

索引只是一个表,其中包含指向数据文件的指针.

为了读取任何文件,您只需要找到索引(从文件的最后一个单词开始),获取文件的偏移量和长度,然后从该点开始读取即可.

一种替代解决方案是使用SQL Compact Edition,它将为您提供平等的控制权,但具有一个现成的程序来控制数据的管理,从而使插入,更新和提取工作量最少.

您可以使用类似于PDF文件格式的方法.实际数据(任何类型)都以任何顺序写入文件,但是每个子文件的位置和长度都保存在一个索引中,该索引在完成时写入文件的末尾.然后,您可以从索引访问文件的任何部分,从而可以像读取单独文件一样快地读取它.


Dear Buddies:

I wonder if you could guide me through creating one file that consist of all data type such as picture, string, mp3 and MathType equation in just one file.

I can use the rtf format to do this. However, the number of these data types are enormous for example 1000 collection of [string, pic., video, and sound] in just one file and as a result the time of reading goes to the roof.

1. What is the best approach to do this?

2. Is there any way to convert the sound and video and equations to the language of computer in order to have high speed in reading data?

3. I must also use a format that users cannot modify or access or understanding the content of file. How should I solve this challenge?


YOURS SINCERELY
GRACIAS.

解决方案

I mean that you need to write each file section as a binary image, i.e. copy from its original location as a binary stream, into the new file. As you add each section you create an index (of your own design) which contains the file offset, length, and any other relevant information. After adding the last binary image to your file you then write your index (making a note of its file offset), and then finally write that offset location to the file, so that you can find the index when reading. Your file will then look something like:

Data file 1 (mp3)
Data file 2 (txt)
Data file 3 (avi)
Data file 4 (pdf)
Index
pointer to index

The Index is just a table which contains the pointers to the data files.

In order to read any file you just need to find the index (from the last word in the file), get the offset and length of the file, and read from that point.

An alternative solution would be to use SQL Compact Edition which would give you equal control, but with a ready made program to control the management of your data, allowing insertion, updating and extraction with the minimum amount of work on your part.


You could use something like the approach taken in the format of PDF files. The actual data (of any type) is written to the file in any order, but the location and length of each sub-file is held in an index which is written at the end of the file when it''s complete. You can then access any part of the file from the index which would allow you to read it just as fast as if it were a separate file.


这篇关于在一个文件中创建多个数据类型并覆盖其中的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆