Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2010 JBoss Inc
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.drools.marshalling;
public interface ObjectMarshallingStrategy {
    
    public boolean accept(Object object);
    public void write(ObjectOutputStream os,
                      Object objectthrows IOException;
    
    public Object read(ObjectInputStream osthrows IOExceptionClassNotFoundException;
    
    
This method is analogous to the write() method, but instead of writing the object into an output stream, it returns the marshalled object as a byte[].

Parameters:
the context for this strategy created by the method #createContext()
object the object to be marshalled
Returns:
the marshalled byte[] of the input object
    public byte[] marshalContext context,
                           ObjectOutputStream os,
                           Object object ) throws IOException;
    
    
This method is analogous to the read method, but instead of reading it from an input stream, it reads it from a byte[]

Parameters:
the context for this strategy created by the method #createContext()
object the marshalled object in a byte[]
Returns:
the unmarshalled Object
    public Object unmarshalContext context,
                             ObjectInputStream is,
                             byte[] object,
                             ClassLoader classloader ) throws IOExceptionClassNotFoundException;

    
Creates a new marshalling context
    public Context createContext();
    
    public static interface Context {
        
Loads the context from the given object input stream
        public void read(ObjectInputStream oisthrows IOExceptionClassNotFoundException;

        
Writes the context to the given object output stream
        public void write(ObjectOutputStream oosthrows IOException;
    }
New to GrepCode? Check out our FAQ X