org.granite.messaging.jmf
Interface ExtendedObjectInput

All Superinterfaces:
DataInput, ObjectInput
All Known Subinterfaces:
DumpContext, InputContext
All Known Implementing Classes:
JMFDeserializer, JMFDumper

public interface ExtendedObjectInput
extends ObjectInput

The ExtendedObjectInput interface extends ObjectInput and add two methods that help dealing with reflection (getReflection()) and field assignments (readAndSetProperty(Object, Property)).

Implementation instances of this interface are passed as parameter to ExtendedObjectCodec.decode(ExtendedObjectInput, Object) method calls.

Several methods of the ObjectInput interface are tagged as deprecated and should never be used within ExtendedObjectCodec.decode(...) calls (implementations must throw UnsupportedOperationException errors).

Author:
Franck WOLFF
See Also:
ExtendedObjectCodec, ExtendedObjectOutput, JMFDeserializer, InputContext

Method Summary
 String getAlias(String className)
           
 Reflection getReflection()
          Return the Reflection registered in the global JMF SharedContext.
 int read()
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 int read(byte[] b)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 int read(byte[] b, int off, int len)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 void readAndSetProperty(Object obj, Property property)
          Read the next data in the current input stream and set the given field of the given Object obj with this data.
 void readFully(byte[] b)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 void readFully(byte[] b, int off, int len)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 String readLine()
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 long skip(long n)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 int skipBytes(int n)
          Deprecated. Implementation must throw a UnsupportedOperationException error.
 
Methods inherited from interface java.io.ObjectInput
available, close, readObject
 
Methods inherited from interface java.io.DataInput
readBoolean, readByte, readChar, readDouble, readFloat, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF
 

Method Detail

getReflection

Reflection getReflection()
Return the Reflection registered in the global JMF SharedContext.

Returns:
A Reflection utility that can be used to load classes during the deserialization process.

getAlias

String getAlias(String className)

readAndSetProperty

void readAndSetProperty(Object obj,
                        Property property)
                        throws IOException,
                               ClassNotFoundException,
                               IllegalAccessException,
                               InvocationTargetException
Read the next data in the current input stream and set the given field of the given Object obj with this data. This method is only a convenient shortcut for reading data from the input stream and setting the value of a Field to this data without knowing its type. For example, given a field f1 of type boolean (the primitive type) and a field f2 of type int (the primitive type):
 in.readAndSetProperty(obj, f1);
 in.readAndSetProperty(obj, f2);
 
is equivalent to:
 f1.setBoolean(obj, in.readBoolean());
 f2.setInt(obj, in.readInt());
 

Parameters:
obj - The instance of the class declaring the property.
property - The property to set with the read value.
Throws:
IOException - If any I/O error occur.
JMFEncodingException - If read data isn't of expected type (ie. the type of the given property).
ClassNotFoundException - If the class of a serialized object cannot be found.
IllegalAccessException - If the property cannot be accessed.
InvocationTargetException

read

@Deprecated
int read()
         throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use DataInput.readByte() instead.

Specified by:
read in interface ObjectInput
Throws:
IOException

read

@Deprecated
int read(byte[] b)
         throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use (byte[])ObjectInput.readObject() instead.

Specified by:
read in interface ObjectInput
Throws:
IOException

read

@Deprecated
int read(byte[] b,
                    int off,
                    int len)
         throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use (byte[])ObjectInput.readObject() instead.

Specified by:
read in interface ObjectInput
Throws:
IOException

readFully

@Deprecated
void readFully(byte[] b)
               throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use (byte[])ObjectInput.readObject() instead.

Specified by:
readFully in interface DataInput
Throws:
IOException

readFully

@Deprecated
void readFully(byte[] b,
                          int off,
                          int len)
               throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use (byte[])ObjectInput.readObject() instead.

Specified by:
readFully in interface DataInput
Throws:
IOException

readLine

@Deprecated
String readLine()
                throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec. Use DataInput.readUTF() instead and parse the String.

Specified by:
readLine in interface DataInput
Throws:
IOException

skipBytes

@Deprecated
int skipBytes(int n)
              throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec.

Specified by:
skipBytes in interface DataInput
Throws:
IOException

skip

@Deprecated
long skip(long n)
          throws IOException
Deprecated. Implementation must throw a UnsupportedOperationException error.

Should never be used with JMF ExtendedObjectCodec.

Specified by:
skip in interface ObjectInput
Throws:
IOException