public void read ( ) throws IOException { SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { // Known issue for NFS bases on ext3. Need to refresh directory to read actual data. dir . listAll ( ) ; names . clear ( ) ; indexes . clear ( ) ; if ( dir . fileExists ( name ) ) { // clear current lists InputStream in = new IndexInputStream ( dir . openInput ( name ) ) ; DataInputStream di = null ; try { di = new DataInputStream ( in ) ; counter = di . readInt ( ) ; for ( int i = di . readInt ( ) ; i > 0 ; i -- ) { String indexName = di . readUTF ( ) ; indexes . add ( indexName ) ; names . add ( indexName ) ; } } finally { if ( di != null ) di . close ( ) ; in . close ( ) ; } } return null ; } } ) ; }
Reads the index infos . Before reading it checks if file exists