|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.asn1.codec.stateful.AbstractStatefulEncoder
org.apache.asn1.ber.TupleEncodingVisitor
public class TupleEncodingVisitor
A tuple tree visitor that encodes tuples in prefix order into a buffer, and chunking the buffer via callbacks as it is filled. This encoder will work on both determinate and indeterminate tuples. However all indeterminate tuples must be followed in sequence by an indeterminate terminator tuple.
Field Summary | |
---|---|
private java.util.ArrayList |
buffers
The List storing the ByteBuffers collected during a visitation |
private static java.nio.ByteBuffer[] |
EMPTY_ARRAY
An empty buffer array so we do not recreate every time on toArray |
private VisitorMonitor |
visitorMonitor
The visitor monitor used by this TupleNodeVisitor |
Constructor Summary | |
---|---|
TupleEncodingVisitor()
|
Method Summary | |
---|---|
boolean |
canVisit(TupleNode node)
Checks to see if a node can be visited. |
void |
encode(java.lang.Object obj)
|
void |
flush()
Flushes out the array of ByteBuffer's collected during the visitation. |
java.util.ArrayList |
getOrder(TupleNode node,
java.util.ArrayList children)
Get the array of children to visit sequentially to determine the order of child visitations. |
boolean |
isPrefix()
Determines whether the visitation order is prefix or postfix. |
void |
setMonitor(VisitorMonitor monitor)
Sets the monitoring which recieves callbacks of notable events from this visitor. |
void |
visit(TupleNode node)
Visits a tree of tuple nodes using a specific visitation order. |
Methods inherited from class org.apache.asn1.codec.stateful.AbstractStatefulEncoder |
---|
encodeOccurred, getEncoderMonitor, setCallback, setEncoderMonitor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.nio.ByteBuffer[] EMPTY_ARRAY
private java.util.ArrayList buffers
private VisitorMonitor visitorMonitor
Constructor Detail |
---|
public TupleEncodingVisitor()
Method Detail |
---|
public void encode(java.lang.Object obj) throws org.apache.asn1.codec.EncoderException
encode
in interface org.apache.asn1.codec.stateful.StatefulEncoder
org.apache.asn1.codec.EncoderException
public void visit(TupleNode node)
visit
in interface TupleNodeVisitor
node
- the node to visitpublic boolean canVisit(TupleNode node)
canVisit
in interface TupleNodeVisitor
node
- the node to be visited
public boolean isPrefix()
isPrefix
in interface TupleNodeVisitor
public java.util.ArrayList getOrder(TupleNode node, java.util.ArrayList children)
getOrder
in interface TupleNodeVisitor
node
- the parent branch nodechildren
- the child node array
public void flush()
public void setMonitor(VisitorMonitor monitor)
TupleNodeVisitor
setMonitor
in interface TupleNodeVisitor
monitor
- the monitor instance for the visitor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |