aboutsummaryrefslogtreecommitdiff
path: root/java/com/xagasoft/gats/GatsInteger.java
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-16 02:31:34 +0000
committerMike Buland <eichlan@xagasoft.com>2012-01-16 02:31:34 +0000
commite3efaf2a9ad82deb1644ccab8c1469719a0c5b65 (patch)
treedc1b3f3c787dd5900e80aaeca1a46cd9696d230b /java/com/xagasoft/gats/GatsInteger.java
parent66f972a288916824d9001c1931bf4c5db1bed82b (diff)
downloadlibgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.gz
libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.bz2
libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.xz
libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.zip
Lots of documentation, an example program, and also some visibility cleanup.
Diffstat (limited to 'java/com/xagasoft/gats/GatsInteger.java')
-rw-r--r--java/com/xagasoft/gats/GatsInteger.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/java/com/xagasoft/gats/GatsInteger.java b/java/com/xagasoft/gats/GatsInteger.java
index 139e8ab..0ea5122 100644
--- a/java/com/xagasoft/gats/GatsInteger.java
+++ b/java/com/xagasoft/gats/GatsInteger.java
@@ -3,6 +3,10 @@ package com.xagasoft.gats;
3import java.io.OutputStream; 3import java.io.OutputStream;
4import java.io.InputStream; 4import java.io.InputStream;
5 5
6/**
7 * Represents a simple java long value. This does not handle arbitrary
8 * precision integer values, a class to handle that is forthcoming.
9 */
6public class GatsInteger extends GatsObject 10public class GatsInteger extends GatsObject
7{ 11{
8 private long iValue = 0; 12 private long iValue = 0;
@@ -36,19 +40,23 @@ public class GatsInteger extends GatsObject
36 return GatsObject.INTEGER; 40 return GatsObject.INTEGER;
37 }; 41 };
38 42
39 public void read( InputStream is, char cType ) throws java.io.IOException 43 void read( InputStream is, char cType ) throws java.io.IOException
40 44
41 { 45 {
42 iValue = readPackedInt( is ); 46 iValue = readPackedInt( is );
43 } 47 }
44 48
45 public void write( OutputStream os ) throws java.io.IOException 49 void write( OutputStream os ) throws java.io.IOException
46 { 50 {
47 os.write( (int)'i' ); 51 os.write( (int)'i' );
48 writePackedInt( os, iValue ); 52 writePackedInt( os, iValue );
49 } 53 }
50 54
51 /** 55 /**
56 * This is a general helper function used by several parts of the Gats
57 * system.
58 * It reads a "packed integer" from the given input stream, and returns the
59 * value.
52 * Possible TODO: have this return a Number, and construct either a Long 60 * Possible TODO: have this return a Number, and construct either a Long
53 * or BigInteger when appropriate. 61 * or BigInteger when appropriate.
54 */ 62 */
@@ -72,6 +80,11 @@ public class GatsInteger extends GatsObject
72 return rOut; 80 return rOut;
73 } 81 }
74 82
83 /**
84 * This is a general helper function used by several parts of the Gats
85 * system.
86 * It writes a "packed integer" to the given output stream.
87 */
75 public static void writePackedInt( OutputStream os, long iIn ) throws java.io.IOException 88 public static void writePackedInt( OutputStream os, long iIn ) throws java.io.IOException
76 { 89 {
77 int b; 90 int b;