Hi,
I would like to know what is the most efficient way to create a very large dummy File in java. The filesize should be just above 1GB. It will be used to unit test a method which only accepts files <= 1GB.
Hi,
I would like to know what is the most efficient way to create a very large dummy File in java. The filesize should be just above 1GB. It will be used to unit test a method which only accepts files <= 1GB.
Can't you make a mock which returns filesize of > 1GB? File IO doesn't sound very unit-testy to me (although that depends on what your idea of a unit test is).
Create a sparse file. That is, open a file, seek to a position above 1GB and write some bytes.
Relevant: Create file with given size in Java