当前位置: 首页>>代码示例>>Java>>正文


Java Packer.writeArrayBegin方法代码示例

本文整理汇总了Java中org.msgpack.packer.Packer.writeArrayBegin方法的典型用法代码示例。如果您正苦于以下问题:Java Packer.writeArrayBegin方法的具体用法?Java Packer.writeArrayBegin怎么用?Java Packer.writeArrayBegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.msgpack.packer.Packer的用法示例。


在下文中一共展示了Packer.writeArrayBegin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeCall

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
protected void writeCall(String methodName, Object[] args) throws IOException {
  huc = u.openConnection();
  huc.setDoOutput(true);
  huc.setDoInput(true);
  huc.setUseCaches(false);
  huc.setRequestProperty("Content-Type", "binary/message-pack");
  huc.setReadTimeout(0);
  OutputStream os = huc.getOutputStream();
  Packer pk = msgpack.createPacker(os);
  pk.writeArrayBegin(args.length+1);
  pk.write(methodName);
  for (Object arg : args)
    pk.write(arg);
  pk.writeArrayEnd();
  pk.close();
  os.close();
}
 
开发者ID:Android-leak,项目名称:csploit,代码行数:18,代码来源:RPCClient.java

示例2: marshallRequestParams

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
@Override
public byte[] marshallRequestParams(final Object[] requestParams) throws IOException {

  final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
  final Packer packer = msgPack.createPacker(outputStream);

  final Object[] params;
  if (requestParams == null) {
    params = new Object[0];
  } else {
    params = requestParams;
  }

  packer.writeArrayBegin(params.length);
  for (final Object param : params) {
    packer.write(param);
  }
  packer.writeArrayEnd();

  return outputStream.toByteArray();
}
 
开发者ID:outbrain,项目名称:ob1k,代码行数:22,代码来源:MessagePackRequestMarshaller.java

示例3: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, Set<E> target, boolean required)
        throws IOException {
    if (!(target instanceof Set)) {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        throw new MessageTypeException("Target is not a List but "
                + target.getClass());
    }
    pk.writeArrayBegin(target.size());
    for (E e : target) {
        elementTemplate.write(pk, e);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:20,代码来源:SetTemplate.java

示例4: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
@Override
public void write(Packer packer, Object v, boolean required)
        throws IOException {
    if (v == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        packer.writeNil();
        return;
    }
    if (!(v instanceof Object[]) ||
            !componentClass.isAssignableFrom(v.getClass().getComponentType())) {
        throw new MessageTypeException();
    }

    Object[] array = (Object[]) v;
    int length = array.length;
    packer.writeArrayBegin(length);
    for (int i = 0; i < length; i++) {
        componentTemplate.write(packer, array[i], required);
    }
    packer.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:24,代码来源:ObjectArrayTemplate.java

示例5: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, Collection<E> target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    Collection<E> col = target;
    pk.writeArrayBegin(col.size());
    for (E e : col) {
        elementTemplate.write(pk, e);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:17,代码来源:CollectionTemplate.java

示例6: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, List<E> target, boolean required)
        throws IOException {
    if (!(target instanceof List)) {
        if (target == null) {
            if (required) {
                throw new MessageTypeException("Attempted to write null");
            }
            pk.writeNil();
            return;
        }
        throw new MessageTypeException("Target is not a List but "
                + target.getClass());
    }
    pk.writeArrayBegin(target.size());
    for (E e : target) {
        elementTemplate.write(pk, e);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:20,代码来源:ListTemplate.java

示例7: writeTo

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(3);
    pk.write(Messages.NOTIFY);
    pk.write(method);
    pk.writeArrayBegin(args.length);
    for (Object arg : args) {
        pk.write(arg);
    }
    pk.writeArrayEnd();
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:12,代码来源:NotifyMessage.java

示例8: packData

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
protected void packData(Packer packer) throws IOException {
	packer.writeArrayBegin(2);
	packer.write(event);
	if(data instanceof JSONObject) {
		this.parseObject(((JSONObject)data), packer);
	} else if(data instanceof JSONArray) {
		this.parseArray(((JSONArray)data), packer);
	}
	packer.writeArrayEnd(true);
}
 
开发者ID:sunsus,项目名称:socket.io-java-emitter,代码行数:11,代码来源:PacketJson.java

示例9: writeTo

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void writeTo(Packer pk) throws IOException {
    pk.writeArrayBegin(4);
    pk.write(Messages.REQUEST);
    pk.write(msgid);
    pk.write(method);
    pk.writeArrayBegin(args.length);
    for (Object arg : args) {
        pk.write(arg);
    }
    pk.writeArrayEnd();
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:13,代码来源:RequestMessage.java

示例10: writeTo

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
@Override
public void writeTo(Packer packer) throws IOException {
	packer.writeArrayBegin(2);
	
	packer.writeMapBegin(3);
	packer.write("type");
	packer.write(this.type);
	packer.write("data");
	this.packData(packer);
	
	packer.write("nsp");
	packer.write(this.nsp);
	packer.writeMapEnd(true);
	

	packer.writeMapBegin(2);
	
	packer.write("rooms");
	packer.writeArrayBegin(rooms.size());
	for(String room : rooms) {
		packer.write(room);
	}
	packer.writeArrayEnd(true);
	
	packer.write("flags");
	packer.writeMapBegin(flags.size());
	Iterator<Entry<String, Object>> it = flags.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry<String, Object> pairs = (Map.Entry<String, Object>)it.next();
        packer.write(pairs.getKey());
        packer.write( pairs.getValue());
        it.remove(); // avoids a ConcurrentModificationException
    }
	packer.writeMapEnd(true);
	
	packer.writeMapEnd(true);
	
	packer.writeArrayEnd(true);
	
}
 
开发者ID:sunsus,项目名称:socket.io-java-emitter,代码行数:41,代码来源:Packet.java

示例11: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, double[] target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    pk.writeArrayBegin(target.length);
    for (double a : target) {
        pk.write(a);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:16,代码来源:DoubleArrayTemplate.java

示例12: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, short[] target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    pk.writeArrayBegin(target.length);
    for (short a : target) {
        pk.write(a);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:16,代码来源:ShortArrayTemplate.java

示例13: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, int[] target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    pk.writeArrayBegin(target.length);
    for (int a : target) {
        pk.write(a);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:16,代码来源:IntegerArrayTemplate.java

示例14: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, long[] target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    pk.writeArrayBegin(target.length);
    for (long a : target) {
        pk.write(a);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:16,代码来源:LongArrayTemplate.java

示例15: write

import org.msgpack.packer.Packer; //导入方法依赖的package包/类
public void write(Packer pk, float[] target, boolean required)
        throws IOException {
    if (target == null) {
        if (required) {
            throw new MessageTypeException("Attempted to write null");
        }
        pk.writeNil();
        return;
    }
    pk.writeArrayBegin(target.length);
    for (float a : target) {
        pk.write(a);
    }
    pk.writeArrayEnd();
}
 
开发者ID:nict-wisdom,项目名称:rasc,代码行数:16,代码来源:FloatArrayTemplate.java


注:本文中的org.msgpack.packer.Packer.writeArrayBegin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。