Package org.drools.core.util
Class DroolsStreamUtils
- java.lang.Object
-
- 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
Constructors Constructor Description DroolsStreamUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectstreamIn(byte[] bytes)This method reads the contents from the given byte array and returns the object.static ObjectstreamIn(byte[] bytes, boolean compressed)This method reads the contents from the given byte array and returns the object.static ObjectstreamIn(byte[] bytes, ClassLoader classLoader)This method reads the contents from the given byte array and returns the object.static ObjectstreamIn(byte[] bytes, ClassLoader classLoader, boolean compressed)This method reads the contents from the given byte array and returns the object.static ObjectstreamIn(InputStream in)This method reads the contents from the given input stream and returns the object.static ObjectstreamIn(InputStream in, ClassLoader classLoader)This method reads the contents from the given input stream and returns the object.static ObjectstreamIn(InputStream in, ClassLoader classLoader, boolean compressed)This method reads the contents from the given input stream and returns the object.static voidstreamOut(OutputStream out, Object object)This method would stream out the given object to the given output stream uncompressed.static voidstreamOut(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.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.
-
-
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
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:
IOExceptionClassNotFoundException
-
-