public void writeExternal(ObjectOutput out) throws IOException {
  try {
    out.writeInt(buildFlags());
    if (m_UID != null) {
      out.writeUTF(m_UID);
      out.writeInt(m_VersionID);
      if (m_TimeToLive != 0)       out.writeLong(m_TimeToLive);
    }
    if (m_ClassName != null) {
      out.writeUTF(m_ClassName);
    }
    if (m_FieldsValues != null) {
      int size=m_FieldsValues.length;
      out.writeInt(size);
      int numNonNullFields=0;
      boolean compressedMode=false;
      if (size > 3) {
        for (int i=0; i < size; i++) {
          if (m_FieldsValues[i] != null)           numNonNullFields++;
        }
        if (numNonNullFields < size / 2)         compressedMode=true;
        out.writeBoolean(compressedMode);
        if (compressedMode)         out.writeInt(numNonNullFields);
      }
      for (int i=0; i < size; i++) {
        if (m_FieldsValues[i] != null) {
          if (compressedMode)           out.writeInt(i);
 else           out.writeBoolean(true);
          writePrimitiveObject(out,m_FieldsValues[i],i);
        }
 else {
          if (!compressedMode)           out.writeBoolean(false);
        }
      }
    }
    if (m_FieldsNames != null) {
      out.writeInt(m_FieldsNames.length);
      for (int i=0; i < m_FieldsNames.length; i++)       out.writeUTF(m_FieldsNames[i]);
    }
    if (m_FieldsTypes != null) {
      out.writeInt(m_FieldsTypes.length);
      for (int i=0; i < m_FieldsTypes.length; i++)       out.writeUTF(m_FieldsTypes[i]);
    }
    if (m_IndexIndicators != null) {
      out.writeInt(m_IndexIndicators.length);
      for (int i=0; i < m_IndexIndicators.length; i++)       out.writeBoolean(m_IndexIndicators[i]);
    }
    out.writeShort(0);
    if (m_SuperClassesNames != null) {
      out.writeInt(m_SuperClassesNames.length);
      for (int i=0; i < m_SuperClassesNames.length; i++) {
        out.writeUTF(m_SuperClassesNames[i]);
      }
    }
    if (m_MultipleUIDs != null) {
      out.writeInt(m_MultipleUIDs.length);
      for (int i=0; i < m_MultipleUIDs.length; i++) {
        out.writeUTF(m_MultipleUIDs[i]);
      }
    }
    if (m_ExtendedMatchCodes != null) {
      out.writeInt(m_ExtendedMatchCodes.length);
      for (int i=0; i < m_ExtendedMatchCodes.length; i++) {
        out.writeShort(m_ExtendedMatchCodes[i]);
      }
    }
    if (m_RangeValues != null) {
      out.writeInt(m_RangeValues.length);
      for (int i=0; i < m_RangeValues.length; i++) {
        out.writeObject(m_RangeValues[i]);
      }
    }
    if (m_RangeValuesInclusion != null) {
      out.writeInt(m_RangeValuesInclusion.length);
      for (int i=0; i < m_RangeValuesInclusion.length; i++) {
        out.writeObject(m_RangeValuesInclusion[i]);
      }
    }
  }
 catch (  Exception ex) {
    if (ex instanceof EntrySerializationException)     throw (EntrySerializationException)ex;
    String className=m_ClassName != null ? m_ClassName : ".";
    throw new EntrySerializationException("Failed to serialize Entry " + className,ex);
  }
}

public void writeExternal ( ObjectOutput out ) throws IOException { try { out . writeInt ( buildFlags ( ) ) ; if ( m_UID != null ) { out . writeUTF ( m_UID ) ; out . writeInt ( m_VersionID ) ; if ( m_TimeToLive != 0 ) out . writeLong ( m_TimeToLive ) ; } if ( m_ClassName != null ) { out . writeUTF ( m_ClassName ) ; } if ( m_FieldsValues != null ) { int size = m_FieldsValues . length ; out . writeInt ( size ) ; int numNonNullFields = 0 ; boolean compressedMode = false ; if ( size > 3 ) { for ( int i = 0 ; i < size ; i ++ ) { if ( m_FieldsValues [ i ] != null ) numNonNullFields ++ ; } if ( numNonNullFields < size / 2 ) compressedMode = true ; out . writeBoolean ( compressedMode ) ; if ( compressedMode ) out . writeInt ( numNonNullFields ) ; } for ( int i = 0 ; i < size ; i ++ ) { if ( m_FieldsValues [ i ] != null ) { if ( compressedMode ) out . writeInt ( i ) ; else out . writeBoolean ( true ) ; writePrimitiveObject ( out , m_FieldsValues [ i ] , i ) ; } else { if ( ! compressedMode ) out . writeBoolean ( false ) ; } } } if ( m_FieldsNames != null ) { out . writeInt ( m_FieldsNames . length ) ; for ( int i = 0 ; i < m_FieldsNames . length ; i ++ ) out . writeUTF ( m_FieldsNames [ i ] ) ; } if ( m_FieldsTypes != null ) { out . writeInt ( m_FieldsTypes . length ) ; for ( int i = 0 ; i < m_FieldsTypes . length ; i ++ ) out . writeUTF ( m_FieldsTypes [ i ] ) ; } if ( m_IndexIndicators != null ) { out . writeInt ( m_IndexIndicators . length ) ; for ( int i = 0 ; i < m_IndexIndicators . length ; i ++ ) out . writeBoolean ( m_IndexIndicators [ i ] ) ; } out . writeShort ( 0 ) ; if ( m_SuperClassesNames != null ) { out . writeInt ( m_SuperClassesNames . length ) ; for ( int i = 0 ; i < m_SuperClassesNames . length ; i ++ ) { out . writeUTF ( m_SuperClassesNames [ i ] ) ; } } if ( m_MultipleUIDs != null ) { out . writeInt ( m_MultipleUIDs . length ) ; for ( int i = 0 ; i < m_MultipleUIDs . length ; i ++ ) { out . writeUTF ( m_MultipleUIDs [ i ] ) ; } } if ( m_ExtendedMatchCodes != null ) { out . writeInt ( m_ExtendedMatchCodes . length ) ; for ( int i = 0 ; i < m_ExtendedMatchCodes . length ; i ++ ) { out . writeShort ( m_ExtendedMatchCodes [ i ] ) ; } } if ( m_RangeValues != null ) { out . writeInt ( m_RangeValues . length ) ; for ( int i = 0 ; i < m_RangeValues . length ; i ++ ) { out . writeObject ( m_RangeValues [ i ] ) ; } } if ( m_RangeValuesInclusion != null ) { out . writeInt ( m_RangeValuesInclusion . length ) ; for ( int i = 0 ; i < m_RangeValuesInclusion . length ; i ++ ) { out . writeObject ( m_RangeValuesInclusion [ i ] ) ; } } } catch ( Exception ex ) { if ( ex instanceof EntrySerializationException ) throw ( EntrySerializationException ) ex ; String className = m_ClassName != null ? m_ClassName : "." ; throw new EntrySerializationException ( "Failed to serialize Entry " + className , ex ) ; } }
save the object contents by calling the methods of dataoutput for its primitive values or calling the writeobject method of objectoutput for objects , strings , and arrays .
