public void load ( File file ) throws IOException { _entryFile = file ; Chronos c = new Chronos ( ) ; ChannelReader in = new ChannelReader ( file ) ; try { in . open ( ) ; // Read entry head long fileVersion = in . readLong ( ) ; if ( fileVersion != STORAGE_VERSION ) { throw new RuntimeException ( "Wrong storage version " + fileVersion + " encounted in " + file . getAbsolutePath ( ) + ". Version " + STORAGE_VERSION + " expected." ) ; } long minScnHead = in . readLong ( ) ; long maxScnHead = in . readLong ( ) ; int length = in . readInt ( ) ; // Read entry body loadDataSection ( in , length ) ; // Read entry tail long minScnTail = in . readLong ( ) ; long maxScnTail = in . readLong ( ) ; if ( minScnHead != minScnTail ) { throw new IOException ( "min scns don't match: " + minScnHead + " vs " + minScnTail ) ; } if ( maxScnHead != maxScnTail ) { throw new IOException ( "max scns don't match:" + maxScnHead + " vs " + maxScnTail ) ; } _minScn = minScnHead ; _maxScn = maxScnHead ; if ( _log . isInfoEnabled ( ) ) { _log . info ( "loaded entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size ( ) + " file=" + file . getName ( ) + " in " + c . getElapsedTime ( ) ) ; } } finally { in . close ( ) ; } }
Loads an entry from a given file .