From d9b407475ae3ebe434b29d9eabdd7d4416e17881 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 24 Oct 2012 15:48:04 +0000 Subject: More comment/spelling fixes. Added a helper to GatsInputStream so you can find out how many bytes the previously read object was. --- java/com/xagasoft/gats/GatsDictionary.java | 2 +- java/com/xagasoft/gats/GatsInputStream.java | 14 ++++++++++++-- java/com/xagasoft/gats/KeyNotFoundException.java | 3 ++- 3 files changed, 15 insertions(+), 4 deletions(-) (limited to 'java/com/xagasoft') diff --git a/java/com/xagasoft/gats/GatsDictionary.java b/java/com/xagasoft/gats/GatsDictionary.java index 96a07a7..e359dfa 100644 --- a/java/com/xagasoft/gats/GatsDictionary.java +++ b/java/com/xagasoft/gats/GatsDictionary.java @@ -9,7 +9,7 @@ import java.util.Hashtable; /** * Gats dictionary, or hash table. This stores any number of items, keyed with - * strings. The values can be any valid com.xagasoft.gats.GatsObject decendant + * strings. The values can be any valid com.xagasoft.gats.GatsObject descendant * object. This class is often used as the root of complex Gats structures. *

* This class implements all standard java Map interface features but contains diff --git a/java/com/xagasoft/gats/GatsInputStream.java b/java/com/xagasoft/gats/GatsInputStream.java index 84fe40b..7d598b4 100644 --- a/java/com/xagasoft/gats/GatsInputStream.java +++ b/java/com/xagasoft/gats/GatsInputStream.java @@ -28,7 +28,7 @@ public class GatsInputStream { private InputStream is; private int iVer = 0; - private int iSize; + private int iLastSize = 0; public GatsInputStream( InputStream is ) { @@ -49,11 +49,21 @@ public class GatsInputStream { case 1: DataInputStream dis = new DataInputStream( is ); - iSize = dis.readInt(); + iLastSize = dis.readInt(); return GatsObject.read( is ); } return null; } + + /** + * Set after each call to readObject, this will tell you how many bytes + * were actually read in to build the object that was returned. + * @return Size in bytes of the most recently read packet. + */ + public int getLastReadPacketSize() + { + return iLastSize; + } }; diff --git a/java/com/xagasoft/gats/KeyNotFoundException.java b/java/com/xagasoft/gats/KeyNotFoundException.java index 4b75847..49d14e1 100644 --- a/java/com/xagasoft/gats/KeyNotFoundException.java +++ b/java/com/xagasoft/gats/KeyNotFoundException.java @@ -5,11 +5,12 @@ package com.xagasoft.gats; * casting helper functions is used to extract a value. In those cases, * in java we could still potentially return a null (at least if we were * using object types). This has a couple of advantages when working with - * non-object types, and maintains compatability with other implementations + * non-object types, and maintains compatibility with other implementations * of the Gats library. */ public class KeyNotFoundException extends Exception { + private static final long serialVersionUID = -1919827309987785614L; private Object oSrc = null; private String sKey = null; -- cgit v1.2.3