[wp_ad_camp_1]
Runing the codes on Create TAR Files Using Apache Ant API, the following exception may be thrown when processing a file still being appended or modified.
1 2 3 4 | request to write '1024' bytes exceeds size in header of '-2088094749' bytes java.io.IOException: request to write '1024' bytes exceeds size in header of '-2 088094749' bytes |
To reproduce the similar issue, create a non-empty file referred to by the path variable.
1 2 3 4 | String path = "C:/<somewhere>/playground/files/a.txt"; list.add(path); ... |
Upon seeing the lines below displayed on the console, update the contents of the file immediately.
1 2 | Thread is sleeping. You may now append the file. |
After 10 seconds, the exception is thrown from the console.
[wp_ad_camp_2]
What exactly happened? Let us say on the first reading, the codes determine the file size is 7 kB. However, after the file update, right before the second file read, the file size changes. Thus, the IOException exception.
[wp_ad_camp_3]