Class StreamWorker
- java.lang.Object
-
- net.sourceforge.jbizmo.commons.stream.StreamWorker
-
public class StreamWorker extends Object
Utility class to provide common operations upon streams that are used for the communication between client and server
Copyright 2010 (C) by Martin Ganserer
- Version:
- 1.0.0
- Author:
- Martin Ganserer
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BUFFER_SIZE
-
Constructor Summary
Constructors Constructor Description StreamWorker()Default constructorStreamWorker(int bufferSize)Constructor to define the size of the internal buffer
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectreadObjectFromStream(InputStream in, boolean decrypt)Read a serialized object from an input streamvoidwriteObjectToStream(Serializable object, OutputStream out, boolean encrypt)Write an object to an output streamvoidwriteToOutput(InputStream in, OutputStream out, boolean encryptOutput, boolean decryptInput)Write data from an input stream to an output stream
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
writeToOutput
public void writeToOutput(InputStream in, OutputStream out, boolean encryptOutput, boolean decryptInput) throws Exception
Write data from an input stream to an output stream- Parameters:
in-out-encryptOutput-decryptInput-- Throws:
Exception- if the stream operation has failed
-
readObjectFromStream
public Object readObjectFromStream(InputStream in, boolean decrypt) throws Exception
Read a serialized object from an input stream- Parameters:
in-decrypt-- Returns:
- the object
- Throws:
Exception- if the object could not be created from the provided input stream
-
writeObjectToStream
public void writeObjectToStream(Serializable object, OutputStream out, boolean encrypt) throws Exception
Write an object to an output stream- Parameters:
object-out-encrypt-- Throws:
Exception- if the object could not be serialized
-
-