Mercurial Hosting > luan
changeset 1557:117ce8645b7f
lucene logging - add long string
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 11 Oct 2020 18:29:58 -0600 |
parents | 52241b69c339 |
children | fe5bcd8133e0 |
files | src/goodjava/lucene/logging/LogFile.java src/goodjava/lucene/logging/LogInputStream.java src/goodjava/lucene/logging/LogOutputStream.java |
diffstat | 3 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/goodjava/lucene/logging/LogFile.java Sun Oct 11 17:28:16 2020 -0600 +++ b/src/goodjava/lucene/logging/LogFile.java Sun Oct 11 18:29:58 2020 -0600 @@ -86,4 +86,5 @@ static final int TYPE_QUERY_PHRASE = 13; static final int TYPE_QUERY_NUMERIC_RANGE = 14; static final int TYPE_QUERY_BOOLEAN = 15; + static final int TYPE_LONG_STRING = 16; }
--- a/src/goodjava/lucene/logging/LogInputStream.java Sun Oct 11 17:28:16 2020 -0600 +++ b/src/goodjava/lucene/logging/LogInputStream.java Sun Oct 11 18:29:58 2020 -0600 @@ -1,7 +1,7 @@ package goodjava.lucene.logging; import java.io.InputStream; -import java.io.DataInputStream; +import goodjava.io.DataInputStream; import java.io.IOException; import java.util.List; import java.util.ArrayList; @@ -41,6 +41,8 @@ return null; case LogFile.TYPE_STRING: return readUTF(); + case LogFile.TYPE_LONG_STRING: + return readString(); case LogFile.TYPE_INT: return readInt(); case LogFile.TYPE_LONG:
--- a/src/goodjava/lucene/logging/LogOutputStream.java Sun Oct 11 17:28:16 2020 -0600 +++ b/src/goodjava/lucene/logging/LogOutputStream.java Sun Oct 11 18:29:58 2020 -0600 @@ -1,7 +1,7 @@ package goodjava.lucene.logging; import java.io.OutputStream; -import java.io.DataOutputStream; +import goodjava.io.DataOutputStream; import java.io.RandomAccessFile; import java.io.IOException; import java.util.List; @@ -54,8 +54,14 @@ return; } if( obj instanceof String ) { - writeByte(LogFile.TYPE_STRING); - writeUTF((String)obj); + String s = (String)obj; + if( s.length() <= 65535 ) { + writeByte(LogFile.TYPE_STRING); + writeUTF(s); + } else { + writeByte(LogFile.TYPE_LONG_STRING); + writeString(s); + } return; } if( obj instanceof Integer ) {