// copy the bytes before passing to the ByteArrayInputStream, since it mutates
// the array
byte[] copyBytes = Arrays.copyOf(serializedBytes, serializedBytes.length);
ByteArrayInputStream baos = new ByteArrayInputStream(copyBytes);
ObjectInputStream ois = new ObjectInputStreamResolveClass(baos);
deserializedObject = ois.readObject();
ois.close();
}
catch (IOException e)
{
throw new IllegalArgumentException(e);
}