public static Object defaultRead( ObjectInput input, Object obj, StreamingClass streaming, ClassMetaData metaData, ObjectSubstitutionInterface substitution) throws IOException { try { ClassMetaDataSlot[] slots = metaData.getSlots(); for (int slotNR = 0; slotNR < slots.length; slotNR++) { ClassMetaDataSlot slot = metaData.getSlots()[slotNR]; if (slot.getPrivateMethodRead() != null) { readSlotWithMethod(slot, streaming.getKeyFields()[slotNR], input, obj, substitution); } // else if (slot.getPrivateMethodWrite() != null) // { // readSlotWithDefaultMethod(slot, streaming.getKeyFields()[slotNR], input, // obj); // } else { readSlotWithFields(streaming.getKeyFields()[slotNR], slot, input, obj); } } return obj; } catch (ClassNotFoundException e) { throw new SerializationException("Error reading " + obj.getClass().getName(), e); } }
private static void readSlotWithMethod( ClassMetaDataSlot slot, short[] fieldsKey, ObjectInput input, Object obj, ObjectSubstitutionInterface substitution) throws IOException { try { slot.getPrivateMethodRead() .invoke( obj, new Object[] {new ObjectInputStreamProxy(input, fieldsKey, obj, slot, substitution)}); } catch (IOException e) { throw e; } catch (Exception e) { IOException io = new IOException(e.getMessage()); io.initCause(e); throw io; } }