分割两个合并的文件 [英] Split Two Merged Files

查看:73
本文介绍了分割两个合并的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我将两个文件合并到一个文件中

 '  ================= ================ 
' 在文件中合并两个文件
My.Computer.FileSystem.WriteAllBytes(" ,My.Computer.FileSystem .ReadAllBytes(" ), True )
My.Computer.FileSystem.WriteAllBytes(" ,My.Computer.FileSystem .ReadAllBytes(" ),)
'  ========================== ======== 



现在,我如何拆分此合并文件
您是否更好地合并和分割文件
Thanx

解决方案

在没有某种引用的情况下很难做到一个文件的开始和结束(您将不得不遍历字节并知道每个文件的格式,区分一个文件的开头).

尝试首先使用此指针信息放置自己的标题.



或者,您可以使用Zip文件格式并进行压缩而不存储: http://zipstorer.codeplex.com/ [文件计数(int32) 重复文件数据长度(int64).

每个文件都会有一个标头:

文件名长度(整数32)
文件名(字符数可变,无路径)
校验和(大小取决于选择的类型)
文件数据

标题大小将包含在标题列表的文件数据长度"中.

起初还要做很多工作,但是会节省很多时间!


查看以下文章,这将帮助您解决问题.

如何拆分和合并两个文件


hi i merged two file in a file

 '=================================
'Merge Two Files in a File
My.Computer.FileSystem.WriteAllBytes("e:\a.jpg", My.Computer.FileSystem.ReadAllBytes("Penguins.jpg"), True)
My.Computer.FileSystem.WriteAllBytes("e:\a.jpg", My.Computer.FileSystem.ReadAllBytes("One Republic.mpg"), True)
'=================================



now , how i can split this Merged Files
Do you better way Merge and Split Files
Thanx

解决方案

Very hard to do without some kind of reference where one file starts and ends ( you will have to go through the bytes and know the format of each file to distinguish the start of one file).

Try putting your own header first with this pointer information.

EDIT:

Alternatively you can use the Zip file format and store without compression : http://zipstorer.codeplex.com/[^]


With a lot of difficulty.
I''m not well versed in the internals of JPG file format, but your only hope of pulling the two files apart is to parse the JPG file until you have the entire thing, and then the rest is a MPG. You will need to check this, in case a JPG can have padding bytes to make it a multiple of some number of bytes - it is possible and may depend on the application which originally produced the file.

I just wouldn''t do it that way. Instead, I would make the composite file a container, by starting it with a list of files:

Files count (int32)
File data length (int64) repeated.

Each file would then have a header:

Filename length (int 32)
Filename (variable number of chars, no path)
Checksum (size depends on type chosen)
File data

The header size would be included in the File Data Length in the header list.

It''s a little more work to do in the start, but it would save so much time later!


Check out the following artical.It will help you to solve your problem.

How to Split and Merge Two Files


这篇关于分割两个合并的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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