是否有可能prePEND数据到一个文件,而无需重写? [英] Is it possible to prepend data to an file without rewriting?

查看:97
本文介绍了是否有可能prePEND数据到一个文件,而无需重写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理的非常大的二进制文件(几个GB到每个文件的多个TB)。这些文件在遗留格式存在升级需要编写一个报头添加到文件的前部。我可以创建一个新的文件,重写数据,但有时这可能需要很长的时间。我不知道是否有完成这个升级的更快的方法。该平台仅限于Linux和我愿意使用低级别的功能(ASM,C,C ++)/文件系统技巧来做到这一点。该primimary库是Java和JNI是完全可以接受的。

I deal with very large binary files ( several GB to multiple TB per file ). These files exist in a legacy format and upgrading requires writing a header to the FRONT of the file. I can create a new file and rewrite the data but sometimes this can take a long time. I'm wondering if there is any faster way to accomplish this upgrade. The platform is limited to Linux and I'm willing to use low-level functions (ASM, C, C++) / file system tricks to make this happen. The primimary library is Java and JNI is completely acceptable.

推荐答案

有对本地执行此操作的一般方法。

There's no general way to do this natively.

也许有些文件系统提供了一些功能来做到这一点(不能给这个任何暗示),但那么你的code将文件系统相关的。

Maybe some file-systems provide some functions to do this (cannot give any hint about this), but your code will then be file-system dependent.

一个解决方案可能是中的模拟的文件系统:你可以存储一组的几个文件的数据,然后提供一些功能来打开,读取和,如果它是写入数据一个单一的文件。

A solution could be that of simulating a file-system: you could store your data on a set of several files, and then provide some functions to open, read and write data as if it was a single file.

这篇关于是否有可能prePEND数据到一个文件,而无需重写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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