SMILA (incubation) API documentation

org.eclipse.smila.ipc.json
Class JsonStreamWriter

java.lang.Object
  extended by org.eclipse.smila.ipc.json.JsonStreamWriter
All Implemented Interfaces:
IpcStreamWriter

public class JsonStreamWriter
extends java.lang.Object
implements IpcStreamWriter

IPC writer implementation for the JSON protocol.

Author:
aweber

Method Summary
 void close()
          Closes the writer and the underlying stream.
 void closeWithoutStream()
          Closes the writer but NOT the underlying stream.
 void writeMappingEnd()
          Writes marker signaling end of a mapping.
 void writeMappingKey(java.lang.String s)
          Writes a mapping key.
 void writeMappingStart()
          Writes marker signaling start of a mapping.
 void writeObjectEnd()
          JSON serialization does not support DOCUMENT_END tokens, so this does nothing.
 void writeObjectStart()
          JSON serialization does not support DOCUMENT_START tokens, so this does nothing.
 void writeScalarBoolean(boolean b)
          Writes boolean value.
 void writeScalarDouble(double d)
          Writes double value.
 void writeScalarInt(int i)
          Writes integer value.
 void writeScalarLong(long i)
          Writes long value.
 void writeScalarString(java.lang.String s)
          Writes string value.
 void writeSequenceEnd()
          Writes marker signaling end of a sequence.
 void writeSequenceStart()
          Writes marker signaling start of a sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
           throws java.io.IOException
Closes the writer and the underlying stream.

Specified by:
close in interface IpcStreamWriter
Throws:
java.io.IOException - any error

closeWithoutStream

public void closeWithoutStream()
                        throws java.io.IOException
Closes the writer but NOT the underlying stream.

Specified by:
closeWithoutStream in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeObjectEnd

public void writeObjectEnd()
                    throws java.io.IOException
JSON serialization does not support DOCUMENT_END tokens, so this does nothing. Writes marker signaling end of an object (resp. a document). Will be ignored if underlying implementation doesn't support this kind of marker.

Specified by:
writeObjectEnd in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeObjectStart

public void writeObjectStart()
                      throws java.io.IOException
JSON serialization does not support DOCUMENT_START tokens, so this does nothing. Writes marker signaling start of an object (resp. a document). Will be ignored if underlying implementation doesn't support this kind of marker.

Specified by:
writeObjectStart in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeMappingEnd

public void writeMappingEnd()
                     throws java.io.IOException
Writes marker signaling end of a mapping.

Specified by:
writeMappingEnd in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeMappingStart

public void writeMappingStart()
                       throws java.io.IOException
Writes marker signaling start of a mapping.

Specified by:
writeMappingStart in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeScalarBoolean

public void writeScalarBoolean(boolean b)
                        throws java.io.IOException
Writes boolean value. any error

Specified by:
writeScalarBoolean in interface IpcStreamWriter
Parameters:
b - value to write
Throws:
java.io.IOException - any error

writeScalarDouble

public void writeScalarDouble(double d)
                       throws java.io.IOException
Writes double value.

Specified by:
writeScalarDouble in interface IpcStreamWriter
Parameters:
d - value to write
Throws:
java.io.IOException - any error

writeScalarInt

public void writeScalarInt(int i)
                    throws java.io.IOException
Writes integer value.

Specified by:
writeScalarInt in interface IpcStreamWriter
Parameters:
i - value to write
Throws:
java.io.IOException - any error

writeScalarLong

public void writeScalarLong(long i)
                     throws java.io.IOException
Writes long value.

Specified by:
writeScalarLong in interface IpcStreamWriter
Parameters:
i - value to write
Throws:
java.io.IOException - any error

writeScalarString

public void writeScalarString(java.lang.String s)
                       throws java.io.IOException
Writes string value.

Specified by:
writeScalarString in interface IpcStreamWriter
Parameters:
s - value to write
Throws:
java.io.IOException - any error

writeSequenceEnd

public void writeSequenceEnd()
                      throws java.io.IOException
Writes marker signaling end of a sequence.

Specified by:
writeSequenceEnd in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeSequenceStart

public void writeSequenceStart()
                        throws java.io.IOException
Writes marker signaling start of a sequence.

Specified by:
writeSequenceStart in interface IpcStreamWriter
Throws:
java.io.IOException - any error

writeMappingKey

public void writeMappingKey(java.lang.String s)
                     throws java.io.IOException
Writes a mapping key. Depending on the underlying implementation there may be no difference to just writing a scalar string. But e.g. in JSON keys are completed by an additional ":".

Specified by:
writeMappingKey in interface IpcStreamWriter
Parameters:
s - value to write
Throws:
java.io.IOException - any error

SMILA (incubation) API documentation