}
private Object readExternal (Kryo kryo, Input input, Class type) {
try {
Externalizable object = (Externalizable)type.newInstance();
object.readExternal(getObjectInput(kryo, input));
return object;
} catch (ClassCastException e) {
throw new KryoException(e);
} catch (ClassNotFoundException e) {
throw new KryoException(e);