|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.io.InputStream
|
+--java.io.ObjectInputStream
|
+--JSX.ObjectReader
ObjectReader can be used in place of ObjectInputStream, to serialize object graphs to XML, instead of the binary format. It implements all the core features of ObjectInputStream - refer to Sun's javadocs and tutorials for more information. ObjectReader does not require classes to implement java.io.Serialization, nor is serialVersionUID needed for class evolution.
| Nested Class Summary | |
class |
ObjectReader.GetFieldImpl
|
| Field Summary |
| Constructor Summary | |
ObjectReader(JSX.DataReaderI dataReader)
|
|
ObjectReader(JSX.DataReaderI dataReader,
ClassLoader cl)
Pass in a classloader for JSX to lookup classes that are being deserialized. |
|
ObjectReader(InputStream in)
|
|
ObjectReader(InputStream in,
ClassLoader cl)
Pass in a classloader for JSX to lookup classes that are being deserialized. |
|
ObjectReader(Reader reader)
|
|
ObjectReader(Reader reader,
ClassLoader cl)
Pass in a classloader for JSX to lookup classes that are being deserialized. |
|
| Method Summary | |
String |
_readUTF()
|
int |
available()
returns 1 if source is ready; else 0 |
void |
close()
|
void |
defaultReadObject()
Call from within a class's readObject(ObjectInputStream ois) method, so the object is deserialized by the default way. |
void |
disableExternalization()
Create object and step through inherited classes |
protected boolean |
enableResolveObject(boolean enable)
|
HashMap |
getHash()
|
static void |
main(String[] args)
USAGE: java JSX.ObjectReader fileName (use "-" for stdin, defaults to example.xml) |
int |
read()
|
int |
read(byte[] buf,
int off,
int len)
|
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
|
protected ObjectStreamClass |
readClassDescriptor()
Never called by JSX, so overriding it has no effect. |
double |
readDouble()
|
ObjectInputStream.GetField |
readFields()
Reads the stream, same as defaultReadObject, but instead of storing into fields, it stores it in a hash that can be queried. |
float |
readFloat()
|
void |
readFully(byte[] buf)
|
void |
readFully(byte[] buf,
int off,
int len)
|
int |
readInt()
|
String |
readLine()
This operates at the wrong level for reading object encoded as XML - this method calls _readUTF() instead, and so will work if characters have been written explicitly as object data |
long |
readLong()
|
protected Object |
readObjectOverride()
|
short |
readShort()
|
protected void |
readStreamHeader()
Not implemented |
Object |
readUnshared()
|
int |
readUnsignedByte()
|
int |
readUnsignedShort()
|
String |
readUTF()
|
void |
registerValidation(ObjectInputValidation obj,
int prio)
|
protected Class |
resolveClass(ObjectStreamClass osc,
String sergeyName)
First attempts to load classes with Thread.currentThread().getContextClassLoader(); if fails, it defaults to the classloader that loaded JSX.Reader. |
protected Object |
resolveObject(Object obj)
Override this method, to replace a deserialized object with another |
| Methods inherited from class java.io.ObjectInputStream |
readObject, resolveClass, resolveProxyClass, skipBytes |
| 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 |
| Constructor Detail |
public ObjectReader(InputStream in)
throws IOException
public ObjectReader(InputStream in,
ClassLoader cl)
throws IOException
public ObjectReader(Reader reader)
throws IOException
public ObjectReader(Reader reader,
ClassLoader cl)
throws IOException
public ObjectReader(JSX.DataReaderI dataReader)
throws IOException
public ObjectReader(JSX.DataReaderI dataReader,
ClassLoader cl)
throws IOException
| Method Detail |
public static void main(String[] args)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundExceptionpublic HashMap getHash()
public void close()
throws IOException
close in interface ObjectInputclose in class ObjectInputStreamIOException
public int available()
throws IOException
available in interface ObjectInputavailable in class ObjectInputStreamIOException
public void registerValidation(ObjectInputValidation obj,
int prio)
throws NotActiveException,
InvalidObjectException
registerValidation in class ObjectInputStreamNotActiveException
InvalidObjectException
public boolean readBoolean()
throws IOException
readBoolean in interface DataInputreadBoolean in class ObjectInputStreamIOException
public byte readByte()
throws IOException
readByte in interface DataInputreadByte in class ObjectInputStreamIOException
public char readChar()
throws IOException
readChar in interface DataInputreadChar in class ObjectInputStreamIOException
public int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputreadUnsignedByte in class ObjectInputStreamIOException
public short readShort()
throws IOException
readShort in interface DataInputreadShort in class ObjectInputStreamIOException
public int readUnsignedShort()
throws IOException
readUnsignedShort in interface DataInputreadUnsignedShort in class ObjectInputStreamIOException
public int readInt()
throws IOException
readInt in interface DataInputreadInt in class ObjectInputStreamIOException
public long readLong()
throws IOException
readLong in interface DataInputreadLong in class ObjectInputStreamIOException
public float readFloat()
throws IOException
readFloat in interface DataInputreadFloat in class ObjectInputStreamIOException
public double readDouble()
throws IOException
readDouble in interface DataInputreadDouble in class ObjectInputStreamIOException
public String readLine()
throws IOException
readLine in interface DataInputreadLine in class ObjectInputStreamIOException
public String readUTF()
throws IOException
readUTF in interface DataInputreadUTF in class ObjectInputStreamIOException
public int read()
throws IOException
read in interface ObjectInputread in class ObjectInputStreamIOException
public int read(byte[] buf,
int off,
int len)
throws IOException
read in interface ObjectInputread in class ObjectInputStreamIOException
public void readFully(byte[] buf)
throws IOException
readFully in interface DataInputreadFully in class ObjectInputStreamIOException
public void readFully(byte[] buf,
int off,
int len)
throws IOException
readFully in interface DataInputreadFully in class ObjectInputStreamIOException
public String _readUTF()
throws IOException
IOException
public Object readUnshared()
throws OptionalDataException,
ClassNotFoundException,
IOException
readUnshared in class ObjectInputStreamOptionalDataException
ClassNotFoundException
IOException
protected Object resolveObject(Object obj)
throws IOException
resolveObject in class ObjectInputStreamIOException
protected boolean enableResolveObject(boolean enable)
throws SecurityException
enableResolveObject in class ObjectInputStreamSecurityException
protected Class resolveClass(ObjectStreamClass osc,
String sergeyName)
throws IOException,
ClassNotFoundException
IOException
ClassNotFoundException
protected ObjectStreamClass readClassDescriptor()
throws IOException,
ClassNotFoundException
readClassDescriptor in class ObjectInputStreamIOException
ClassNotFoundException
protected void readStreamHeader()
throws IOException,
StreamCorruptedException
readStreamHeader in class ObjectInputStreamIOException
StreamCorruptedException
protected Object readObjectOverride()
throws IOException,
ClassNotFoundException
readObjectOverride in class ObjectInputStreamIOException
ClassNotFoundExceptionpublic void disableExternalization()
public void defaultReadObject()
throws IOException,
ClassNotFoundException
defaultReadObject in class ObjectInputStreamIOException
ClassNotFoundException
public ObjectInputStream.GetField readFields()
throws IOException,
ClassNotFoundException
readFields in class ObjectInputStreamIOException
ClassNotFoundException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||