--- /dev/null
+/**
+ *
+ */
+package org.vamsas.client.simpleclient;
+
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarInputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * @author jimp
+ * LATER: this may not be a necessary or useful class to return from IClientAppdata get*InputStream() methods
+ */
+public class AppDataInputStream extends DataInputStream implements DataInput {
+ private Log log = LogFactory.getLog(AppDataInputStream.class);
+ private boolean isOpen = false;
+ /**
+ * Wrapper for writing to/from AppData Entries in a Vamsas Document.
+ */
+ public AppDataInputStream(InputStream inputstream) {
+ super(inputstream);
+ isOpen=true;
+ }
+
+ /* (non-Javadoc)
+ * @see java.io.FilterInputStream#close()
+ */
+ public void close() throws IOException {
+ if (!isOpen) {
+ log.debug("close() called on closed AppDataInputStream.");
+ // throw new IOException("Attempt to close an already closed AppDataInputStream");
+ } else {
+ isOpen=false;
+ }
+ }
+
+ /**
+ * Will return zero if stream has been closed.
+ * @see java.io.FilterInputStream#available()
+ */
+ public int available() throws IOException {
+ if (isOpen)
+ return super.available();
+ else
+ return 0;
+ }
+
+}