Examples of toBytes()


Examples of com.alibaba.otter.canal.parse.driver.mysql.packets.server.Reply323Packet.toBytes()

        // auth 323
        Reply323Packet r323 = new Reply323Packet();
        if (password != null && password.length() > 0) {
            r323.seed = MySQLPasswordEncrypter.scramble323(password, new String(seed)).getBytes();
        }
        byte[] b323Body = r323.toBytes();

        HeaderPacket h323 = new HeaderPacket();
        h323.setPacketBodyLength(b323Body.length);
        h323.setPacketSequenceNumber((byte) (packetSequenceNumber + 1));
View Full Code Here

Examples of com.alimama.mdrill.distinct.DistinctCount.toBytes()

    ArrayList<Object> rtn=new ArrayList<Object>();
    ArrayList<byte[]> compress=new ArrayList<byte[]>();
    for(int field=0;field<this.dist.size();field++)
    {
      DistinctCount vv =this.dist.get(field) ;
      compress.add(field, vv.toBytes());
    }
    rtn.add(0, this.key.toNamedList());//"key"
    rtn.add(1, 1);//"rc"
    rtn.add(2,compress);//"dist"
    rtn.add(3, this.stat);//"stat"
View Full Code Here

Examples of com.bj58.spat.gaea.protocol.sfp.v1.Protocol.toBytes()

  @Test
  public void testFromBytes() throws Exception {
    RequestProtocol rp = new RequestProtocol("lookup", "methodname", null);
    Protocol p = new Protocol(101001, (byte)1, SDPType.Request, rp);
   
    byte[] buffer = p.toBytes();
   
    Protocol p2 = (Protocol)ProtocolHelper.fromBytes(buffer);
    Assert.assertEquals(rp.getLookup(), ((RequestProtocol)p2.getSdpEntity()).getLookup());
    Assert.assertEquals(rp.getMethodName(), ((RequestProtocol)p2.getSdpEntity()).getMethodName());
  }
View Full Code Here

Examples of com.cloud.agent.transport.Request.toBytes()

        if (_connection != null) {
            final ShutdownCommand cmd = new ShutdownCommand(reason, detail);
            try {
                if (_link != null) {
                    Request req = new Request((_id != null ? _id : -1), -1, cmd, false);
                    _link.send(req.toBytes());
                }
            } catch (final ClosedChannelException e) {
                s_logger.warn("Unable to send: " + cmd.toString());
            } catch (Exception e) {
                s_logger.warn("Unable to send: " + cmd.toString() + " due to exception: ", e);
View Full Code Here

Examples of com.cloud.agent.transport.Response.toBytes()

              }
            }

            if (response != null) {
                try {
                    link.send(response.toBytes());
                } catch (final ClosedChannelException e) {
                    s_logger.warn("Unable to send response: " + response.toString());
                }
            }
        }
View Full Code Here

Examples of com.cloudera.flume.handlers.hdfs.WriteableEvent.toBytes()

  }

  @Override
  public void append(Event e) throws IOException {
    WriteableEvent we = new WriteableEvent(e);
    RawEvent re = new RawEvent(ByteBuffer.wrap(we.toBytes()));

    try {
      client.rawAppend(re);
      updateAppendStats(e);
    } catch (TException e1) {
View Full Code Here

Examples of com.cloudera.iterativereduce.Updateable.toBytes()

    for (int x = 0; x < iterations; x++) {

      for (int worker_id = 0; worker_id < workers.size(); worker_id++) {

        Updateable result = workers.get(worker_id).compute();
        java.nio.ByteBuffer bb = result.toBytes();
        result.fromBytes(bb);
       
        worker_results.add(result);
        // ParameterVectorGradient msg0 =
        // workers.get(worker_id).GenerateUpdate();
View Full Code Here

Examples of com.cloudera.iterativereduce.yarn.UpdateableInt.toBytes()

    assertEquals(true, masterPrc.progress(workerTwo, progress));
   
    // Update
    UpdateableInt uInt = new UpdateableInt();
    uInt.set(100);
    assertEquals(true, masterPrc.update(workerOne, uInt.toBytes()));
    // We should not be in RUNNING state on master, so we get a false
    assertEquals(false, masterPrc.update(workerOne, uInt.toBytes()));

    // Obnoxiously put ourself back into WORKING state, but master refuses our
    // update, because we already provided an update in this round
View Full Code Here

Examples of com.esotericsoftware.kryo.io.ByteBufferOutput.toBytes()

          for (int i = 0; i < 16; i++) {
                out2.writeVarInt(92, false);
          }
         
          assertEquals(out1.toBytes(), out2.toBytes());
  }
 
  public void testZeroLengthOutputs() throws Exception {
    Output output = new Output(0, 10000);
    kryo.writeClassAndObject(output, "Test string");
View Full Code Here

Examples of com.esotericsoftware.kryo.io.Output.toBytes()

  public void testSimpleVarInt() {
      final int value = 39117;
      final Output out = new UnsafeOutput(1024);
      out.writeVarInt(value, true);
      out.flush();
      final Input in = new UnsafeInput(out.toBytes());
      final int actualValue = in.readVarInt(true);
      assertEquals(value, actualValue);
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.