I am using java to read a TSV file that is 4gb in size and i wanted to know if there is a way for java to tell me how far it is through the task as the program is running. I’m thinking file stream might be able to tell me how many bytes it has read and i could do some simple math with that.
Share
A plain stream or reader doesn’t count the number of bytes / characters read.
I think you might be looking for
ProgressMonitorInputStream.If you don’t want / need the Swing integration, then another alternative is
to write a custom subclass of FilterReader or FilterInputStream that counts the characters/bytes read and provides a getter for reading the count. Then put the custom class into your input stack at the appropriate point.