From e3efaf2a9ad82deb1644ccab8c1469719a0c5b65 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 16 Jan 2012 02:31:34 +0000 Subject: Lots of documentation, an example program, and also some visibility cleanup. --- java/com/xagasoft/gats/GatsInteger.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'java/com/xagasoft/gats/GatsInteger.java') 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; import java.io.OutputStream; import java.io.InputStream; +/** + * Represents a simple java long value. This does not handle arbitrary + * precision integer values, a class to handle that is forthcoming. + */ public class GatsInteger extends GatsObject { private long iValue = 0; @@ -36,19 +40,23 @@ public class GatsInteger extends GatsObject return GatsObject.INTEGER; }; - public void read( InputStream is, char cType ) throws java.io.IOException + void read( InputStream is, char cType ) throws java.io.IOException { iValue = readPackedInt( is ); } - public void write( OutputStream os ) throws java.io.IOException + void write( OutputStream os ) throws java.io.IOException { os.write( (int)'i' ); writePackedInt( os, iValue ); } /** + * This is a general helper function used by several parts of the Gats + * system. + * It reads a "packed integer" from the given input stream, and returns the + * value. * Possible TODO: have this return a Number, and construct either a Long * or BigInteger when appropriate. */ @@ -72,6 +80,11 @@ public class GatsInteger extends GatsObject return rOut; } + /** + * This is a general helper function used by several parts of the Gats + * system. + * It writes a "packed integer" to the given output stream. + */ public static void writePackedInt( OutputStream os, long iIn ) throws java.io.IOException { int b; -- cgit v1.2.3