public class XMPPByteProcessor extends Object implements ByteProcessor
| Constructor and Description |
|---|
XMPPByteProcessor(PacketReceiver<XMPPPacket> receiver) |
| Modifier and Type | Method and Description |
|---|---|
void |
flushUnprocessedBytes()
Discard all the bytes which have not been processed.
|
byte[] |
getPartialBytes() |
boolean |
hasPartialBytes() |
int |
partialBytesCount() |
void |
processBytes(ByteSource networkData)
Process byte stream; processing a byte stream typically involves
encoding, parsing and building a packet.
|
void |
processBytes(ByteSource networkData,
int length)
Process byte stream; processing a byte stream typically involves
encoding, parsing and building a packet.
|
void |
processCharStream(CharSource chars)
Parse xml characters stored in
CharSource object. |
void |
resume(Packet switchOver)
Resume processing a byte stream.
|
int |
unprocessedByteCount()
A byte processor is likely to process bytes in chunks from a
ByteSource. |
public XMPPByteProcessor(PacketReceiver<XMPPPacket> receiver)
public void resume(Packet switchOver)
ByteProcessorresume in interface ByteProcessorswitchOver - half-built packet from previous processorpublic void processBytes(ByteSource networkData) throws Exception
ByteProcessorParserException or MalformedStreamExceptionprocessBytes in interface ByteProcessornetworkData - networkDataException - exceptionpublic void processBytes(ByteSource networkData, int length) throws Exception
ByteProcessorParserException or MalformedStreamException aprocessBytes in interface ByteProcessornetworkData - networkDatalength - lengthException - Exceptionpublic void processCharStream(CharSource chars) throws Exception
CharSource object. Parsed elements
generate XMPPPacket and these packets are handled in Callback
invocation. Each time character source exhausts or parser quits
processing, we check if there is an error in parser. For parser errors,
ParserException is thrown.chars - charsException - Exceptionpublic int unprocessedByteCount()
ByteProcessorByteSource. It may happen that before a byte processor finishes
processing a byte chunk, byte processing is taken over by another
ByteProcessor. In this case, the active byte processor will
require to know the number pf bytes which were left unprocessed in the
chunk.unprocessedByteCount in interface ByteProcessorpublic boolean hasPartialBytes()
public byte[] getPartialBytes()
public int partialBytesCount()
public void flushUnprocessedBytes()
ByteProcessorflushUnprocessedBytes in interface ByteProcessorCopyright © 2019. All rights reserved.