本文整理汇总了Java中org.msgpack.core.MessagePacker.packArrayHeader方法的典型用法代码示例。如果您正苦于以下问题:Java MessagePacker.packArrayHeader方法的具体用法?Java MessagePacker.packArrayHeader怎么用?Java MessagePacker.packArrayHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.msgpack.core.MessagePacker
的用法示例。
在下文中一共展示了MessagePacker.packArrayHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import org.msgpack.core.MessagePacker; //导入方法依赖的package包/类
void write(MessagePacker packer) throws IOException {
Visitor visitor = new Visitor(packer);
packer.packArrayHeader(3);
packer.packString(this.type);
if (this.data != null) {
packer.packMapHeader(this.data.size());
for (Map.Entry<String, Object> entry : this.data.entrySet()) {
packer.packString(entry.getKey());
visitor.visit(entry.getValue());
}
} else {
packer.packNil();
}
packer.packString(this.nodeId);
packer.close();
}
示例2: toMarkerThrows
import org.msgpack.core.MessagePacker; //导入方法依赖的package包/类
private String toMarkerThrows(Map<String, Object> attributes, boolean hasHashKey) throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
MessagePacker packer = MessagePack.newDefaultPacker(out);
packer.packArrayHeader(size(hasHashKey));
if ( ! hasHashKey ) {
pack(packer, attributes, _hkName);
}
if ( null == _otherKeyNames ) {
packer.flush();
return BASE64_ENCODER.encodeToString(out.toByteArray());
}
for ( String keyName : _otherKeyNames ) {
pack(packer, attributes, keyName);
}
packer.flush();
return BASE64_ENCODER.encodeToString(out.toByteArray());
}
示例3: packArray
import org.msgpack.core.MessagePacker; //导入方法依赖的package包/类
private void packArray(StackItemForArray stackItem) throws IOException {
List<Object> values = stackItem.getValues();
MessagePacker messagePacker = getMessagePacker();
messagePacker.packArrayHeader(values.size());
for (int i = 0; i < values.size(); i++) {
Object v = values.get(i);
packValue(v);
}
}
示例4: writeTo
import org.msgpack.core.MessagePacker; //导入方法依赖的package包/类
@Override
public void writeTo(MessagePacker packer) throws IOException
{
int size = list.size();
packer.packArrayHeader(size);
for (int i = 0; i != size; i++)
{
list.get(i).writeTo(packer);
}
}