diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-04-27 19:00:13 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-04-27 19:00:13 +0000 |
commit | 09e3102ffba4b9ee11d988f95c04d344790127db (patch) | |
tree | 09cec1f3fe6e38eddffcec17086e0877a974edde | |
parent | 207384f738ebe9dea5170d4ec225f9684d39ee2e (diff) | |
download | libgats-09e3102ffba4b9ee11d988f95c04d344790127db.tar.gz libgats-09e3102ffba4b9ee11d988f95c04d344790127db.tar.bz2 libgats-09e3102ffba4b9ee11d988f95c04d344790127db.tar.xz libgats-09e3102ffba4b9ee11d988f95c04d344790127db.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | java/com/xagasoft/gats/GatsInputStream.java | 20 |
1 files changed, 20 insertions, 0 deletions
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 | |||
@@ -21,6 +21,25 @@ public class GatsInputStream | |||
21 | { | 21 | { |
22 | do | 22 | do |
23 | { | 23 | { |
24 | iVer = is.read(); | ||
25 | } while( iVer == 0 ); | ||
26 | |||
27 | switch( iVer ) | ||
28 | { | ||
29 | case 1: | ||
30 | DataInputStream dis = new DataInputStream( is ); | ||
31 | iSize = dis.readInt(); | ||
32 | return GatsObject.read( is ); | ||
33 | } | ||
34 | |||
35 | return null; | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | public GatsObject readObject() throws java.io.IOException | ||
40 | { | ||
41 | do | ||
42 | { | ||
24 | if( baos.size() < 5 ) | 43 | if( baos.size() < 5 ) |
25 | { | 44 | { |
26 | byte aBuf[] = new byte[5-baos.size()]; | 45 | byte aBuf[] = new byte[5-baos.size()]; |
@@ -97,5 +116,6 @@ public class GatsInputStream | |||
97 | baos.reset(); | 116 | baos.reset(); |
98 | return true; | 117 | return true; |
99 | } | 118 | } |
119 | */ | ||
100 | }; | 120 | }; |
101 | 121 | ||