comparison src/goodjava/lucene/logging/LogFile.java @ 1465:5e3870618377

lucene.logging dir
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 12 Apr 2020 15:59:57 -0600
parents bfbf9c9c1586
children 7d145095cc0b
comparison
equal deleted inserted replaced
1464:465b4a0dae4a 1465:5e3870618377
17 import org.apache.lucene.search.PhraseQuery; 17 import org.apache.lucene.search.PhraseQuery;
18 import org.apache.lucene.search.NumericRangeQuery; 18 import org.apache.lucene.search.NumericRangeQuery;
19 import org.apache.lucene.search.BooleanQuery; 19 import org.apache.lucene.search.BooleanQuery;
20 import org.apache.lucene.search.BooleanClause; 20 import org.apache.lucene.search.BooleanClause;
21 import org.apache.lucene.util.BytesRef; 21 import org.apache.lucene.util.BytesRef;
22 import goodjava.logging.Logger;
23 import goodjava.logging.LoggerFactory;
22 24
23 25
24 public class LogFile extends RandomAccessFile { 26 public class LogFile extends RandomAccessFile {
27 private static final Logger logger = LoggerFactory.getLogger(LogFile.class);
28 public final File file;
25 private long end; 29 private long end;
26 30
27 public LogFile(File file,String mode) throws IOException { 31 public LogFile(File file,String mode) throws IOException {
28 super(file,mode); 32 super(file,mode);
29 init(); 33 this.file = file;
30 }
31
32 public LogFile(String file,String mode) throws IOException {
33 super(file,mode);
34 init(); 34 init();
35 } 35 }
36 36
37 private void init() throws IOException { 37 private void init() throws IOException {
38 if( length() == 0 ) { 38 if( length() == 0 ) {
41 } else { 41 } else {
42 seek(0L); 42 seek(0L);
43 end = readLong(); 43 end = readLong();
44 gotoEnd(); 44 gotoEnd();
45 } 45 }
46 }
47
48 public String toString() {
49 return "LogFile<" + file.getName() + ">";
46 } 50 }
47 51
48 public void gotoStart() throws IOException { 52 public void gotoStart() throws IOException {
49 seek(8L); 53 seek(8L);
50 } 54 }