是否有可能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.