org.drools.core.util
Class DroolsStreamUtils

java.lang.Object
  extended by org.drools.core.util.DroolsStreamUtils

public class DroolsStreamUtils
extends Object

Created by IntelliJ IDEA. User: sg0521861 Date: Mar 27, 2008 Time: 8:56:14 AM Provide Drools specific streaming helper routines


Constructor Summary
DroolsStreamUtils()
           
 
Method Summary
static Object streamIn(byte[] bytes)
          This method reads the contents from the given byte array and returns the object.
static Object streamIn(byte[] bytes, boolean compressed)
          This method reads the contents from the given byte array and returns the object.
static Object streamIn(byte[] bytes, ClassLoader classLoader)
          This method reads the contents from the given byte array and returns the object.
static Object streamIn(byte[] bytes, ClassLoader classLoader, boolean compressed)
          This method reads the contents from the given byte array and returns the object.
static Object streamIn(InputStream in)
          This method reads the contents from the given input stream and returns the object.
static Object streamIn(InputStream in, ClassLoader classLoader)
          This method reads the contents from the given input stream and returns the object.
static Object streamIn(InputStream in, ClassLoader classLoader, boolean compressed)
          This method reads the contents from the given input stream and returns the object.
static byte[] streamOut(Object object)
          This routine would stream out the give object uncompressed and store the streamed contents in the return byte array.
static byte[] streamOut(Object object, boolean compressed)
          This routine would stream out the give object, uncompressed or compressed depending on the given flag, and store the streamed contents in the return byte array.
static void streamOut(OutputStream out, Object object)
          This method would stream out the given object to the given output stream uncompressed.
static void streamOut(OutputStream out, Object object, boolean compressed)
          This method would stream out the given object to the given output stream uncompressed or compressed depending on the given flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DroolsStreamUtils

public DroolsStreamUtils()
Method Detail

streamOut

public static byte[] streamOut(Object object)
                        throws IOException
This routine would stream out the give object uncompressed and store the streamed contents in the return byte array. The output contents could only be read by the corresponding "streamIn" method of this class.

Parameters:
object -
Returns:
Throws:
IOException

streamOut

public static byte[] streamOut(Object object,
                               boolean compressed)
                        throws IOException
This routine would stream out the give object, uncompressed or compressed depending on the given flag, and store the streamed contents in the return byte array. The output contents could only be read by the corresponding "streamIn" method of this class.

Parameters:
object -
compressed -
Returns:
Throws:
IOException

streamOut

public static void streamOut(OutputStream out,
                             Object object)
                      throws IOException
This method would stream out the given object to the given output stream uncompressed. The output contents could only be read by the corresponding "streamIn" method of this class.

Parameters:
out -
object -
Throws:
IOException

streamOut

public static void streamOut(OutputStream out,
                             Object object,
                             boolean compressed)
                      throws IOException
This method would stream out the given object to the given output stream uncompressed or compressed depending on the given flag. The output contents could only be read by the corresponding "streamIn" methods of this class.

Parameters:
out -
object -
Throws:
IOException

streamIn

public static Object streamIn(byte[] bytes)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given byte array and returns the object. It is expected that the contents in the given buffer was not compressed, and the content stream was written by the corresponding streamOut methods of this class.

Parameters:
bytes -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(byte[] bytes,
                              ClassLoader classLoader)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given byte array and returns the object. It is expected that the contents in the given buffer was not compressed, and the content stream was written by the corresponding streamOut methods of this class.

Parameters:
bytes -
classLoader -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(byte[] bytes,
                              boolean compressed)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given byte array and returns the object. The contents in the given buffer could be compressed or uncompressed depending on the given flag. It is assumed that the content stream was written by the corresponding streamOut methods of this class.

Parameters:
bytes -
compressed -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(byte[] bytes,
                              ClassLoader classLoader,
                              boolean compressed)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given byte array and returns the object. The contents in the given buffer could be compressed or uncompressed depending on the given flag. It is assumed that the content stream was written by the corresponding streamOut methods of this class.

Parameters:
bytes -
classLoader -
compressed -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(InputStream in)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given input stream and returns the object. It is expected that the contents in the given stream was not compressed, and it was written by the corresponding streamOut methods of this class.

Parameters:
in -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(InputStream in,
                              ClassLoader classLoader)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given input stream and returns the object. It is expected that the contents in the given stream was not compressed, and it was written by the corresponding streamOut methods of this class.

Parameters:
in -
classLoader -
Returns:
Throws:
IOException
ClassNotFoundException

streamIn

public static Object streamIn(InputStream in,
                              ClassLoader classLoader,
                              boolean compressed)
                       throws IOException,
                              ClassNotFoundException
This method reads the contents from the given input stream and returns the object. The contents in the given stream could be compressed or uncompressed depending on the given flag. It is assumed that the content stream was written by the corresponding streamOut methods of this class.

Parameters:
in -
Returns:
Throws:
IOException
ClassNotFoundException


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.