1 8 9 package com.sleepycat.je.log; 10 11 import java.io.IOException ; 12 import java.nio.ByteBuffer ; 13 14 import com.sleepycat.je.DatabaseException; 15 import com.sleepycat.je.dbi.EnvironmentImpl; 16 import com.sleepycat.je.log.entry.LogEntry; 17 import com.sleepycat.je.utilint.DbLsn; 18 19 22 public class SearchFileReader extends FileReader { 23 24 private LogEntryType targetType; 25 private LogEntry logEntry; 26 27 30 public SearchFileReader(EnvironmentImpl env, 31 int readBufferSize, 32 boolean forward, 33 long startLsn, 34 long endOfFileLsn, 35 LogEntryType targetType) 36 throws IOException , DatabaseException { 37 38 super(env, readBufferSize, forward, startLsn, null, 39 endOfFileLsn, DbLsn.NULL_LSN); 40 41 this.targetType = targetType; 42 logEntry = targetType.getNewLogEntry(); 43 } 44 45 48 protected boolean isTargetEntry(byte logEntryTypeNumber, 49 byte logEntryTypeVersion) { 50 return (targetType.equalsType(logEntryTypeNumber, 51 logEntryTypeVersion)); 52 } 53 54 57 protected boolean processEntry(ByteBuffer entryBuffer) 58 throws DatabaseException { 59 60 logEntry.readEntry(entryBuffer, currentEntrySize, 61 currentEntryTypeVersion, true); 62 return true; 63 } 64 65 68 public Object getLastObject() { 69 return logEntry.getMainItem(); 70 } 71 } 72 | Popular Tags |