aboutsummaryrefslogtreecommitdiff
path: root/java/com/xagasoft/gats/GatsInteger.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/GatsInteger.java
parent49216a230c331791b06df1527c3245c88e991c20 (diff)
downloadlibgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.gz
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.bz2
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.tar.xz
libgats-4fb4a056c52d3a96b6ef9a4ceb5ce39fc716a9aa.zip
It...builds?
Diffstat (limited to '')
-rw-r--r--java/com/xagasoft/gats/GatsInteger.java (renamed from java/com/xagasoft/gats/Integer.java)43
1 files changed, 37 insertions, 6 deletions
diff --git a/java/com/xagasoft/gats/Integer.java b/java/com/xagasoft/gats/GatsInteger.java
index ab3d6de..1093ab2 100644
--- a/java/com/xagasoft/gats/Integer.java
+++ b/java/com/xagasoft/gats/GatsInteger.java
@@ -3,19 +3,51 @@ package com.xagasoft.gats;
3import java.io.OutputStream; 3import java.io.OutputStream;
4import java.io.InputStream; 4import java.io.InputStream;
5 5
6public class Integer extends GatsObject 6public class GatsInteger extends GatsObject
7{ 7{
8 public int getGatsObject() 8 private long iValue = 0;
9
10 public GatsInteger()
11 {
12 }
13
14 public GatsInteger( long iValue )
15 {
16 this.iValue = iValue;
17 }
18
19 public long getValue()
20 {
21 return iValue;
22 }
23
24 public void setValue( long iValue )
25 {
26 this.iValue = iValue;
27 }
28
29 public int getType()
9 { 30 {
10 return GatsObject.INTEGER; 31 return GatsObject.INTEGER;
11 }; 32 };
12 33
34 public void read( InputStream is, char cType ) throws java.io.IOException
35
36 {
37 iValue = readPackedInt( is );
38 }
39
40 public void write( OutputStream os ) throws java.io.IOException
41 {
42 os.write( (int)'i' );
43 writePackedInt( os, iValue );
44 }
45
13 /** 46 /**
14 * Possible TODO: have this return a Number, and construct either a Long 47 * Possible TODO: have this return a Number, and construct either a Long
15 * or BigInteger when appropriate. 48 * or BigInteger when appropriate.
16 */ 49 */
17 public static long readPackedInt( InputStream is ) 50 public static long readPackedInt( InputStream is ) throws java.io.IOException
18 throws java.io.IOException
19 { 51 {
20 int b; 52 int b;
21 long rOut = 0; 53 long rOut = 0;
@@ -35,8 +67,7 @@ public class Integer extends GatsObject
35 return rOut; 67 return rOut;
36 } 68 }
37 69
38 public static void writePackedInt( OutputStream os, long iIn ) 70 public static void writePackedInt( OutputStream os, long iIn ) throws java.io.IOException
39 throws java.io.IOException
40 { 71 {
41 int b; 72 int b;
42 73