public class XTalkTransporter extends java.lang.Object implements FrameTransporter
Modifier and Type | Field and Description |
---|---|
static byte |
DOCUMENT_MARKER |
static byte |
ELEMENT_MARKER |
static byte[] |
HEADER |
static byte |
PI_MARKER |
static byte |
STRING_MARKER |
static byte |
VERSION_CODE |
Constructor and Description |
---|
XTalkTransporter() |
Modifier and Type | Method and Description |
---|---|
void |
attributesToBin(java.io.OutputStream os,
Attributes attributes,
byte[] workbuf) |
static int |
consumeCharacters(java.io.InputStream is,
byte[] byteBuf,
char[] charBuf,
int bytesToRead)
Consume the string of bytesToRead utf-8 bytes.
|
void |
consumeChildren(java.io.InputStream is,
Frame f,
int field_count,
int marker,
byte[] buffer,
char[] cbuffer) |
KeyValuePair |
consumeRootChildren(java.io.InputStream is,
Frame f,
byte[] buffer,
char[] cbuffer) |
KeyValuePair |
consumeRootElement(java.io.InputStream is,
Frame f,
byte[] buffer,
char[] cbuffer) |
static java.lang.String |
consumeString(java.io.InputStream is)
Consume a string from the input stream.
|
static java.lang.String |
consumeString(java.io.InputStream is,
byte[] buffer,
char[] cbuffer) |
void |
elementToBin(java.io.OutputStream os,
Frame f,
byte[] workbuf) |
KeyValuePair |
fromStream(java.io.InputStream is,
Frame f)
Parse the data-stream according to the XTalk protocol.
|
KeyValuePair |
fromStreamWork(java.io.InputStream is,
Frame f)
Once we know that this is an XTalk document, perform XTalk parsing.
|
KeyValuePair |
fromStreamWork(java.io.InputStream is,
Frame f,
byte[] buffer,
char[] cbuffer) |
protected void |
ignorePI(java.io.InputStream is) |
static void |
readFully(byte[] b,
java.io.InputStream in) |
static void |
readFully(byte[] b,
int length,
java.io.InputStream in) |
static int |
readInt(java.io.InputStream in) |
static void |
stringToBin(char[] str,
int begin,
int len,
java.io.OutputStream os) |
static void |
stringToBin(char[] str,
int begin,
int len,
java.io.OutputStream os,
byte[] buffer) |
static void |
stringToBin(java.lang.String str,
java.io.OutputStream os)
Sends a string over, without the type byte.
|
static void |
stringToBin(java.lang.String str,
java.io.OutputStream os,
byte[] buffer)
Sends a string as utf8, using the temporary buffer if it is big enough to avoid allocating new
memory.
|
void |
toStream(java.io.OutputStream os,
Frame f)
Populate the (empty) frame from the stream contents.
|
static void |
writeInt(int write_me,
java.io.OutputStream out) |
public static final byte DOCUMENT_MARKER
public static final byte ELEMENT_MARKER
public static final byte PI_MARKER
public static final byte STRING_MARKER
public static final byte VERSION_CODE
public static final byte[] HEADER
public KeyValuePair fromStream(java.io.InputStream is, Frame f) throws java.io.IOException, java.io.EOFException
fromStream
in interface FrameTransporter
is
- The stream where the Frame is written.f
- The Frame to be marshalled.java.io.IOException
java.io.EOFException
public KeyValuePair fromStreamWork(java.io.InputStream is, Frame f) throws java.io.IOException
java.io.IOException
public KeyValuePair fromStreamWork(java.io.InputStream is, Frame f, byte[] buffer, char[] cbuffer) throws java.io.IOException
java.io.IOException
protected void ignorePI(java.io.InputStream is) throws java.io.IOException
is
- java.io.IOException
public KeyValuePair consumeRootChildren(java.io.InputStream is, Frame f, byte[] buffer, char[] cbuffer) throws java.io.IOException
is
- f
- java.io.IOException
public KeyValuePair consumeRootElement(java.io.InputStream is, Frame f, byte[] buffer, char[] cbuffer) throws java.io.IOException
is
- f
- java.io.IOException
public void consumeChildren(java.io.InputStream is, Frame f, int field_count, int marker, byte[] buffer, char[] cbuffer) throws java.io.IOException
is
- f
- field_count
- marker
- java.io.IOException
public static java.lang.String consumeString(java.io.InputStream is) throws java.io.IOException
is
- java.io.IOException
public static java.lang.String consumeString(java.io.InputStream is, byte[] buffer, char[] cbuffer) throws java.io.IOException
java.io.IOException
public static int consumeCharacters(java.io.InputStream is, byte[] byteBuf, char[] charBuf, int bytesToRead) throws java.io.IOException
java.io.IOException
public void toStream(java.io.OutputStream os, Frame f) throws java.io.IOException
FrameTransporter
toStream
in interface FrameTransporter
os
- The stream from where the data is read.f
- The Frame to be populated from the stream.java.io.IOException
public void elementToBin(java.io.OutputStream os, Frame f, byte[] workbuf) throws java.io.IOException
os
- f
- java.io.IOException
java.lang.UnsupportedOperationException
- if the frame doesn't support key iteration.public static void stringToBin(java.lang.String str, java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public static void stringToBin(java.lang.String str, java.io.OutputStream os, byte[] buffer) throws java.io.IOException
java.io.IOException
public static void stringToBin(char[] str, int begin, int len, java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public static void stringToBin(char[] str, int begin, int len, java.io.OutputStream os, byte[] buffer) throws java.io.IOException
java.io.IOException
public static void writeInt(int write_me, java.io.OutputStream out) throws java.io.IOException
write_me
- out
- java.io.IOException
public static int readInt(java.io.InputStream in) throws java.io.IOException
in
- java.io.IOException
public static void readFully(byte[] b, java.io.InputStream in) throws java.io.IOException
b
- in
- java.io.IOException
public static void readFully(byte[] b, int length, java.io.InputStream in) throws java.io.IOException
java.io.IOException
public void attributesToBin(java.io.OutputStream os, Attributes attributes, byte[] workbuf) throws java.io.IOException
os
- attributes
- java.io.IOException
Copyright © 2012. All Rights Reserved.