org.objectweb.jeremie.presentation.std

Class StdMarshallerFactory.StdUnMarshaller

Enclosing Class:
StdMarshallerFactory
Implemented Interfaces:
JRMIUnMarshaller, UnMarshaller
Known Direct Subclasses:
StdMarshallerFactory.StdUnMarshallerD

public class StdMarshallerFactory.StdUnMarshaller
extends InputStream
implements JRMIUnMarshaller

StdUnMarshaller is an (abstract) implementation of UnMarshaller.

Field Summary

protected Context
context
protected Chunk
first
protected ObjectInputStream
is
protected int
last_offset
protected boolean
little_endian
protected int
offset

Constructor Summary

StdUnMarshaller(Chunk first, int read)

Method Summary

int
available()
Returns the number of bytes that can be read without blocking.
int
bytesRead()
void
close()
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()
float
readFloat()
int
readInt()
long
readLong()
Method
readMethod(Class objclass)
Object[]
readParameters()
Object
readReference()
Method used by stubs when they need to send interfaces references.
Object
readResult()
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.

Field Details

context

protected Context context


first

protected Chunk first


is

protected ObjectInputStream is


last_offset

protected int last_offset


little_endian

protected boolean little_endian


offset

protected int offset

Constructor Details

StdUnMarshaller

protected StdUnMarshaller(Chunk first,
                          int read)

Method Details

available

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

Returns:
the number of bytes that can be read without blocking;

See Also:
org.objectweb.jonathan.apis.resources.ChunkProvider


bytesRead

public int bytesRead()


close

public void close()


getContext

public final Context getContext()


inputStream

public InputStream inputStream()


isLittleEndian

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

Returns:
true if this unmarshaller is little-endian, false otherwise.


prepare

protected void prepare()
            throws JonathanException


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.

Returns:
the byte read.

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.

Parameters:
array - the buffer into which the data is read.

Returns:
the actual number of bytes read.


readBoolean

public boolean readBoolean()
            throws JonathanException
Reads a boolean from a message.

Returns:
a boolean.


readByte

public byte readByte()
            throws JonathanException
Reads a byte from a message.

Returns:
a byte.


readByteArray

public void readByteArray(byte[] array,
                          int off,
                          int len)
            throws JonathanException


readChar16

public char readChar16()
            throws JonathanException


readChar8

public char readChar8()
            throws JonathanException
Reads a char from a message.

Returns:
a char.


readDouble

public double readDouble()
            throws JonathanException


readException

public Exception readException()
            throws UnmarshalException
Specified by:
readException in interface JRMIUnMarshaller


readFloat

public float readFloat()
            throws JonathanException


readInt

public int readInt()
            throws JonathanException


readLong

public long readLong()
            throws JonathanException


readMethod

public Method readMethod(Class objclass)
            throws UnmarshalException
Specified by:
readMethod in interface JRMIUnMarshaller


readParameters

public Object[] readParameters()
            throws UnmarshalException
Specified by:
readParameters in interface JRMIUnMarshaller


readReference

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

Parameters:


readResult

public Object readResult()
            throws UnmarshalException
Specified by:
readResult in interface JRMIUnMarshaller


readShort

public short readShort()
            throws JonathanException


readString16

public String readString16()
            throws JonathanException


readString8

public String readString8()
            throws JonathanException


readValue

public final Object readValue()
            throws JonathanException


setByteOrder

public void setByteOrder(boolean little_endian)


setSize

public void setSize(int size)
            throws JonathanException


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.

Parameters:
n - the number of bytes to be skipped.

Returns:
the actual number of bytes skipped.