コード例 #1
0
  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);
    }
  }
コード例 #2
0
 public Object readData(
     ClassLoader loader,
     StreamingClass streaming,
     ClassMetaData metaData,
     int referenceId,
     ObjectsCache cache,
     ObjectInput input,
     ObjectSubstitutionInterface substitution)
     throws IOException {
   Object obj = metaData.newInstance();
   cache.putObjectInCacheRead(referenceId, obj);
   return defaultRead(input, obj, streaming, metaData, substitution);
 }
コード例 #3
0
  public static void defaultWrite(
      ObjectOutput output,
      Object obj,
      ClassMetaData metaClass,
      ObjectSubstitutionInterface substitution)
      throws IOException {
    ClassMetaDataSlot slots[] = metaClass.getSlots();

    for (int slotNr = 0; slotNr < slots.length; slotNr++) {
      if (slots[slotNr].getPrivateMethodWrite() != null) {
        writeSlotWithMethod(slots[slotNr], output, obj, substitution);
      } else {
        writeSlotWithFields(slots[slotNr], output, obj, substitution);
      }
    }
  }