Examples of DroolsObjectOutputStream


Examples of org.drools.core.common.DroolsObjectOutputStream

    /**
     * Handles the write serialization of the Package. Patterns in Rules may reference generated data which cannot be serialized by default methods.
     * The Package uses PackageCompilationData to hold a reference to the generated bytecode. The generated bytecode must be restored before any Rules.
     */
    public void writeExternal(final ObjectOutput stream) throws IOException {
        DroolsObjectOutputStream droolsStream;
        boolean isDrools = stream instanceof DroolsObjectOutputStream;
        ByteArrayOutputStream bytes = null;
       
        stream.writeBoolean( isDrools );
        if ( isDrools ) {
            droolsStream = (DroolsObjectOutputStream) stream;
        } else {
            bytes = new ByteArrayOutputStream();
            droolsStream = new DroolsObjectOutputStream( bytes );
        }
       
        super.writeExternal( droolsStream );
        droolsStream.writeObject( this.reteooBuilder );
        droolsStream.writeObject( this.rete );

        if ( !isDrools ) {
            droolsStream.flush();
            droolsStream.close();
            bytes.close();
            stream.writeObject( bytes.toByteArray() );
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.