aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--java/com/xagasoft/gats/GatsObject.java5
-rw-r--r--java/com/xagasoft/gats/GatsString.java10
-rwxr-xr-xpython/test.py4
3 files changed, 12 insertions, 7 deletions
diff --git a/java/com/xagasoft/gats/GatsObject.java b/java/com/xagasoft/gats/GatsObject.java
index fc3fb5a..47602b3 100644
--- a/java/com/xagasoft/gats/GatsObject.java
+++ b/java/com/xagasoft/gats/GatsObject.java
@@ -43,7 +43,8 @@ public abstract class GatsObject
43 */ 43 */
44 static GatsObject read( InputStream is ) throws java.io.IOException 44 static GatsObject read( InputStream is ) throws java.io.IOException
45 { 45 {
46 char type = (char)is.read(); 46 int b = is.read();
47 char type = (char)b;
47 GatsObject goRet = null; 48 GatsObject goRet = null;
48 switch( type ) 49 switch( type )
49 { 50 {
@@ -77,7 +78,7 @@ public abstract class GatsObject
77 return null; 78 return null;
78 79
79 default: 80 default:
80 throw new java.io.IOException("Invalid gats type discovered: " + (char)type ); 81 throw new java.io.IOException("Invalid gats type discovered: " + type + ", (" + b + ")" );
81 } 82 }
82 83
83 goRet.read( is, type ); 84 goRet.read( is, type );
diff --git a/java/com/xagasoft/gats/GatsString.java b/java/com/xagasoft/gats/GatsString.java
index e119aec..8e5c5c0 100644
--- a/java/com/xagasoft/gats/GatsString.java
+++ b/java/com/xagasoft/gats/GatsString.java
@@ -59,9 +59,13 @@ public class GatsString extends GatsObject
59 59
60 void read( InputStream is, char cType ) throws java.io.IOException 60 void read( InputStream is, char cType ) throws java.io.IOException
61 { 61 {
62 long lSize = GatsInteger.readPackedInt( is ); 62 int lSize = (int)GatsInteger.readPackedInt( is );
63 aValue = new byte[(int)lSize]; 63 aValue = new byte[lSize];
64 is.read( aValue ); 64 int lRead = 0;
65 do
66 {
67 lRead += is.read( aValue, lRead, lSize-lRead );
68 } while( lRead < lSize );
65 } 69 }
66 70
67 void write( OutputStream os ) throws java.io.IOException 71 void write( OutputStream os ) throws java.io.IOException
diff --git a/python/test.py b/python/test.py
index 14e8306..f4e679a 100755
--- a/python/test.py
+++ b/python/test.py
@@ -2,9 +2,9 @@
2 2
3import gats 3import gats
4 4
5#print gats.load( open('test.gats', 'rb') ) 5print gats.load( open('test.gats', 'rb') )
6 6
7#gats.dump( 3.14159, open('out.gats', 'wb') ) 7gats.dump( 3.14159, open('out.gats', 'wb') )
8 8
9print gats.loads( 9print gats.loads(
10 gats.dumps( 10 gats.dumps(