Examples of toByteArray()


Examples of com.google.gwt.dev.asm.ClassWriter.toByteArray()

    if (Double.parseDouble(System.getProperty("java.class.version")) < Opcodes.V1_6) {
      v = new ForceClassVersion15(v);
    }

    new ClassReader(classBytes).accept(v, 0);
    return writer.toByteArray();
  }

  public byte[] writeJsoIntf(String className) {
    String desc = toDescriptor(className);
    assert (jsoIntfDescs.contains(desc));
View Full Code Here

Examples of com.google.protobuf.AbstractMessage.toByteArray()

          + "does not match expected class '%s' (message name '%s'): %s.",
          cellValue.getClass().getName(), message.getDescriptorForType().getFullName(),
          mProtoClass.getName(), mProtobufFullName,
          cellValue));
    }
    return message.toByteArray();
  }

}
View Full Code Here

Examples of com.google.protobuf.ByteString.toByteArray()

        for (int i=0; i<lenp; i++) data.setObject(i, attp.getSdata(i));
        return new Attribute(attp.getName(), data);
      }
    } else {
      ByteString bs = attp.getData();
      ByteBuffer bb = ByteBuffer.wrap(bs.toByteArray());
      return new Attribute(attp.getName(), Array.factory(decodeAttributeType(attp.getType()), null, bb));
    }
  }

   static Variable decodeVar(NetcdfFile ncfile, Group g, Structure parent, NcStreamProto.Variable var) {
View Full Code Here

Examples of com.google.protobuf.DynamicMessage.toByteArray()

    @Override
    public void packRowData(FDBStore store, Session session,
                            FDBStoreData storeData, RowData rowData) {
        ensureConverter();
        DynamicMessage msg = converter.encode(rowData);
        storeData.rawValue = msg.toByteArray();       
    }

    @Override
    public void expandRowData(FDBStore store, Session session,
                              FDBStoreData storeData, RowData rowData) {
View Full Code Here

Examples of com.google.protobuf.Message.toByteArray()

        int size = message.getSerializedSize();
        ChannelBuffer buffer = new BigEndianHeapChannelBuffer(4 + name.length() + 1 + size + 4);
        buffer.writeInt(name.length() + 1);
        buffer.writeBytes(name.getBytes());
        buffer.writeZero(1);
        buffer.writeBytes(message.toByteArray());

        Adler32 checksum = new Adler32();
        checksum.update(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
        buffer.writeInt((int) checksum.getValue());
View Full Code Here

Examples of com.google.protobuf.MessageLite.toByteArray()

   * @return the byte array
   */
  public static final byte[] seriOne(Object o) {
    if (o instanceof MessageLite) {
      MessageLite gen = (MessageLite)o;
      return gen.toByteArray();
    } else {
      throw new SeriException("Message is not protobuf type: " + o.getClass());
    }
  }

View Full Code Here

Examples of com.google.protobuf.micro.MicroOuterClass.TestAllTypesMicro.toByteArray()

    // Test 1 entry and an empty byte array can be serialized
    msg.clear()
       .addRepeatedBytes(ByteStringMicro.copyFromUtf8(""));
    assertEquals(1, msg.getRepeatedBytesCount());
    assertEquals("", msg.getRepeatedBytes(0).toStringUtf8());
    byte [] result = msg.toByteArray();
    int msgSerializedSize = msg.getSerializedSize();
    //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
    assertTrue(msgSerializedSize == 3);
    assertEquals(result.length, msgSerializedSize);
    TestAllTypesMicro newMsg = TestAllTypesMicro.parseFrom(result);
View Full Code Here

Examples of com.google.protobuf.micro.SimpleMessageMicro.toByteArray()

    msg.setDefaultNestedEnum(SimpleMessageMicro.BAR);
    assertTrue(msg.hasDefaultNestedEnum());
    assertEquals(SimpleMessageMicro.BAR, msg.getDefaultNestedEnum());

    byte [] result = msg.toByteArray();
    int msgSerializedSize = msg.getSerializedSize();
    //System.out.printf("mss=%d result.length=%d\n", msgSerializedSize, result.length);
    assertTrue(msgSerializedSize == 9);
    assertEquals(result.length, msgSerializedSize);
View Full Code Here

Examples of com.google.storage.onestore.v3.OnestoreEntity.EntityProto.toByteArray()

      EntityProto proto = new EntityProto();
      if (structProp.getKey() != null) {
        proto.setKey(KeyTranslator.convertToPb(structProp.getKey()));
      }
      addPropertiesToPb(structProp.getPropertyMap(), proto);
      propertyValue.setStringValueAsBytes(proto.toByteArray());
      return false;
    }

    @Override
    public EntityV4.Value.Builder toV4Value(Object value, boolean indexed) {
View Full Code Here

Examples of com.googlecode.aviator.asm.ClassWriter.toByteArray()

            cr.accept(co, ClassReader.SKIP_DEBUG);

            Set constants = new TreeSet(new ConstantComparator());
            constants.addAll(cp.values());

            cr = new ClassReader(cw.toByteArray());
            cw = new ClassWriter(0);
            Iterator i = constants.iterator();
            while (i.hasNext()) {
                Constant c = (Constant) i.next();
                c.write(cw);
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.