public Object readObject() throws IOException {
  int tag=read();
switch (tag) {
case 'N':
    return null;
case 'T':
  return Boolean.valueOf(true);
case 'F':
return Boolean.valueOf(false);
case 'I':
return Integer.valueOf(parseInt());
case 'L':
return Long.valueOf(parseLong());
case 'D':
return Double.valueOf(parseDouble());
case 'd':
return new Date(parseLong());
case 'x':
case 'X':
{
_isLastChunk=tag == 'X';
_chunkLength=(read() << 8) + read();
return parseXML();
}
case 's':
case 'S':
{
_isLastChunk=tag == 'S';
_chunkLength=(read() << 8) + read();
int data;
_sbuf.setLength(0);
while ((data=parseChar()) >= 0) _sbuf.append((char)data);
return _sbuf.toString();
}
case 'b':
case 'B':
{
_isLastChunk=tag == 'B';
_chunkLength=(read() << 8) + read();
int data;
ByteArrayOutputStream bos=new ByteArrayOutputStream();
while ((data=parseByte()) >= 0) bos.write(data);
return bos.toByteArray();
}
case 'V':
{
String type=readType();
int length=readLength();
return _serializerFactory.readList(this,length,type);
}
case 'M':
{
String type=readType();
return _serializerFactory.readMap(this,type);
}
case 'R':
{
int ref=parseInt();
return _refs.get(ref);
}
case 'r':
{
String type=readType();
String url=readString();
return resolveRemote(type,url);
}
default :
throw error("unknown code for readObject at " + codeName(tag));
}
}

public Object readObject ( ) throws IOException { int tag = read ( ) ; switch ( tag ) { case 'N' : return null ; case 'T' : return Boolean . valueOf ( true ) ; case 'F' : return Boolean . valueOf ( false ) ; case 'I' : return Integer . valueOf ( parseInt ( ) ) ; case 'L' : return Long . valueOf ( parseLong ( ) ) ; case 'D' : return Double . valueOf ( parseDouble ( ) ) ; case 'd' : return new Date ( parseLong ( ) ) ; case 'x' : case 'X' : { _isLastChunk = tag == 'X' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; return parseXML ( ) ; } case 's' : case 'S' : { _isLastChunk = tag == 'S' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; int data ; _sbuf . setLength ( 0 ) ; while ( ( data = parseChar ( ) ) >= 0 ) _sbuf . append ( ( char ) data ) ; return _sbuf . toString ( ) ; } case 'b' : case 'B' : { _isLastChunk = tag == 'B' ; _chunkLength = ( read ( ) << 8 ) + read ( ) ; int data ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; while ( ( data = parseByte ( ) ) >= 0 ) bos . write ( data ) ; return bos . toByteArray ( ) ; } case 'V' : { String type = readType ( ) ; int length = readLength ( ) ; return _serializerFactory . readList ( this , length , type ) ; } case 'M' : { String type = readType ( ) ; return _serializerFactory . readMap ( this , type ) ; } case 'R' : { int ref = parseInt ( ) ; return _refs . get ( ref ) ; } case 'r' : { String type = readType ( ) ; String url = readString ( ) ; return resolveRemote ( type , url ) ; } default : throw error ( "unknown code for readObject at " + codeName ( tag ) ) ; } }
reads an arbitrary object from the input stream when the type is unknown .
