obixserver.core
Class ControlledObixEncoder

java.lang.Object
  extended by java.io.Writer
      extended by obix.xml.XWriter
          extended by obix.io.ObixEncoder
              extended by obixserver.core.ControlledObixEncoder
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class ControlledObixEncoder
extends obix.io.ObixEncoder

Encoder that can be controlled to emit only a subset of tree instead of recursing to all children

Author:
peter

Field Summary
private  int indent
           
private  int maxRecursion
          Recursion level to include into.
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ControlledObixEncoder(OutputStream out, int maxRecursion)
           
 
Method Summary
 void encode(obix.Obj obj)
           
 void encode(String serverName, obix.Obj obj)
          Encode an object and it's children.
private  boolean isMaxRecursionReached()
           
static String toString(obix.Obj obj)
          Encode the specified obj to an internal String.
static String toString(obix.Obj obj, int recurseLevel)
           
static String toString(String serverName, obix.Obj obj, int recurseLevel)
          Encode the specified obj to an internal String.
 
Methods inherited from class obix.io.ObixEncoder
dump, encodeDocument
 
Methods inherited from class obix.xml.XWriter
attr, close, flush, indent, isZipped, nl, prolog, safe, safe, safe, safe, safe, setZipped, w, w, w, w, w, w, w, write, write, write, write, write
 
Methods inherited from class java.io.Writer
append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxRecursion

private int maxRecursion
Recursion level to include into. 0 means recurse infinitely.


indent

private int indent
Constructor Detail

ControlledObixEncoder

public ControlledObixEncoder(OutputStream out,
                             int maxRecursion)
                      throws IOException
Throws:
IOException
Method Detail

encode

public void encode(obix.Obj obj)
            throws IOException
Overrides:
encode in class obix.io.ObixEncoder
Throws:
IOException

encode

public void encode(String serverName,
                   obix.Obj obj)
            throws IOException
Encode an object and it's children.

Throws:
IOException

isMaxRecursionReached

private boolean isMaxRecursionReached()

toString

public static String toString(obix.Obj obj)
Encode the specified obj to an internal String.


toString

public static String toString(obix.Obj obj,
                              int recurseLevel)

toString

public static String toString(String serverName,
                              obix.Obj obj,
                              int recurseLevel)
Encode the specified obj to an internal String.



Copyright © 2006-2008 Peter Michalek All Rights Reserved.