Mercurial Hosting > luan
comparison src/goodjava/lucene/logging/LogOutputStream.java @ 1557:117ce8645b7f
lucene logging - add long string
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Sun, 11 Oct 2020 18:29:58 -0600 |
| parents | 2469aa31f31b |
| children | a8b07b312bfb |
comparison
equal
deleted
inserted
replaced
| 1556:52241b69c339 | 1557:117ce8645b7f |
|---|---|
| 1 package goodjava.lucene.logging; | 1 package goodjava.lucene.logging; |
| 2 | 2 |
| 3 import java.io.OutputStream; | 3 import java.io.OutputStream; |
| 4 import java.io.DataOutputStream; | 4 import goodjava.io.DataOutputStream; |
| 5 import java.io.RandomAccessFile; | 5 import java.io.RandomAccessFile; |
| 6 import java.io.IOException; | 6 import java.io.IOException; |
| 7 import java.util.List; | 7 import java.util.List; |
| 8 import java.util.Map; | 8 import java.util.Map; |
| 9 import org.apache.lucene.index.Term; | 9 import org.apache.lucene.index.Term; |
| 52 if( obj==null ) { | 52 if( obj==null ) { |
| 53 writeByte(LogFile.TYPE_NULL); | 53 writeByte(LogFile.TYPE_NULL); |
| 54 return; | 54 return; |
| 55 } | 55 } |
| 56 if( obj instanceof String ) { | 56 if( obj instanceof String ) { |
| 57 writeByte(LogFile.TYPE_STRING); | 57 String s = (String)obj; |
| 58 writeUTF((String)obj); | 58 if( s.length() <= 65535 ) { |
| 59 writeByte(LogFile.TYPE_STRING); | |
| 60 writeUTF(s); | |
| 61 } else { | |
| 62 writeByte(LogFile.TYPE_LONG_STRING); | |
| 63 writeString(s); | |
| 64 } | |
| 59 return; | 65 return; |
| 60 } | 66 } |
| 61 if( obj instanceof Integer ) { | 67 if( obj instanceof Integer ) { |
| 62 writeByte(LogFile.TYPE_INT); | 68 writeByte(LogFile.TYPE_INT); |
| 63 writeInt((Integer)obj); | 69 writeInt((Integer)obj); |
