private LzoIndex readIndex ( Path file , FileSystem fs ) throws IOException { FSDataInputStream indexIn = null ; try { Path indexFile = new Path ( file . toString ( ) + LZO_INDEX_SUFFIX ) ; if ( ! fs . exists ( indexFile ) ) { // return empty index, fall back to the unsplittable mode return new LzoIndex ( ) ; } long indexLen = fs . getFileStatus ( indexFile ) . getLen ( ) ; int blocks = ( int ) ( indexLen / 8 ) ; LzoIndex index = new LzoIndex ( blocks ) ; indexIn = fs . open ( indexFile ) ; for ( int i = 0 ; i < blocks ; i ++ ) { index . set ( i , indexIn . readLong ( ) ) ; } return index ; } finally { if ( indexIn != null ) { indexIn . close ( ) ; } } }
Read the index of the lzo file .