Mercurial Hosting > luan
diff core/src/luan/modules/RpcLuan.java @ 754:1a101ac9ea46
add lucene restore
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 17 Jul 2016 19:21:52 -0600 |
parents | 4b8695f1cfc4 |
children | c29d11d675fd |
line wrap: on
line diff
--- a/core/src/luan/modules/RpcLuan.java Fri Jul 15 17:35:50 2016 -0600 +++ b/core/src/luan/modules/RpcLuan.java Sun Jul 17 19:21:52 2016 -0600 @@ -5,6 +5,7 @@ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.InputStreamReader; +import java.io.FilterInputStream; import java.io.IOException; import java.io.EOFException; import java.net.Socket; @@ -76,12 +77,13 @@ } catch(LuanException e) { writeBoolean(out,false); writeString(out,e.getFullMessage()); + out.flush(); return; } writeBoolean(out,true); writeObjs(out,luan,rtn); + out.flush(); } finally { - out.flush(); socket.close(); } } @@ -267,12 +269,12 @@ if(this.close) close.b = false; } - private void close() throws IOException { - if(close) in.close(); - } - @Override public InputStream inputStream() { - return in; + return new FilterInputStream(in) { + @Override public void close() throws IOException { + if(close) super.close(); + } + }; } @Override public String to_string() { @@ -283,18 +285,6 @@ throw new UnsupportedOperationException(); } - @Override public String read_text() throws IOException { - String rtn = Utils.readAll(new InputStreamReader(in)); - close(); - return rtn; - } - - @Override public byte[] read_binary() throws IOException { - byte[] rtn = Utils.readAll(in); - close(); - return rtn; - } - @Override public boolean exists() { return true; }