org.w3c.www.protocol.http.micp
Class MICPReadWrite
java.lang.Object
org.w3c.www.protocol.http.micp.MICPReadWrite
- All Implemented Interfaces:
- MICP
public class MICPReadWrite
- extends java.lang.Object
- implements MICP
A class to parse/emit MICP messages.
Method Summary |
MICPMessage |
decode(byte[] buf,
int len,
MICPMessage into)
Parse the given buffer as an mICP message. |
int |
encode(int op,
int src,
int id,
java.lang.String url,
byte[] buf)
Emit an MICP message into provided buffer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MICPReadWrite
public MICPReadWrite()
decode
public MICPMessage decode(byte[] buf,
int len,
MICPMessage into)
throws MICPProtocolException
- Parse the given buffer as an mICP message.
- Parameters:
buf
- The wire data to parse.len
- The length of above buffer.into
- Message structure to fill in.
- Returns:
- The filled in message.
- Throws:
MICPProtocolException
- If the given buffer is not an mICP
wire formatted message.
encode
public int encode(int op,
int src,
int id,
java.lang.String url,
byte[] buf)
- Emit an MICP message into provided buffer.
If the buffer is too small, a new buffer is allocated in place of
the provided one (and returned).
- Parameters:
op
- The opcode for the message.src
- The source field for the message.id
- The identifier of that message.url
- The URL for that message.buf
- The buffer to encode the message to.
- Returns:
- A positive integer, giving the message length if buffer was big
enough to hold the packet, a negative integer, giving required buffer
size otherwise.