if (dataLen > maxObjectSize) {
throw new StreamCorruptedException(
"data length too big: " + dataLen + " (max: " + maxObjectSize + ')');
}
ByteArray data = buffer.read(dataLen);
return new CompactObjectInputStream(new ByteArrayInputStream(data)).readObject();
}