aboutsummaryrefslogtreecommitdiff
path: root/java/com/xagasoft/gats/GatsInputStream.java
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-04-21 17:40:13 +0000
committerMike Buland <eichlan@xagasoft.com>2011-04-21 17:40:13 +0000
commit4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa (patch)
tree138b749f3e209d61a63abd1258947850404ca87d /java/com/xagasoft/gats/GatsInputStream.java
parent49216a230c331791b06df1527c3245c88e991c20 (diff)
downloadlibgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.gz
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.bz2
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.xz
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.zip
It...builds?
Diffstat (limited to 'java/com/xagasoft/gats/GatsInputStream.java')
-rw-r--r--java/com/xagasoft/gats/GatsInputStream.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/java/com/xagasoft/gats/GatsInputStream.java b/java/com/xagasoft/gats/GatsInputStream.java
index e787d56..e1c4781 100644
--- a/java/com/xagasoft/gats/GatsInputStream.java
+++ b/java/com/xagasoft/gats/GatsInputStream.java
@@ -2,6 +2,7 @@ package com.xagasoft.gats;
2 2
3import java.io.InputStream; 3import java.io.InputStream;
4import java.io.ByteArrayOutputStream; 4import java.io.ByteArrayOutputStream;
5import java.io.ByteArrayInputStream;
5import java.io.DataInputStream; 6import java.io.DataInputStream;
6 7
7public class GatsInputStream 8public class GatsInputStream
@@ -16,7 +17,7 @@ public class GatsInputStream
16 this.is = is; 17 this.is = is;
17 } 18 }
18 19
19 public GatsObject readObject() 20 public GatsObject readObject() throws java.io.IOException
20 { 21 {
21 do 22 do
22 { 23 {
@@ -24,7 +25,7 @@ public class GatsInputStream
24 { 25 {
25 byte aBuf[] = new byte[5-baos.size()]; 26 byte aBuf[] = new byte[5-baos.size()];
26 int iRead = is.read( aBuf ); 27 int iRead = is.read( aBuf );
27 baos.write( ret, iRead ); 28 baos.write( aBuf, 0, iRead );
28 29
29 if( baos.size() < 5 ) 30 if( baos.size() < 5 )
30 return null; 31 return null;
@@ -36,7 +37,7 @@ public class GatsInputStream
36 ByteArrayInputStream bais = new ByteArrayInputStream( 37 ByteArrayInputStream bais = new ByteArrayInputStream(
37 baos.toByteArray() 38 baos.toByteArray()
38 ); 39 );
39 DataInputStream dis( bais ); 40 DataInputStream dis = new DataInputStream( bais );
40 iVer = dis.readUnsignedByte(); 41 iVer = dis.readUnsignedByte();
41 iSize = dis.readInt(); 42 iSize = dis.readInt();
42 } 43 }
@@ -49,7 +50,7 @@ public class GatsInputStream
49 iGoal = 1500; 50 iGoal = 1500;
50 51
51 int iRead = is.read( aBuf ); 52 int iRead = is.read( aBuf );
52 baos.write( abuf, 0, iRead ); 53 baos.write( aBuf, 0, iRead );
53 54
54 if( iRead < iGoal ) 55 if( iRead < iGoal )
55 return null; 56 return null;
@@ -63,14 +64,13 @@ public class GatsInputStream
63 ); 64 );
64 bais.skip( 5 ); 65 bais.skip( 5 );
65 66
66 GatsObject goRet = GatsObject::read( bais ); 67 GatsObject goRet = GatsObject.read( bais );
67 iVer = 0; 68 iVer = 0;
68 69
69 return goRet; 70 return goRet;
70 } 71 }
71 72
72 73 private boolean skipReadNulls()
73 private bool skipReadNulls()
74 { 74 {
75 if( baos.size() == 0 ) 75 if( baos.size() == 0 )
76 return false; 76 return false;
@@ -79,17 +79,17 @@ public class GatsInputStream
79 if( aBuf[0] != 0 ) 79 if( aBuf[0] != 0 )
80 return true; 80 return true;
81 81
82 for( int j = 1; j < aBuf.size; j++ ) 82 for( int j = 1; j < aBuf.length; j++ )
83 { 83 {
84 if( aBuf[j] != 0 ) 84 if( aBuf[j] != 0 )
85 { 85 {
86 baos.clear(); 86 baos.reset();
87 baos.write( aBuf, j, aBuf.size-j ); 87 baos.write( aBuf, j, aBuf.length-j );
88 return true; 88 return true;
89 } 89 }
90 } 90 }
91 91
92 baos.clear(); 92 baos.reset();
93 return true; 93 return true;
94 } 94 }
95}; 95};