}
public Object readObject() throws ClassNotFoundException, IOException {
int objectSize = in.readInt();
if (objectSize <= 0) {
throw new StreamCorruptedException("Invalid objectSize: "
+ objectSize);
}
if (objectSize > maxObjectSize) {
throw new StreamCorruptedException("ObjectSize too big: "
+ objectSize + " (expected: <= " + maxObjectSize + ')');
}
IoBuffer buf = IoBuffer.allocate(objectSize + 4, false);
buf.putInt(objectSize);