From 09e3102ffba4b9ee11d988f95c04d344790127db Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 27 Apr 2011 19:00:13 +0000 Subject: The GatsInputStream is much, much simpler, should be much faster, and works more like java says blocking things should work. If you ask it to read an object, it will, it will wait on the socket until it gets a whole one, or throws an exception. --- java/com/xagasoft/gats/GatsInputStream.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'java/com/xagasoft/gats') diff --git a/java/com/xagasoft/gats/GatsInputStream.java b/java/com/xagasoft/gats/GatsInputStream.java index 8eac738..5cd830d 100644 --- a/java/com/xagasoft/gats/GatsInputStream.java +++ b/java/com/xagasoft/gats/GatsInputStream.java @@ -17,6 +17,25 @@ public class GatsInputStream this.is = is; } + public GatsObject readObject() throws java.io.IOException + { + do + { + iVer = is.read(); + } while( iVer == 0 ); + + switch( iVer ) + { + case 1: + DataInputStream dis = new DataInputStream( is ); + iSize = dis.readInt(); + return GatsObject.read( is ); + } + + return null; + } + + /* public GatsObject readObject() throws java.io.IOException { do @@ -97,5 +116,6 @@ public class GatsInputStream baos.reset(); return true; } + */ }; -- cgit v1.2.3