|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.impl.mapbased.rpc.packet.RpcPacketField
public class RpcPacketField
Describes a value / name packet pair as marshaled on to or off the RPC wire between Perforce clients and servers.
Format on wire (from C++ API source), in bytes:
var<00>where either or both var and value can be empty (null), and where value can be interpreted as text (utf-8 or ascii, depending on settings) binary bytes, and where the four byte value length spec does not include the terminating null byte, and is encoded as per RpcPacket.encodeInt4().value<00>
Field Summary | |
---|---|
static int |
NAME_FIELD
Which element will contain (or not) the field's name. |
static int |
NUM_ELEMENTS
How many elements in each packet field. |
static String |
TRACE_PREFIX
|
static int |
VALUE_FIELD
Which element will contain (or not) the field's value. |
Constructor Summary | |
---|---|
RpcPacketField(String name,
Object value)
Construct a packet field from the passed-n name / value pair. |
Method Summary | |
---|---|
String |
getName()
|
Object |
getValue()
|
static void |
marshal(byte[] buf,
String name,
byte[] value)
|
static void |
marshal(ByteBuffer buf,
String name,
byte[] value)
Marshal the passed-in packet fields onto a ByteBuffer. |
static void |
marshal(ByteBuffer buf,
String name,
ByteBuffer value)
Marshal the passed-in packet fields onto a ByteBuffer. |
static void |
marshal(ByteBuffer buf,
String name,
StringBuffer value,
Charset charset)
Marshal the passed-in packet fields onto a ByteBuffer. |
static void |
marshal(ByteBuffer buf,
String name,
String value,
Charset charset)
Marshal the passed-in packet fields onto a ByteBuffer. |
static Object[] |
retrievePacketField(ByteBuffer buf,
boolean isUnicodeServer,
Charset charset)
Attempt to pick off a name / value field pair from the passed-in byte buffer. |
static Object[] |
retrievePacketField(ByteBuffer buf,
boolean isUnicodeServer,
Charset charset,
RpcPacketFieldRule fieldRule)
Attempt to pick off a name / value field pair from the passed-in byte buffer with an optional rule to handle the RPC packet fields. |
void |
setName(String name)
|
void |
setValue(Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String TRACE_PREFIX
public static final int NUM_ELEMENTS
public static final int NAME_FIELD
public static final int VALUE_FIELD
Constructor Detail |
---|
public RpcPacketField(String name, Object value)
name
- possibly-null namevalue
- possibly-null valueMethod Detail |
---|
public static Object[] retrievePacketField(ByteBuffer buf, boolean isUnicodeServer, Charset charset)
Updates the buffer's position accordingly. Have to be careful to use charsets with bytes and strings properly here and in the caller to keep internationalization and localization straight.
public static Object[] retrievePacketField(ByteBuffer buf, boolean isUnicodeServer, Charset charset, RpcPacketFieldRule fieldRule)
public String getName()
public void setName(String name)
public Object getValue()
public void setValue(Object value)
public static void marshal(ByteBuffer buf, String name, String value, Charset charset) throws BufferOverflowException, UnsupportedEncodingException
UnsupportedEncodingException
BufferOverflowException
public static void marshal(ByteBuffer buf, String name, StringBuffer value, Charset charset) throws BufferOverflowException, UnsupportedEncodingException
UnsupportedEncodingException
BufferOverflowException
public static void marshal(ByteBuffer buf, String name, byte[] value) throws BufferOverflowException
BufferOverflowException
public static void marshal(ByteBuffer buf, String name, ByteBuffer value) throws BufferOverflowException
Note: incoming value ByteBuffer must have been flipped ready for sending; value's position will be updated by this method, so if the buffer is to be reused, you must flip or reset (or whatever) it yourself.
BufferOverflowException
public static void marshal(byte[] buf, String name, byte[] value) throws BufferOverflowException
BufferOverflowException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |