question: public ReliableLog ( String dirPath , LogHandler handler ) throws IOException { dir = new File ( dirPath ) ; if ( ! ( dir . exists ( ) ? dir . isDirectory ( ) : dir . mkdirs ( ) ) ) { throw new LogException ( "could not create directory for log: " + dirPath ) ; } this . handler = handler ; try { DataInputStream in = new DataInputStream ( new FileInputStream ( fName ( versionFile ) ) ) ; try { version = in . readInt ( ) ; } finally { in . close ( ) ; } } catch ( IOException ex ) { writeVersionFile ( ) ; } if ( version < 0 ) { throw new LogException ( "corrupted version file" ) ; } }
target:  Creates a ReliableLog to handle snapshots and logging in a stable storage directory, and sets up to recover any existing data from the stable storage directory. If there is no existing data, snapshot must be called next, otherwise recover must be called next.