LongArrayList p = new LongArrayList();
pointers = new ObjectArrayList<EliasFanoMonotoneLongBigList>( file.length );
firstDocument = new int[ file.length + 1 ];
int count = 0;
final ProgressLogger pl = new ProgressLogger( LOGGER );
pl.expectedUpdates = file.length;
pl.itemsName = "files";
pl.start( "Scanning files..." );
// Scan files and retrieve page pointers
for( String f : file ) {
p.clear();
final FastBufferedInputStream fbis = gzipped ? new FastBufferedInputStream( new GZIPInputStream( new FileInputStream( f ) ) ) : new FastBufferedInputStream( new FileInputStream( f ) );
long position;
for(;;) {
position = fbis.position();
if ( readLine( fbis ) == -1 ) break;
if ( startsWith( lineBuffer, DOC_MARKER ) ) p.add( position );
if ( phrase && startsWith( lineBuffer, SENTENCE_MARKER ) ) p.add( position );
}
count += p.size();
p.add( fbis.position() );
fbis.close();
pointers.add( new EliasFanoMonotoneLongBigList( p ) );
firstDocument[ pointers.size() ] = count;
pl.update();
}
pl.done();
size = count;
}