diff options
Diffstat (limited to '')
-rw-r--r-- | java/com/xagasoft/gats/GatsObject.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/java/com/xagasoft/gats/GatsObject.java b/java/com/xagasoft/gats/GatsObject.java index 63fcf36..852a18c 100644 --- a/java/com/xagasoft/gats/GatsObject.java +++ b/java/com/xagasoft/gats/GatsObject.java | |||
@@ -1,6 +1,7 @@ | |||
1 | package com.xagasoft.gats; | 1 | package com.xagasoft.gats; |
2 | 2 | ||
3 | import java.io.InputStream; | 3 | import java.io.InputStream; |
4 | import java.io.OutputStream; | ||
4 | 5 | ||
5 | public abstract class GatsObject | 6 | public abstract class GatsObject |
6 | { | 7 | { |
@@ -13,45 +14,45 @@ public abstract class GatsObject | |||
13 | 14 | ||
14 | public abstract int getType(); | 15 | public abstract int getType(); |
15 | 16 | ||
16 | public abstract void read( InputStream is, char cType ); | 17 | public abstract void read( InputStream is, char cType ) throws java.io.IOException; |
17 | 18 | ||
18 | public static GatsObject read( InputStream is ) | 19 | public static GatsObject read( InputStream is ) throws java.io.IOException |
19 | { | 20 | { |
20 | char type = is.read(); | 21 | char type = (char)is.read(); |
21 | GatsObject goRet; | 22 | GatsObject goRet = null; |
22 | switch( type ) | 23 | switch( type ) |
23 | { | 24 | { |
24 | case 'i': | 25 | case 'i': |
25 | goRet = new Integer(); | 26 | goRet = new GatsInteger(); |
26 | break; | 27 | break; |
27 | 28 | ||
28 | case 's': | 29 | case 's': |
29 | goRet = new String(); | 30 | // goRet = new GatsString(); |
30 | break; | 31 | break; |
31 | 32 | ||
32 | case '0': | 33 | case '0': |
33 | case '1': | 34 | case '1': |
34 | goRet = new Boolean(); | 35 | // goRet = new GatsBoolean(); |
35 | break; | 36 | break; |
36 | 37 | ||
37 | case 'l': | 38 | case 'l': |
38 | goRet = new List(); | 39 | // goRet = new GatsList(); |
39 | break; | 40 | break; |
40 | 41 | ||
41 | case 'd': | 42 | case 'd': |
42 | goRet = new Dictionary(); | 43 | // goRet = new GatsDictionary(); |
43 | break; | 44 | break; |
44 | 45 | ||
45 | case 'f': | 46 | case 'f': |
46 | case 'F': | 47 | case 'F': |
47 | goRet = new Float(); | 48 | // goRet = new GatsFloat(); |
48 | break; | 49 | break; |
49 | 50 | ||
50 | case 'e': | 51 | case 'e': |
51 | return null; | 52 | return null; |
52 | 53 | ||
53 | default: | 54 | default: |
54 | throw new Exception("Invalid gats type discovered: " + (char)type ); | 55 | throw new java.io.IOException("Invalid gats type discovered: " + (char)type ); |
55 | } | 56 | } |
56 | 57 | ||
57 | goRet.read( is, type ); | 58 | goRet.read( is, type ); |