SMILA 1.0 API documentation

org.eclipse.smila.datamodel.ipc
Class IpcAnyWriter

java.lang.Object
  extended by org.eclipse.smila.datamodel.ipc.IpcAnyWriter

public class IpcAnyWriter
extends java.lang.Object

Utility class for writing Any objects to binary (BON) and JSON.

Author:
aweber

Field Summary
static java.lang.String ENCODING
          Encoding to use for String (de)serialization.
 
Constructor Summary
IpcAnyWriter()
           
IpcAnyWriter(boolean printPretty)
           
 
Method Summary
 byte[] writeBinaryObject(Any any)
           
 void writeBinaryStream(Any any, java.io.OutputStream stream)
           
 java.lang.String writeJsonObject(Any any)
           
 void writeJsonStream(Any any, java.io.OutputStream stream)
           
 void writeStream(Any any, IpcStreamWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING

public static final java.lang.String ENCODING
Encoding to use for String (de)serialization.

See Also:
Constant Field Values
Constructor Detail

IpcAnyWriter

public IpcAnyWriter()

IpcAnyWriter

public IpcAnyWriter(boolean printPretty)
Parameters:
printPretty - whether JSON output should be formatted.
Method Detail

writeBinaryObject

public byte[] writeBinaryObject(Any any)
                         throws java.io.IOException
Parameters:
any - input Any object
Returns:
input Any converted to BON
Throws:
java.io.IOException

writeBinaryStream

public void writeBinaryStream(Any any,
                              java.io.OutputStream stream)
                       throws java.io.IOException
Parameters:
any - input
stream - stream to write the output in BON format.
Throws:
java.io.IOException

writeJsonObject

public java.lang.String writeJsonObject(Any any)
                                 throws java.io.IOException
Parameters:
any - input Any object
Returns:
input Any converted to JSON
Throws:
java.io.IOException

writeJsonStream

public void writeJsonStream(Any any,
                            java.io.OutputStream stream)
                     throws java.io.IOException
Parameters:
any - input
stream - stream to write the output as JSON.
Throws:
java.io.IOException

writeStream

public void writeStream(Any any,
                        IpcStreamWriter writer)
                 throws java.io.IOException
Parameters:
any - input
writer - writer with an underlying stream to write the ouput to.
Throws:
java.io.IOException

SMILA 1.0 API documentation