Software Development

IOException When Taring a File Still Being Appended

[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.

To reproduce the similar issue, create a non-empty file referred to by the path variable.

Upon seeing the lines below displayed on the console, update the contents of the file immediately.

After 10 seconds, the exception is thrown from the console.

[wp_ad_camp_2]

IOException thrown

IOException thrown

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]

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like