public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  try {
    int flags=in.readInt();
    if ((flags & BitMap.UID) != 0) {
      m_UID=in.readUTF();
      m_VersionID=in.readInt();
      if ((flags & BitMap.TIME_TO_LIVE) != 0)       m_TimeToLive=in.readLong();
    }
    if ((flags & BitMap.CLASSNAME) != 0) {
      m_ClassName=in.readUTF();
    }
    m_Replicatable=(flags & BitMap.REPLICATABLE) != 0;
    m_ReturnOnlyUids=(flags & BitMap.RETURN_ONLY_UIDS) != 0;
    m_isFifo=(flags & BitMap.IS_FIFO) != 0;
    m_isTransient=(flags & BitMap.IS_TRANSIENT) != 0;
    m_NOWriteLeaseMode=(flags & BitMap.NO_WRITE_LEASE) != 0;
    if ((flags & BitMap.FIELDS_VALUES) != 0) {
      int size=in.readInt();
      m_FieldsValues=new Object[size];
      int numNonNullFields=0;
      boolean compressedMode=false;
      if (size > 3) {
        compressedMode=in.readBoolean();
        if (compressedMode)         numNonNullFields=in.readInt();
      }
      if (compressedMode) {
        for (int i=0; i < numNonNullFields; i++) {
          int indx=in.readInt();
          m_FieldsValues[indx]=readPrimitiveObject(in,indx);
        }
      }
 else {
        for (int i=0; i < size; i++) {
          if (in.readBoolean())           m_FieldsValues[i]=readPrimitiveObject(in,i);
        }
      }
    }
    if ((flags & BitMap.FIELDS_NAMES) != 0) {
      int size=in.readInt();
      m_FieldsNames=new String[size];
      for (int i=0; i < size; i++) {
        m_FieldsNames[i]=in.readUTF();
      }
    }
    if ((flags & BitMap.FIELDS_TYPES) != 0) {
      int size=in.readInt();
      m_FieldsTypes=new String[size];
      for (int i=0; i < size; i++) {
        m_FieldsTypes[i]=in.readUTF();
      }
    }
    if ((flags & BitMap.INDEX_INDICATORS) != 0) {
      int size=in.readInt();
      m_IndexIndicators=new boolean[size];
      for (int i=0; i < size; i++) {
        m_IndexIndicators[i]=in.readBoolean();
      }
    }
    int objectFormat=in.readShort();
    if ((flags & BitMap.SUPER_CLASSES) != 0) {
      int size=in.readInt();
      m_SuperClassesNames=new String[size];
      for (int i=0; i < size; i++)       m_SuperClassesNames[i]=in.readUTF();
    }
    if ((flags & BitMap.MULTIPLE_UIDS) != 0) {
      int size=in.readInt();
      m_MultipleUIDs=new String[size];
      for (int i=0; i < size; i++)       m_MultipleUIDs[i]=in.readUTF();
    }
    if ((flags & BitMap.EXTENDED_MATCH) != 0) {
      int size=in.readInt();
      m_ExtendedMatchCodes=new short[size];
      for (int i=0; i < size; i++)       m_ExtendedMatchCodes[i]=in.readShort();
    }
    if ((flags & BitMap.RANGE_VALUES) != 0) {
      int size=in.readInt();
      m_RangeValues=new Object[size];
      for (int i=0; i < size; i++)       m_RangeValues[i]=in.readObject();
    }
    if ((flags & BitMap.RANGE_INCLUSION) != 0) {
      int size=in.readInt();
      m_RangeValuesInclusion=new boolean[size];
      for (int i=0; i < size; i++)       m_RangeValuesInclusion[i]=in.readBoolean();
    }
  }
 catch (  Exception ex) {
    if (ex instanceof EntrySerializationException)     throw (EntrySerializationException)ex;
    String className=m_ClassName != null ? m_ClassName : ".";
    throw new EntrySerializationException("Failed to deserialize Entry " + className,ex);
  }
}

public void readExternal ( ObjectInput in ) throws IOException , ClassNotFoundException { try { int flags = in . readInt ( ) ; if ( ( flags & BitMap . UID ) != 0 ) { m_UID = in . readUTF ( ) ; m_VersionID = in . readInt ( ) ; if ( ( flags & BitMap . TIME_TO_LIVE ) != 0 ) m_TimeToLive = in . readLong ( ) ; } if ( ( flags & BitMap . CLASSNAME ) != 0 ) { m_ClassName = in . readUTF ( ) ; } m_Replicatable = ( flags & BitMap . REPLICATABLE ) != 0 ; m_ReturnOnlyUids = ( flags & BitMap . RETURN_ONLY_UIDS ) != 0 ; m_isFifo = ( flags & BitMap . IS_FIFO ) != 0 ; m_isTransient = ( flags & BitMap . IS_TRANSIENT ) != 0 ; m_NOWriteLeaseMode = ( flags & BitMap . NO_WRITE_LEASE ) != 0 ; if ( ( flags & BitMap . FIELDS_VALUES ) != 0 ) { int size = in . readInt ( ) ; m_FieldsValues = new Object [ size ] ; int numNonNullFields = 0 ; boolean compressedMode = false ; if ( size > 3 ) { compressedMode = in . readBoolean ( ) ; if ( compressedMode ) numNonNullFields = in . readInt ( ) ; } if ( compressedMode ) { for ( int i = 0 ; i < numNonNullFields ; i ++ ) { int indx = in . readInt ( ) ; m_FieldsValues [ indx ] = readPrimitiveObject ( in , indx ) ; } } else { for ( int i = 0 ; i < size ; i ++ ) { if ( in . readBoolean ( ) ) m_FieldsValues [ i ] = readPrimitiveObject ( in , i ) ; } } } if ( ( flags & BitMap . FIELDS_NAMES ) != 0 ) { int size = in . readInt ( ) ; m_FieldsNames = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { m_FieldsNames [ i ] = in . readUTF ( ) ; } } if ( ( flags & BitMap . FIELDS_TYPES ) != 0 ) { int size = in . readInt ( ) ; m_FieldsTypes = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { m_FieldsTypes [ i ] = in . readUTF ( ) ; } } if ( ( flags & BitMap . INDEX_INDICATORS ) != 0 ) { int size = in . readInt ( ) ; m_IndexIndicators = new boolean [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { m_IndexIndicators [ i ] = in . readBoolean ( ) ; } } int objectFormat = in . readShort ( ) ; if ( ( flags & BitMap . SUPER_CLASSES ) != 0 ) { int size = in . readInt ( ) ; m_SuperClassesNames = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) m_SuperClassesNames [ i ] = in . readUTF ( ) ; } if ( ( flags & BitMap . MULTIPLE_UIDS ) != 0 ) { int size = in . readInt ( ) ; m_MultipleUIDs = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) m_MultipleUIDs [ i ] = in . readUTF ( ) ; } if ( ( flags & BitMap . EXTENDED_MATCH ) != 0 ) { int size = in . readInt ( ) ; m_ExtendedMatchCodes = new short [ size ] ; for ( int i = 0 ; i < size ; i ++ ) m_ExtendedMatchCodes [ i ] = in . readShort ( ) ; } if ( ( flags & BitMap . RANGE_VALUES ) != 0 ) { int size = in . readInt ( ) ; m_RangeValues = new Object [ size ] ; for ( int i = 0 ; i < size ; i ++ ) m_RangeValues [ i ] = in . readObject ( ) ; } if ( ( flags & BitMap . RANGE_INCLUSION ) != 0 ) { int size = in . readInt ( ) ; m_RangeValuesInclusion = new boolean [ size ] ; for ( int i = 0 ; i < size ; i ++ ) m_RangeValuesInclusion [ i ] = in . readBoolean ( ) ; } } catch ( Exception ex ) { if ( ex instanceof EntrySerializationException ) throw ( EntrySerializationException ) ex ; String className = m_ClassName != null ? m_ClassName : "." ; throw new EntrySerializationException ( "Failed to deserialize Entry " + className , ex ) ; } }
restore the class contents by calling the methods of datainput for primitive types and readobject for objects , strings and arrays .
