|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.xbformat.XbfParser
public class XbfParser
XbfParser class for raw socket/email messages.
This class creates and parses raw byte[] messages which can be used
to transfer over a socket connection.
XbfParser instances may be reused, but are NOT reentrant (there are many 'global' variables)
Please read the requirement specification
protocol.socket
msgLen[10] flag[6] requestId methodName sessionId lenUnzipped userData checkSum[10] +---------+-------+------ -*----------*-----------*-----------*-----------+----------+ The 'userData' consists of 0-n of these: qos key len content +-----*---------*-----*----------+ Examples, '*' marks a null byte and '|' is just to show the boundary (is not part of the message): Testing qos/key/content | 83**I**17711*publish*oxf6hZs*** *11*Hello world| Testing qos/key | 70**I**17711*get*oxf6hZs** * *0*| Testing publish return with qos | 48**R**17711*publish*oxf6hZs** **0*| Testing nothing | 38**I**17711*get*oxf6hZs****0*| Testing ping: | 29**I**11*ping*****0*| Testing XmlBlasterException | 76**E**17711*get*oxf6hZs**XbfParser*An XmlBlasterException test only*0*| Testing qos/key/content return value | 85**R**17711*publish*** * *20*Hello world response| Testing a QoS return value | 58**R**17711*get*** **0*| Testing two qos/key/content | 100**I**17711*publish*oxf6hZs** * *6*Hello1 * *6*Hello2|
Field Summary | |
---|---|
static byte |
CHECKSUM_ADLER_BYTE
|
static byte |
COMPRESSED_GZIP_BYTE
|
static java.lang.String |
EMPTY_STRING
|
static int |
FLAG_FIELD_LEN
|
static int |
MAX_STRING_LEN
|
static int |
NUM_FIELD_LEN
|
static byte |
VERSION_1_BYTE
|
static java.lang.String |
XBFORMAT_EXTENSION
|
static java.lang.String |
XBFORMAT_MIMETYPE
|
static java.lang.String |
XBFORMAT_ZLIB_EXTENSION
|
static java.lang.String |
XBFORMAT_ZLIB_MIMETYPE
|
Constructor Summary | |
---|---|
XbfParser()
|
Method Summary | |
---|---|
static java.lang.String |
createLiteral(byte[] arr)
Get the raw messages as a string, for tests and for dumping only |
byte[] |
createRawMsg(MsgInfo msgInfo)
Returns a raw data string. |
java.lang.String |
getExtension(boolean isCompressed)
Get a specific extension for this format. |
java.lang.String |
getMimetype(boolean isCompressed)
Get a specific extension for this format. |
void |
init(Global glob,
I_ProgressListener progressListener,
I_PluginConfig pluginConfig)
Is guaranteed to be called by the MsgInfoParserFactory after construction. |
MsgInfo[] |
parse(java.io.InputStream in)
This parses the raw message from an InputStream (typically from a socket). |
byte[] |
toByte(org.xmlBlaster.util.xbformat.XbfParser.Buf buf)
Reads the binary content of a message. |
java.lang.String |
toLiteral(byte[] arr)
Get the raw messages as a string, for tests and for dumping only. |
java.lang.String |
toLiteral(MsgInfo msgInfo)
Get the raw messages as a string, for tests and for dumping only |
long |
toLong0(org.xmlBlaster.util.xbformat.XbfParser.Buf buf,
long defaultVal)
Converts bytes from byte[] until \0 to a long |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NUM_FIELD_LEN
public static final int FLAG_FIELD_LEN
public static final int MAX_STRING_LEN
public static final java.lang.String EMPTY_STRING
public static final byte CHECKSUM_ADLER_BYTE
public static final byte COMPRESSED_GZIP_BYTE
public static final byte VERSION_1_BYTE
public static final java.lang.String XBFORMAT_EXTENSION
public static final java.lang.String XBFORMAT_ZLIB_EXTENSION
public static final java.lang.String XBFORMAT_MIMETYPE
public static final java.lang.String XBFORMAT_ZLIB_MIMETYPE
Constructor Detail |
---|
public XbfParser()
Method Detail |
---|
public void init(Global glob, I_ProgressListener progressListener, I_PluginConfig pluginConfig)
I_MsgInfoParser
init
in interface I_MsgInfoParser
pluginConfig
- Can be nullpublic final java.lang.String getMimetype(boolean isCompressed)
I_MsgInfoParser
getMimetype
in interface I_MsgInfoParser
isCompressed
- true/false
public final java.lang.String getExtension(boolean isCompressed)
I_MsgInfoParser
getExtension
in interface I_MsgInfoParser
isCompressed
- true/false
public final MsgInfo[] parse(java.io.InputStream in) throws java.io.IOException, java.lang.IllegalArgumentException
parse
in interface I_MsgInfoParser
in
- The raw, serialized data
java.io.IOException
java.lang.IllegalArgumentException
public final byte[] createRawMsg(MsgInfo msgInfo) throws XmlBlasterException
msgLen[10] flag[6] requestId methodName sessionId lenUnzipped userData checkSum[10] +---------+-------+------ -*----------*-----------*-----------*-----------+----------+ The 'userData' consists of 0-n of these: qos key len content +-----*---------*-----*----------+ An example is ('*' marks a null byte): " 83**I**17711*publish*oxf6hZs*** *11*Hello world"
createRawMsg
in interface I_MsgInfoParser
XmlBlasterException
public final byte[] toByte(org.xmlBlaster.util.xbformat.XbfParser.Buf buf) throws java.io.IOException
java.io.IOException
public final long toLong0(org.xmlBlaster.util.xbformat.XbfParser.Buf buf, long defaultVal) throws java.io.IOException
java.io.IOException
public final java.lang.String toLiteral(MsgInfo msgInfo) throws XmlBlasterException
toLiteral
in interface I_MsgInfoParser
XmlBlasterException
public final java.lang.String toLiteral(byte[] arr)
I_MsgInfoParser
toLiteral
in interface I_MsgInfoParser
arr
- The raw blob
public static final java.lang.String createLiteral(byte[] arr)
|
xmlBlaster 2.2.0 client API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |