@ Override public float getProgress ( ) throws IOException { if ( reachedEnd ) return 1 ; else { final long filePos = in . position ( ) ; final long fileEnd = virtualEnd >>> 16 ; // Add 1 to the denominator to make sure it doesn't reach 1 here when // filePos == fileEnd. return ( float ) ( filePos - fileStart ) / ( fileEnd - fileStart + 1 ) ; } }
Unless the end has been reached this only takes file position into account not the position within the block .