core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java
public StringBuilder toStream(final StringBuilder iOutput, Object iValue) {
    if (iValue != null) {
      if (iValue instanceof ODocumentSerializable)
        iValue = ((ODocumentSerializable) iValue).toDocument();

      if (!(iValue instanceof OSerializableStream))
        throw new OSerializationException(
            "Cannot serialize the object since it's not implements the OSerializableStream interface");

      OSerializableStream stream = (OSerializableStream) iValue;
      iOutput.append(iValue.getClass().getName());
      iOutput.append(SEPARATOR);
      try {
        iOutput.append(new String(stream.toStream(), "UTF-8"));
      } catch (UnsupportedEncodingException e) {
        throw OException.wrapException(new OSerializationException("Error serializing embedded object"), e);
      }
    }

    return iOutput;
  }
public StringBuilder toStream(final StringBuilder iOutput, Object iValue) {
    if (iValue != null) {
      if (iValue instanceof ODocumentSerializable)
        iValue = ((ODocumentSerializable) iValue).toDocument();

      if (!(iValue instanceof OSerializableStream))
        throw new OSerializationException(
            "Cannot serialize the object since it's not implements the OSerializableStream interface");

      OSerializableStream stream = (OSerializableStream) iValue;
      iOutput.append(iValue.getClass().getName());
      iOutput.append(SEPARATOR);
      try {
        iOutput.append(new String(stream.toStream(), "UTF-8"));
      } catch (UnsupportedEncodingException e) {
        throw OException.wrapException(new OSerializationException("Error serializing embedded object"), e);
      }
    }

    return iOutput;
  }
public StringBuilder toStream ( final StringBuilder iOutput , Object iValue ) { if ( iValue != null ) { if ( iValue instanceof ODocumentSerializable ) iValue = ( ( ODocumentSerializable ) iValue ) . toDocument ( ) ; if ( ! ( iValue instanceof OSerializableStream ) ) throw new OSerializationException ( "Cannot serialize the object since it's not implements the OSerializableStream interface" ) ; OSerializableStream stream = ( OSerializableStream ) iValue ; iOutput . append ( iValue . getClass ( ) . getName ( ) ) ; iOutput . append ( SEPARATOR ) ; try { iOutput . append ( new String ( stream . toStream ( ) , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw OException . wrapException ( new OSerializationException ( "Error serializing embedded object" ) , e ) ; } } return iOutput ; }
Serialize the class name size + class name + object content
Serialize the class name size + class name + object content