org.apache.vinci.transport
public abstract class Frame extends FrameComponent implements Transportable
Modifier | Constructor and Description |
---|---|
protected |
Frame() |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String tag,
FrameComponent val)
Add a tagged value to this frame (value is either a Frame or FrameLeaf).
|
FrameLeaf |
createFrameLeaf(byte[] array)
Factory method used by fromStream when it needs to create a frame leaf.
|
Frame |
createSubFrame(java.lang.String tag_name,
int initialCapacity)
Factory method used by fromStream when it needs to create a sub-frame.
|
Frame |
fadd(java.lang.String key)
Decorator method for adding a valueless tag.
|
Frame |
fadd(java.lang.String key,
boolean val)
Decorator method for adding boolean valued tags.
|
Frame |
fadd(java.lang.String key,
byte[] val)
Decorator method for adding binary valued tags.
|
Frame |
fadd(java.lang.String key,
double val)
Decorator method for adding double valued tags.
|
Frame |
fadd(java.lang.String key,
double[] val)
Decorator method for adding double-array valued tags.
|
Frame |
fadd(java.lang.String key,
float val)
Decorator method for adding float-valued tags.
|
Frame |
fadd(java.lang.String key,
float[] val)
Decorator method for adding float-array valued tags.
|
Frame |
fadd(java.lang.String key,
Frame val)
Decorator method for adding Frame-valued tags.
|
Frame |
fadd(java.lang.String key,
int val)
Decorator method for adding int valued tags.
|
Frame |
fadd(java.lang.String key,
int[] val)
Decorator method for adding int-array valued tags.
|
Frame |
fadd(java.lang.String key,
long val)
Decorator method for adding long valued tags.
|
Frame |
fadd(java.lang.String key,
long[] val)
Decorator method for adding long-array valued tags.
|
Frame |
fadd(java.lang.String key,
java.lang.String val)
Decorator method for adding String valued tags.
|
Frame |
fadd(java.lang.String key,
java.lang.String[] val)
Decorator method for adding String-array valued tags.
|
Frame |
faddTrueBinary(java.lang.String key,
byte[] val)
This is a hack method which allows you to add binary-valued tags to Frames in a manner such
that there is no textual encoding overhead of that binary data.
|
KeyValuePair |
fromStream(java.io.InputStream is)
Populate this document using the given InputStream and the installed marshaller.
|
static FrameTransporter |
getFrameTransporter()
Get the currently installed document marshaller.
|
KeyValuePair |
getKeyValuePair(int which)
Return the specified KeyValue pair.
|
int |
getKeyValuePairCount()
Return the number of key/value pairs within this frame.
|
static void |
setFrameTransporter(FrameTransporter transporter)
This method lets you replace the default XTalk marshaller with another one, for example if you
want to use a different wire format (such as XML/SOAP), or if you want to easily exploit an
optimized/native implementation.
|
java.lang.String |
toRawXML()
Convert the document to XML without any pretting printing.
|
java.lang.StringBuffer |
toRawXML(java.lang.StringBuffer buf)
Convert the document to XML without any pretting printing.
|
void |
toRawXMLWork(java.lang.StringBuffer rval) |
void |
toStream(java.io.OutputStream os)
Write this document to the given output stream using the installed marshaller.
|
java.lang.String |
toString()
Represent the document as a string (equivlent to toXML()).
|
java.lang.String |
toXML()
Convert the document to XML.
|
java.lang.StringBuffer |
toXML(java.lang.StringBuffer buf)
Append the document, in XML format, to the provided StringBuffer.
|
protected void |
toXML(java.lang.StringBuffer rval,
int offset)
Helper method for toXML(StringBuffer).
|
getAttributes, setAttributes
public static void setFrameTransporter(FrameTransporter transporter)
transporter
- The new marshaller to plug in.public static FrameTransporter getFrameTransporter()
public void add(java.lang.String tag, FrameComponent val)
tag
- The tag name with which to associate the value.val
- The (Frame | FrameLeaf) value to associate with the tag.java.lang.UnsupportedOperationException
public KeyValuePair getKeyValuePair(int which)
which
- The index of the KeyValuePair to retrieve.java.lang.UnsupportedOperationException
public int getKeyValuePairCount()
java.lang.UnsupportedOperationException
public KeyValuePair fromStream(java.io.InputStream is) throws java.io.IOException, java.io.EOFException
fromStream
in interface Transportable
is
- The input stream to read from.java.io.IOException
- Can come from the underlying input stream.java.lang.UnsupportedOperationException
- if this document model does not support key addition.java.io.EOFException
public void toStream(java.io.OutputStream os) throws java.io.IOException
toStream
in interface Transportable
os
- The stream to where the document is written.java.io.IOException
- Can come from the underlying output stream.java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public java.lang.String toString()
toString
in class java.lang.Object
java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public java.lang.String toXML()
java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public java.lang.String toRawXML()
java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public java.lang.StringBuffer toRawXML(java.lang.StringBuffer buf)
buf
- The StringBuffer to append the document text to.java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public void toRawXMLWork(java.lang.StringBuffer rval)
public java.lang.StringBuffer toXML(java.lang.StringBuffer buf)
buf
- The StringBuffer where the document is appended.java.lang.UnsupportedOperationException
- if this document model does not support key iteration.public FrameLeaf createFrameLeaf(byte[] array)
public Frame createSubFrame(java.lang.String tag_name, int initialCapacity)
java.lang.UnsupportedOperationException
- if the getClass().newInstance() call on this object results in an exception.protected void toXML(java.lang.StringBuffer rval, int offset)
public Frame fadd(java.lang.String key, float val)
key
- The key to be associated with the value.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, float[] val)
key
- The key to be associated with the value.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, double val)
key
- The key to be associated with the value.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, double[] val)
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, int val)
key
- The key to be associated with the value.val
- The int to add.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, int[] val)
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, long val)
key
- The key to be associated with the value.val
- The long value to add.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, long[] val)
key
- The key to be associated with the value.val
- The array to add. The array is immediately converted to string representation.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, java.lang.String val)
key
- The key to be associated with the value.val
- The string to add.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, java.lang.String[] val)
key
- The key to be associated with the value.val
- The string to add.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, byte[] val)
key
- The key to be associated with the value.val
- The binary data to add (will be Base64 encoded).java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, boolean val)
key
- The key to be associated with the value.val
- The boolean value to add.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key, Frame val)
key
- The key to be associated with the value.val
- The sub-frame to add. Note this frame is not copied.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.public Frame fadd(java.lang.String key)
key
- The key name.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition, or creation of empty sub-frames.public Frame faddTrueBinary(java.lang.String key, byte[] val)
key
- The key to be associated with the value.val
- The byte array to be added to the frame. Note the array is NOT copied or converted in
any way.java.lang.UnsupportedOperationException
- if this document model doesn't support key addition.Copyright © 2014. All Rights Reserved.