blob: 97c9c12f087d918fc823f71c9e5a7f9369097281 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
package com.xagasoft.gats;
import java.io.InputStream;
import java.io.OutputStream;
public abstract class GatsObject
{
public final static int INTEGER = 1;
public final static int FLOAT = 2;
public final static int STRING = 3;
public final static int LIST = 4;
public final static int DICTIONARY = 5;
public final static int BOOLEAN = 6;
public abstract int getType();
public abstract void read( InputStream is, char cType ) throws java.io.IOException;
public abstract void write( OutputStream os ) throws java.io.IOException;
public static GatsObject read( InputStream is ) throws java.io.IOException
{
char type = (char)is.read();
GatsObject goRet = null;
switch( type )
{
case 'i':
goRet = new GatsInteger();
break;
case 's':
goRet = new GatsString();
break;
case '0':
case '1':
goRet = new GatsBoolean();
break;
case 'l':
// goRet = new GatsList();
break;
case 'd':
// goRet = new GatsDictionary();
break;
case 'f':
case 'F':
// goRet = new GatsFloat();
break;
case 'e':
return null;
default:
throw new java.io.IOException("Invalid gats type discovered: " + (char)type );
}
goRet.read( is, type );
return goRet;
}
};
|