initializeReading();
try {
this.dataIn.mark(65);
int type = this.dataIn.read();
if (type == -1) {
throw new MessageEOFException("reached end of data");
}
if (type == MarshallingSupport.NULL) {
return null;
}
if (type == MarshallingSupport.BIG_STRING_TYPE) {
return MarshallingSupport.readUTF8(dataIn);
}
if (type == MarshallingSupport.STRING_TYPE) {
return this.dataIn.readUTF();
}
if (type == MarshallingSupport.LONG_TYPE) {
return Long.valueOf(this.dataIn.readLong());
}
if (type == MarshallingSupport.INTEGER_TYPE) {
return Integer.valueOf(this.dataIn.readInt());
}
if (type == MarshallingSupport.SHORT_TYPE) {
return Short.valueOf(this.dataIn.readShort());
}
if (type == MarshallingSupport.BYTE_TYPE) {
return Byte.valueOf(this.dataIn.readByte());
}
if (type == MarshallingSupport.FLOAT_TYPE) {
return new Float(this.dataIn.readFloat());
}
if (type == MarshallingSupport.DOUBLE_TYPE) {
return new Double(this.dataIn.readDouble());
}
if (type == MarshallingSupport.BOOLEAN_TYPE) {
return this.dataIn.readBoolean() ? Boolean.TRUE : Boolean.FALSE;
}
if (type == MarshallingSupport.CHAR_TYPE) {
return Character.valueOf(this.dataIn.readChar());
}
if (type == MarshallingSupport.BYTE_ARRAY_TYPE) {
int len = this.dataIn.readInt();
byte[] value = new byte[len];
this.dataIn.readFully(value);
return value;
} else {
this.dataIn.reset();
throw new MessageFormatException("unknown type");
}
} catch (NumberFormatException mfe) {
try {
this.dataIn.reset();
} catch (IOException ioe) {
throw JMSExceptionSupport.create(ioe);
}
throw mfe;
} catch (EOFException e) {
JMSException jmsEx = new MessageEOFException(e.getMessage());
jmsEx.setLinkedException(e);
throw jmsEx;
} catch (IOException e) {
JMSException jmsEx = new MessageFormatException(e.getMessage());
jmsEx.setLinkedException(e);
throw jmsEx;
}
}