core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/stream/OStreamSerializerAnyStreamable.java
public OCommandRequestText fromStream(final byte[] iStream, ORecordSerializer serializer) throws IOException {
    if (iStream == null || iStream.length == 0)
      // NULL VALUE
      return null;

    final int classNameSize = OBinaryProtocol.bytes2int(iStream);

    if (classNameSize <= 0) {
      final String message = "Class signature not found in ANY element: " + Arrays.toString(iStream);
      OLogManager.instance().error(this, message, null);

      throw new OSerializationException(message);
    }


    final String className = new String(iStream,4,classNameSize,"UTF-8");

    try {
      final OCommandRequestText stream;
      // CHECK FOR ALIASES
      if (className.equalsIgnoreCase("q"))
        // QUERY
        stream = new OSQLSynchQuery<Object>();
      else if (className.equalsIgnoreCase("c"))
        // SQL COMMAND
        stream = new OCommandSQL();
      else if (className.equalsIgnoreCase("s"))
        // SCRIPT COMMAND
        stream = new OCommandScript();
      else
        // CREATE THE OBJECT BY INVOKING THE EMPTY CONSTRUCTOR
        stream = (OCommandRequestText) Class.forName(className).newInstance();

      return stream.fromStream(OArrays.copyOfRange(iStream, 4 + classNameSize, iStream.length), serializer);

    } catch (Exception e) {
      final String message = "Error on unmarshalling content. Class: " + className;
      OLogManager.instance().error(this, message, e);
      throw OException.wrapException(new OSerializationException(message), e);
    }
  }
public OCommandRequestText fromStream(final byte[] iStream, ORecordSerializer serializer) throws IOException {
    if (iStream == null || iStream.length == 0)
      // NULL VALUE
      return null;

    final int classNameSize = OBinaryProtocol.bytes2int(iStream);

    if (classNameSize <= 0) {
      final String message = "Class signature not found in ANY element: " + Arrays.toString(iStream);
      OLogManager.instance().error(this, message, null);

      throw new OSerializationException(message);
    }


    final String className = new String(iStream,4,classNameSize,"UTF-8");

    try {
      final OCommandRequestText stream;
      // CHECK FOR ALIASES
      if (className.equalsIgnoreCase("q"))
        // QUERY
        stream = new OSQLSynchQuery<Object>();
      else if (className.equalsIgnoreCase("c"))
        // SQL COMMAND
        stream = new OCommandSQL();
      else if (className.equalsIgnoreCase("s"))
        // SCRIPT COMMAND
        stream = new OCommandScript();
      else
        // CREATE THE OBJECT BY INVOKING THE EMPTY CONSTRUCTOR
        stream = (OCommandRequestText) Class.forName(className).newInstance();

      return stream.fromStream(OArrays.copyOfRange(iStream, 4 + classNameSize, iStream.length), serializer);

    } catch (Exception e) {
      final String message = "Error on unmarshalling content. Class: " + className;
      OLogManager.instance().error(this, message, e);
      throw OException.wrapException(new OSerializationException(message), e);
    }
  }
public OCommandRequestText fromStream ( final byte [ ] iStream , ORecordSerializer serializer ) throws IOException { if ( iStream == null || iStream . length == 0 ) // NULL VALUE
 return null ; final int classNameSize = OBinaryProtocol . bytes2int ( iStream ) ; if ( classNameSize <= 0 ) { final String message = "Class signature not found in ANY element: " + Arrays . toString ( iStream ) ; OLogManager . instance ( ) . error ( this , message , null ) ; throw new OSerializationException ( message ) ; } final String className = new String ( iStream , 4 , classNameSize , "UTF-8" ) ; try { final OCommandRequestText stream ; // CHECK FOR ALIASES
 if ( className . equalsIgnoreCase ( "q" ) ) // QUERY
 stream = new OSQLSynchQuery < Object > ( ) ; else if ( className . equalsIgnoreCase ( "c" ) ) // SQL COMMAND
 stream = new OCommandSQL ( ) ; else if ( className . equalsIgnoreCase ( "s" ) ) // SCRIPT COMMAND
 stream = new OCommandScript ( ) ; else // CREATE THE OBJECT BY INVOKING THE EMPTY CONSTRUCTOR
 stream = ( OCommandRequestText ) Class . forName ( className ) . newInstance ( ) ; return stream . fromStream ( OArrays . copyOfRange ( iStream , 4 + classNameSize , iStream . length ) , serializer ) ; } catch ( Exception e ) { final String message = "Error on unmarshalling content. Class: " + className ; OLogManager . instance ( ) . error ( this , message , e ) ; throw OException . wrapException ( new OSerializationException ( message ) , e ) ; } }
Re-Create any object if the class has a public constructor that accepts a String as unique parameter.
Re - Create any object if the class has a public constructor that accepts a String as unique parameter .