org.dhmp.io
Interface MapOutput

All Known Implementing Classes:
AbstractMapOutput, MapWriter

public interface MapOutput

Interface for writing HierarchicalMap to output drain.

Author:
hideyuki

Method Summary
 void close()
          Closes this output stream and releases any system resources associated with the stream.
 void flush()
          Flushes this output stream and forces any buffered output bytes to be written out.
 void flushAll()
          Flushes this output stream and also ends any HierarchicalMap written so far.
 void init(HierarchicalMap paramMap)
          Initializes this class using the configuration passed.
 void init(java.lang.String config)
          Initializes this class using the configuration passed.
 MapOutput writeMap(HierarchicalMap map)
          Writes out a HierarchicalMap to output drain.
 MapOutput writeMap(java.lang.Object start, HierarchicalMap map)
          Writes out a HierarchicalMap to output drain relative to the start.
 MapOutput writeMap(java.lang.String path)
          Writes a HierarchicalMap where each of the elements that composes the path are represented as nested nodes.
 

Method Detail

init

public void init(HierarchicalMap paramMap)
Initializes this class using the configuration passed. The configuration must be created using HierarchicalMap. The valid parameters are the same as from init(String). Configuration change is accepted until the first writing method is called.

Parameters:
paramMap - HierarchicalMap containing the configuration.

init

public void init(java.lang.String config)
Initializes this class using the configuration passed. The configuration must be in XML format like "<Param compress=\"true\"/>" or "<Param compress='true\'>". Note that first element must be "Param".

Configuration change is accepted until the first writing method is called. Check the specific MapOutput init method for valid configurations.

Parameters:
config - configuration used by this class.

writeMap

public MapOutput writeMap(HierarchicalMap map)
                   throws MapIOException
Writes out a HierarchicalMap to output drain.

Parameters:
map - HierarchicalMap to be written to the output.
Throws:
MapIOException - if an I/O error occurs.

writeMap

public MapOutput writeMap(java.lang.Object start,
                          HierarchicalMap map)
                   throws MapIOException
Writes out a HierarchicalMap to output drain relative to the start. Each element that composes the path "start" is written as node.

Parameters:
map - HierarchicalMap to be written to the output.
start - node from where the writing starts.
Throws:
MapIOException - if an I/O error occurs.

writeMap

public MapOutput writeMap(java.lang.String path)
                   throws MapIOException
Writes a HierarchicalMap where each of the elements that composes the path are represented as nested nodes. writeMap("a/b/c") is similar to the following code:
map.add("a/b/c")
 writeMap(map)

Parameters:
path - each element of the key is written as node.
Throws:
MapIOException - if an I/O error occurs.

flush

public void flush()
Flushes this output stream and forces any buffered output bytes to be written out.

Throws:
MapIOException - if an I/O error occurs.

flushAll

public void flushAll()
Flushes this output stream and also ends any HierarchicalMap written so far.

Throws:
MapIOException - if an I/O error occurs.

close

public void close()
Closes this output stream and releases any system resources associated with the stream.

Throws:
MapIOException - if an I/O error occurs.