galaxy.io
Class GalaxyInputStream

java.lang.Object
  |
  +--galaxy.io.GalaxyInputStream

public class GalaxyInputStream
extends java.lang.Object

This class provides methods for reading data from a Galaxy Communicator connection.


Constructor Summary
GalaxyInputStream(java.io.InputStream in)
          Constructor
 
Method Summary
 void close()
           
 FifoMutex getMutex()
          Returns this input stream's mutex.
 GBinary readBinary()
          Reads a GBinary from the input stream.
 java.lang.Float readFloat()
          Reads a Float from the input stream.
 Float32 readFloat32()
          Reads a Float32 from the input stream.
 Float64 readFloat64()
          Reads a Float64 from the input stream.
 GFrame readFrame()
          Reads a frame from the input stream.
 Int16 readInt16()
          Reads an Int16 from the input stream.
 Int32 readInt32()
          Reads an Int32 from the input stream.
 Int64 readInt64()
          Reads an Int64 from the input stream.
 java.lang.Integer readInteger()
          Reads an Integer from the input stream.
 GVector readList()
          Reads a GVector from the input stream.
 GalaxyMessage readMessage()
          Reads a message from the input stream.
 java.lang.Object readObject()
          Reads an object from the input stream.
 java.lang.String readString()
          Reads a string from the input stream.
 Symbol readSymbol()
          Reads a Symbol from the input stream.
 GBinary tryReadBinary()
          Reads a GBinary from the input stream if data is available.
 java.lang.Float tryReadFloat()
          Reads a Float from the input stream if data is available.
 Float32 tryReadFloat32()
          Reads a Float32 from the input stream if data is available.
 Float64 tryReadFloat64()
          Reads a Float64 from the input stream if data is available.
 GFrame tryReadFrame()
          Reads a frame from the input stream if data is available.
 Int16 tryReadInt16()
          Reads an Int16 from the input stream if data is available.
 Int32 tryReadInt32()
          Reads an Int32 from the input stream if data is available.
 Int64 tryReadInt64()
          Reads an Int64 from the input stream if data is available.
 java.lang.Integer tryReadInteger()
          Reads an Integer from the input stream if data is available.
 GVector tryReadList()
          Reads a GVector from the input stream if data is available.
 GalaxyMessage tryReadMessage()
          Reads a message from the input stream if data is available.
 java.lang.Object tryReadObject()
          Reads an object from the input stream if data is available.
 java.lang.String tryReadString()
          Reads a string from the input stream if data is available.
 Symbol tryReadSymbol()
          Reads a Symbol from the input stream if data is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GalaxyInputStream

public GalaxyInputStream(java.io.InputStream in)
                  throws java.io.IOException
Constructor
Parameters:
in - the input stream to use
Method Detail

close

public void close()
           throws java.io.IOException

getMutex

public FifoMutex getMutex()
Returns this input stream's mutex.
Returns:
the mutex

readInt16

public Int16 readInt16()
                throws java.lang.Exception
Reads an Int16 from the input stream.
Returns:
the Int16
Throws:
NotSupportedException - If an Int16 could not be read

tryReadInt16

public Int16 tryReadInt16()
                   throws java.lang.Exception
Reads an Int16 from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Int16 or null if no data was available or there was an error
Throws:
NotSupportedException - If an Int16 could not be read

readInt32

public Int32 readInt32()
                throws java.lang.Exception
Reads an Int32 from the input stream.
Returns:
the Int32
Throws:
NotSupportedException - If an Int32 could not be read

tryReadInt32

public Int32 tryReadInt32()
                   throws java.lang.Exception
Reads an Int32 from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Int32 or null if no data was available or there was an error
Throws:
NotSupportedException - If an Int32 could not be read

readInt64

public Int64 readInt64()
                throws java.lang.Exception
Reads an Int64 from the input stream.
Returns:
the Int64
Throws:
NotSupportedException - If an Int64 could not be read

tryReadInt64

public Int64 tryReadInt64()
                   throws java.lang.Exception
Reads an Int64 from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Int64 or null if no data was available or there was an error
Throws:
NotSupportedException - If an Int64 could not be read

readInteger

public java.lang.Integer readInteger()
                              throws java.lang.Exception
Reads an Integer from the input stream.
Returns:
the Integer
Throws:
NotSupportedException - If an Integer could not be read

tryReadInteger

public java.lang.Integer tryReadInteger()
                                 throws java.lang.Exception
Reads an Integer from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Integer or null if no data was available or there was an error
Throws:
NotSupportedException - If an Integer could not be read

readFloat32

public Float32 readFloat32()
                    throws java.lang.Exception
Reads a Float32 from the input stream.
Returns:
the Float32
Throws:
NotSupportedException - If a Float32 could not be read

tryReadFloat32

public Float32 tryReadFloat32()
                       throws java.lang.Exception
Reads a Float32 from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Float32 or null if no data was available or there was an error
Throws:
NotSupportedException - If a Float32 could not be read

readFloat64

public Float64 readFloat64()
                    throws java.lang.Exception
Reads a Float64 from the input stream.
Returns:
the Float64
Throws:
NotSupportedException - If a Float64 could not be read

tryReadFloat64

public Float64 tryReadFloat64()
                       throws java.lang.Exception
Reads a Float64 from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Float64 or null if no data was available or there was an error
Throws:
NotSupportedException - If a Float64 could not be read

readFloat

public java.lang.Float readFloat()
                          throws java.lang.Exception
Reads a Float from the input stream.
Returns:
the Float
Throws:
NotSupportedException - If a Float could not be read

tryReadFloat

public java.lang.Float tryReadFloat()
                             throws java.lang.Exception
Reads a Float from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Float or null if no data was available or there was an error
Throws:
NotSupportedException - If a Float could not be read

readBinary

public GBinary readBinary()
                   throws java.lang.Exception
Reads a GBinary from the input stream.
Returns:
the GBinary
Throws:
NotSupportedException - If a GBinary could not be read

tryReadBinary

public GBinary tryReadBinary()
                      throws java.lang.Exception
Reads a GBinary from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the GBinary or null if no data was available or there was an error
Throws:
NotSupportedException - If a GBinary could not be read

readList

public GVector readList()
                 throws java.lang.Exception
Reads a GVector from the input stream.
Returns:
the GVector
Throws:
NotSupportedException - If a GVector could not be read

tryReadList

public GVector tryReadList()
                    throws java.lang.Exception
Reads a GVector from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the GVector or null if no data was available or there was an error
Throws:
NotSupportedException - If a GVector could not be read

readSymbol

public Symbol readSymbol()
                  throws java.lang.Exception
Reads a Symbol from the input stream.
Returns:
the Symbol
Throws:
NotSupportedException - If a Symbol could not be read

tryReadSymbol

public Symbol tryReadSymbol()
                     throws java.lang.Exception
Reads a Symbol from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the Symbol or null if no data was available or there was an error
Throws:
NotSupportedException - If a Symbol could not be read

readString

public java.lang.String readString()
                            throws java.lang.Exception
Reads a string from the input stream.
Returns:
the string
Throws:
NotSupportedException - If a string could not be read

tryReadString

public java.lang.String tryReadString()
                               throws java.lang.Exception
Reads a string from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the string or null if no data was available or there was an error
Throws:
NotSupportedException - If a string could not be read

readFrame

public GFrame readFrame()
                 throws java.lang.Exception
Reads a frame from the input stream.
Returns:
the frame
Throws:
NotSupportedException - If a frame could not be read

tryReadFrame

public GFrame tryReadFrame()
                    throws java.lang.Exception
Reads a frame from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the frame or null if no data was available or there was an error
Throws:
NotSupportedException - If a frame could not be read

readMessage

public GalaxyMessage readMessage()
                          throws java.lang.Exception
Reads a message from the input stream.
Returns:
the message or null if there was an error

tryReadMessage

public GalaxyMessage tryReadMessage()
                             throws java.lang.Exception
Reads a message from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the message or null if no data was available or there was an error

readObject

public java.lang.Object readObject()
                            throws java.lang.Exception
Reads an object from the input stream.
Returns:
the object or null if there was an error

tryReadObject

public java.lang.Object tryReadObject()
                               throws java.lang.Exception
Reads an object from the input stream if data is available. Note that this method can not detect if the connection has gone down.
Returns:
the object or null if no data was available or there was an error