|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.io.InputStream
java.io.ObjectInputStream
it.unimo.dbgroup.momis.XmlTools.XmlObjectInput
XmlReader wrapper that extends ObjectInputStream.
This class is used by XmlReader to call custom
readObject(ObjectInputStream in) methods.
You can also use this class as a stand alone object input deserializer.
This wrapper is provided to extends functionalities of XmlReader to all java objects. You can think to XmlObjectInput as a part of XmlReader or as stand alone object that extends XmlReader.
Remember that this class is a wrapper, so use XmlReader if you can, it is more efficient.
For more details see XmlReader methods.
XmlReader| Nested Class Summary |
| Nested classes inherited from class java.io.ObjectInputStream |
java.io.ObjectInputStream.GetField |
| Field Summary | |
private java.io.InputStream |
_in
Reference to the input stream. |
private XmlReader |
_rdr
Reference to the wrapped XmlReader. |
| Fields inherited from class java.io.ObjectInputStream |
|
| Fields inherited from class java.io.InputStream |
|
| Fields inherited from interface java.io.ObjectStreamConstants |
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING |
| Constructor Summary | |
XmlObjectInput(java.io.InputStream in)
Creates a stand alone wrapper. |
|
XmlObjectInput(XmlReader rdr)
Creates a wrapper and uses the specified XmlReader object. |
|
| Method Summary | |
int |
available()
Returns the number of bytes that can be read without blocking. |
void |
close()
Close the input stream if it was supplied with the proper constructor. |
void |
defaultReadObject()
Read the non-static and non-transient fields of the current class from the DOM tree. |
protected boolean |
enableResolveObject(boolean enable)
Does nothing. |
XmlReader |
getReader()
Returns the XmlReader object that this instance is wrapping. |
int |
read()
Reads a byte of data. |
int |
read(byte[] b,
int off,
int len)
Reads into an array of bytes. |
boolean |
readBoolean()
Reads in a boolean. |
byte |
readByte()
Reads in a byte. |
char |
readChar()
Reads a 16 bit char. |
protected java.io.ObjectStreamClass |
readClassDescriptor()
Does nothing. |
double |
readDouble()
Reads a 64 bit double. |
java.io.ObjectInputStream.GetField |
readFields()
Does nothing. |
float |
readFloat()
Reads a 32 bit float. |
void |
readFully(byte[] data)
Reads bytes as specified in DataInput interface. |
void |
readFully(byte[] data,
int offset,
int size)
Reads bytes as specified in DataInput interface. |
int |
readInt()
Reads a 32 bit integer. |
long |
readLong()
Reads a 64 bit long. |
protected java.lang.Object |
readObjectOverride()
Overridden implementation for readObject method. |
short |
readShort()
Reads a 16 bit short. |
protected void |
readStreamHeader()
Does nothing. |
int |
readUnsignedByte()
Reads an unsigned 8 bit byte. |
int |
readUnsignedShort()
Reads an unsigned 16 bit short. |
java.lang.String |
readUTF()
Reads a UTF format String. |
void |
registerValidation(java.io.ObjectInputValidation obj,
int prio)
Register an object to be validated before the graph is returned. |
protected java.lang.Class |
resolveClass(java.io.ObjectStreamClass v)
Does nothing. |
protected java.lang.Object |
resolveObject(java.lang.Object obj)
Does nothing. |
protected java.lang.Class |
resolveProxyClass(java.lang.String[] interfaces)
Does nothing. |
int |
skipBytes(int len)
Does nothing. |
| Methods inherited from class java.io.ObjectInputStream |
readLine, readObject, readUnshared |
| Methods inherited from class java.io.InputStream |
mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.io.ObjectInput |
read, skip |
| Field Detail |
private java.io.InputStream _in
private XmlReader _rdr
| Constructor Detail |
public XmlObjectInput(java.io.InputStream in)
throws java.io.IOException,
XmlToolsException
in - InputStream with XML data to convert in a DOM tree.
public XmlObjectInput(XmlReader rdr)
throws java.io.IOException
After this constructor returns, the calling method should call
XmlReader.setObjectInputWrapper(); with the new
XmlObjectInput as parameter to ensure coerence.
rdr - XmlReader that must be used.| Method Detail |
protected java.lang.Class resolveClass(java.io.ObjectStreamClass v)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected java.lang.Class resolveProxyClass(java.lang.String[] interfaces)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected java.lang.Object resolveObject(java.lang.Object obj)
throws java.io.IOException
java.io.IOException
protected boolean enableResolveObject(boolean enable)
throws java.lang.SecurityException
java.lang.SecurityException
protected void readStreamHeader()
throws java.io.IOException,
java.io.StreamCorruptedException
java.io.IOException
java.io.StreamCorruptedException
protected java.io.ObjectStreamClass readClassDescriptor()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected java.lang.Object readObjectOverride()
throws java.io.OptionalDataException,
java.lang.ClassNotFoundException,
java.io.IOException
java.io.OptionalDataException
java.lang.ClassNotFoundException
java.io.IOExceptionpublic XmlReader getReader()
public int available()
throws java.io.IOException
java.io.IOException
public void defaultReadObject()
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.io.NotActiveException
This method will call XmlReader.defaultRead().
java.io.IOException
java.lang.ClassNotFoundException
java.io.NotActiveException
public java.io.ObjectInputStream.GetField readFields()
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.io.NotActiveException
java.io.IOException
java.lang.ClassNotFoundException
java.io.NotActiveException
public void registerValidation(java.io.ObjectInputValidation obj,
int prio)
throws java.io.NotActiveException,
java.io.InvalidObjectException
This method will call XmlReader.registerValidation method.
Typically, a readObject method will register the object with the
stream so that when all of the objects are restored a final set
of validations can be performed.
obj - the object to receive the validation callback.prio - controls the order of callbacks;zero is a good default.
Use higher numbers to be called back earlier,
lower numbers for later callbacks. Within a priority, callbacks
are processed in no particular order.
java.io.NotActiveException - - The Reader is not currently reading
objects so it is invalid to register a callback.
java.io.InvalidObjectException - - The validation object is null.
public int read()
throws java.io.IOException
java.io.IOException
public int read(byte[] b,
int off,
int len)
throws java.io.IOException
b - the buffer into which the data is readoff - the start offset of the datalen - the maximum number of bytes read
java.io.IOException
public void close()
throws java.io.IOException
java.io.IOException
public boolean readBoolean()
throws java.io.IOException
See XmlReader.readBoolean for more details.
java.io.IOException
public byte readByte()
throws java.io.IOException
See XmlReader.readByte for more details.
java.io.IOException
public int readUnsignedByte()
throws java.io.IOException
java.io.IOException
public short readShort()
throws java.io.IOException
See XmlReader.readShort for more details.
java.io.IOException
public int readUnsignedShort()
throws java.io.IOException
java.io.IOException
public char readChar()
throws java.io.IOException
See XmlReader.readChar for more details.
java.io.IOException
public int readInt()
throws java.io.IOException
See XmlReader.readInt for more details.
java.io.IOException
public long readLong()
throws java.io.IOException
See XmlReader.readLong for more details.
java.io.IOException
public float readFloat()
throws java.io.IOException
See XmlReader.readFloat for more details.
java.io.IOException
public double readDouble()
throws java.io.IOException
See XmlReader.readDouble for more details.
java.io.IOException
public void readFully(byte[] data)
throws java.io.IOException
Please note that if in the source XML there is a string in the current position, that string is converted in a bytes array.
Any other elements will cause an exception.
Use this method to read data written with the following methods
only:
XmlObjectOutput.write(byte[] b,int off, int len)
XmlObjectOutput.write(byte[] b)
XmlObjectOutput.writeUTF(String s)
data - the buffer into which the data is read
java.io.IOException
public void readFully(byte[] data,
int offset,
int size)
throws java.io.IOException
Please note that if in the source XML there is a string in the current position, that string is converted in a bytes array.
Any other elements will cause an exception.
Use this method to read data written with the following methods
only:
XmlObjectOutput.write(byte[] b,int off, int len)
XmlObjectOutput.write(byte[] b)
XmlObjectOutput.writeUTF(String s)
data - the buffer into which the data is readoffset - the start offset of the datasize - the maximum number of bytes to read
java.io.IOException
public int skipBytes(int len)
throws java.io.IOException
java.io.IOException
public java.lang.String readUTF()
throws java.io.IOException
Please note that id other object element are encoutered this method will throw an exception.
java.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||