org.objectweb.jeremie.presentation.std
Class StdMarshallerFactory.StdUnMarshaller

java.lang.Object
  extended by java.io.InputStream
      extended by org.objectweb.jeremie.presentation.std.StdMarshallerFactory.StdUnMarshaller
All Implemented Interfaces:
Closeable, JRMIUnMarshaller, org.objectweb.jonathan.presentation.api.UnMarshaller
Direct Known Subclasses:
StdMarshallerFactory.StdUnMarshallerD
Enclosing class:
StdMarshallerFactory

public class StdMarshallerFactory.StdUnMarshaller
extends InputStream
implements JRMIUnMarshaller

StdUnMarshaller is an (abstract) implementation of UnMarshaller.


Field Summary
protected  org.objectweb.jonathan.apis.kernel.Context context
           
protected  org.objectweb.jonathan.resources.api.Chunk first
           
protected  ObjectInputStream is
           
protected  int last_offset
           
protected  boolean little_endian
           
protected  int offset
           
 
Constructor Summary
protected StdMarshallerFactory.StdUnMarshaller(org.objectweb.jonathan.resources.api.Chunk first, int read)
           
 
Method Summary
 int available()
          Returns the number of bytes that can be read without blocking.
 int bytesRead()
           
 void close()
           
 org.objectweb.jonathan.apis.kernel.Context getContext()
           
 InputStream inputStream()
           
 boolean isLittleEndian()
          Returns true if this unmarshaller is little-endian, false otherwise.
protected  void prepare()
           
 int read()
          Reads one byte from the message.
 int read(byte[] array, int off, int length)
          Reads data from the message into an array of bytes.
 boolean readBoolean()
          Reads a boolean from a message.
 byte readByte()
          Reads a byte from a message.
 void readByteArray(byte[] array, int off, int len)
           
 char readChar16()
           
 char readChar8()
          Reads a char from a message.
 double readDouble()
           
 Exception readException()
          Reads an exception thrown by a remote method invocation from an underlying stream.
 float readFloat()
           
 int readInt()
           
 long readLong()
           
 Method readMethod(Class objclass)
          Reads a method from an underlying stream.
 Object[] readParameters()
          Reads the arguments in a remote method invocation from an underlying stream.
 Object readReference()
          Method used by stubs when they need to send interfaces references.
 Object readResult()
          Reads the result of a remote method invocation from an underlying stream.
 short readShort()
           
 String readString16()
           
 String readString8()
           
 Object readValue()
           
 void setByteOrder(boolean little_endian)
           
 void setSize(int size)
           
 long skip(long n)
          Skips over and discards n bytes of data from this input stream.
 
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

protected org.objectweb.jonathan.resources.api.Chunk first

offset

protected int offset

last_offset

protected int last_offset

little_endian

protected boolean little_endian

is

protected ObjectInputStream is

context

protected org.objectweb.jonathan.apis.kernel.Context context
Constructor Detail

StdMarshallerFactory.StdUnMarshaller

protected StdMarshallerFactory.StdUnMarshaller(org.objectweb.jonathan.resources.api.Chunk first,
                                               int read)
Method Detail

getContext

public final org.objectweb.jonathan.apis.kernel.Context getContext()
Specified by:
getContext in interface org.objectweb.jonathan.presentation.api.UnMarshaller

close

public void close()
Specified by:
close in interface Closeable
Specified by:
close in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Overrides:
close in class InputStream

setSize

public void setSize(int size)
             throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
setSize in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readByte

public byte readByte()
              throws org.objectweb.jonathan.apis.kernel.JonathanException
Reads a byte from a message.

Specified by:
readByte in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Returns:
a byte.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if an IO exception occurs.

readBoolean

public boolean readBoolean()
                    throws org.objectweb.jonathan.apis.kernel.JonathanException
Reads a boolean from a message.

Specified by:
readBoolean in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Returns:
a boolean.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if an IO exception occurs.

readChar8

public char readChar8()
               throws org.objectweb.jonathan.apis.kernel.JonathanException
Reads a char from a message.

Specified by:
readChar8 in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Returns:
a char.
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException - if an IO exception occurs.

readChar16

public char readChar16()
                throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readChar16 in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readShort

public short readShort()
                throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readShort in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readInt

public int readInt()
            throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readInt in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readLong

public long readLong()
              throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readLong in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readFloat

public float readFloat()
                throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readFloat in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readDouble

public double readDouble()
                  throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readDouble in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readString8

public String readString8()
                   throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readString8 in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readString16

public String readString16()
                    throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readString16 in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readReference

public final Object readReference()
                           throws org.objectweb.jonathan.apis.kernel.JonathanException
Method used by stubs when they need to send interfaces references.

Specified by:
readReference in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Parameters:
exp - the surrogate that must be sent;
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readValue

public final Object readValue()
                       throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readValue in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readByteArray

public void readByteArray(byte[] array,
                          int off,
                          int len)
                   throws org.objectweb.jonathan.apis.kernel.JonathanException
Specified by:
readByteArray in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException

readMethod

public Method readMethod(Class objclass)
                  throws UnmarshalException
Description copied from interface: JRMIUnMarshaller
Reads a method from an underlying stream.

Specified by:
readMethod in interface JRMIUnMarshaller
Parameters:
objclass - a class that declares the method.
Returns:
the method read.
Throws:
UnmarshalException - if something goes wrong.

readParameters

public Object[] readParameters()
                        throws UnmarshalException
Description copied from interface: JRMIUnMarshaller
Reads the arguments in a remote method invocation from an underlying stream.

Specified by:
readParameters in interface JRMIUnMarshaller
Returns:
the objects representing the arguments.
Throws:
UnmarshalException - if something goes wrong.

readResult

public Object readResult()
                  throws UnmarshalException
Description copied from interface: JRMIUnMarshaller
Reads the result of a remote method invocation from an underlying stream.

Specified by:
readResult in interface JRMIUnMarshaller
Returns:
the object representing the result.
Throws:
UnmarshalException - if something goes wrong.

readException

public Exception readException()
                        throws UnmarshalException
Description copied from interface: JRMIUnMarshaller
Reads an exception thrown by a remote method invocation from an underlying stream.

Specified by:
readException in interface JRMIUnMarshaller
Returns:
the thrown exception.
Throws:
UnmarshalException - if something goes wrong.

isLittleEndian

public final boolean isLittleEndian()
Returns true if this unmarshaller is little-endian, false otherwise.

Specified by:
isLittleEndian in interface org.objectweb.jonathan.presentation.api.UnMarshaller
Returns:
true if this unmarshaller is little-endian, false otherwise.

setByteOrder

public void setByteOrder(boolean little_endian)
Specified by:
setByteOrder in interface org.objectweb.jonathan.presentation.api.UnMarshaller

inputStream

public InputStream inputStream()
Specified by:
inputStream in interface org.objectweb.jonathan.presentation.api.UnMarshaller

read

public int read()
         throws IOException
Reads one byte from the message. If the end of the stream is reached,-1 is returned. The default implementation uses the 'readByte' method.

Specified by:
read in class InputStream
Returns:
the byte read.
Throws:
IOException - if an error occurs.
See Also:
org.objectweb.jonathan.apis.resources.ChunkProvider

read

public int read(byte[] array,
                int off,
                int length)
         throws IOException
Reads data from the message into an array of bytes. The default implementation uses the readByteArray() method.

Overrides:
read in class InputStream
Parameters:
array - the buffer into which the data is read.
the - start offset of the data.
the - maximum number of bytes read.
Returns:
the actual number of bytes read.
Throws:
IOException - if an error occurs.

skip

public long skip(long n)
          throws IOException
Skips over and discards n bytes of data from this input stream. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. The actual number of bytes skipped is returned.

The default implementation calls the skip(int) method.

Overrides:
skip in class InputStream
Parameters:
n - the number of bytes to be skipped.
Returns:
the actual number of bytes skipped.
Throws:
IOException - if an I/O error occurs.

available

public int available()
              throws IOException
Returns the number of bytes that can be read without blocking. The default implementation uses the 'size' method.

Overrides:
available in class InputStream
Returns:
the number of bytes that can be read without blocking;
Throws:
IOException - if an error occurs.
See Also:
org.objectweb.jonathan.apis.resources.ChunkProvider

bytesRead

public int bytesRead()
Specified by:
bytesRead in interface org.objectweb.jonathan.presentation.api.UnMarshaller

prepare

protected void prepare()
                throws org.objectweb.jonathan.apis.kernel.JonathanException
Throws:
org.objectweb.jonathan.apis.kernel.JonathanException