Examples of toByteArray()


Examples of protobuf_unittest.UnittestProto.SparseEnumMessage.toByteArray()

   */
  public void testWriteMessageWithNegativeEnumValue() throws Exception {
    SparseEnumMessage message = SparseEnumMessage.newBuilder()
        .setSparseEnum(TestSparseEnum.SPARSE_E) .build();
    assertTrue(message.getSparseEnum().getNumber() < 0);
    byte[] rawBytes = message.toByteArray();
    SparseEnumMessage message2 = SparseEnumMessage.parseFrom(rawBytes);
    assertEquals(TestSparseEnum.SPARSE_E, message2.getSparseEnum());
  }

  /** Test getTotalBytesWritten() */
 
View Full Code Here

Examples of protobuf_unittest.UnittestProto.TestAllExtensions.toByteArray()

    // Deserializing into the TestEmptyMessage such that every field
    // is an {@link UnknownFieldSet.Field}.
    UnittestProto.TestEmptyMessage eUnknownFields =
        UnittestProto.TestEmptyMessage.parseFrom(e.toByteArray());
    UnittestProto.TestEmptyMessage fUnknownFields =
        UnittestProto.TestEmptyMessage.parseFrom(f.toByteArray());
    checkNotEqual(eUnknownFields, fUnknownFields);
    checkEqualsIsConsistent(eUnknownFields);
    checkEqualsIsConsistent(fUnknownFields);

    // Subseqent reconstitutions should be identical
View Full Code Here

Examples of protobuf_unittest.UnittestProto.TestAllTypes.toByteArray()

  /** Tests reading and parsing a whole message with every field type. */
  public void testReadWholeMessage() throws Exception {
    TestAllTypes message = TestUtil.getAllSet();

    byte[] rawBytes = message.toByteArray();
    assertEquals(rawBytes.length, message.getSerializedSize());

    TestAllTypes message2 = TestAllTypes.parseFrom(rawBytes);
    TestUtil.assertAllFieldsSet(message2);

View Full Code Here

Examples of protobuf_unittest.UnittestProto.TestPackedTypes.toByteArray()

  /** Tests writing a whole message with every packed field type. Ensures the
   * wire format of packed fields is compatible with C++. */
  public void testWriteWholePackedFieldsMessage() throws Exception {
    TestPackedTypes message = TestUtil.getPackedSet();

    byte[] rawBytes = message.toByteArray();
    assertEqualBytes(TestUtil.getGoldenPackedFieldsMessage().toByteArray(),
                     rawBytes);
  }

  /** Test writing a message containing a negative enum value. This used to
View Full Code Here

Examples of protobuf_unittest.UnittestProto.TestRequired.toByteArray()

    // TestRequired.b and TestRequired.c are not set.
    TestRequired partialMessage = TestRequired.newBuilder()
        .setA(1).buildPartial();

    // parsePartialFrom should pass.
    byte[] data = partialMessage.toByteArray();
    assertEquals(partialMessage, parser.parsePartialFrom(data));
    assertEquals(partialMessage, parser.parsePartialFrom(
        partialMessage.toByteString()));
    assertEquals(partialMessage, parser.parsePartialFrom(
        new ByteArrayInputStream(data)));
View Full Code Here

Examples of scala.tools.asm.ClassWriter.toByteArray()

              }
            };
                ProfilerVisitor visitor = new ProfilerVisitor(writer);
                ClassReader reader = new ClassReader(classfileBuffer);
                reader.accept(visitor, 0);
                return writer.toByteArray();
          } else {
            return classfileBuffer;
          }
        }
}
View Full Code Here

Examples of serp.bytecode.BCClass.toByteArray()

        } catch (Throwable t) {
            throw new InternalException(_loc.get("interface-load", iface,
                loader), t).setFatal(true);
        }
        // copy the BCClass into the enhancer project.
        bc = _enhProject.loadClass(new ByteArrayInputStream(bc.toByteArray()),
            loader);
        PCEnhancer enhancer = new PCEnhancer(_repos.getConfiguration(), bc,
            meta);

        int result = enhancer.run();
View Full Code Here

Examples of streamer.ByteBuffer.toByteArray()

        // 03 82 01 0f (tag) 00 (padding byte)
        subjectPublicKey.trimHeader(5);// FIXME: parse it properly
        // * DEBUG */System.out.println("DEBUG: subjectPublicKey:\n" +
        // subjectPublicKey.dump());

        ntlmState.subjectPublicKey = subjectPublicKey.toByteArray();

        return ntlmState.subjectPublicKey;
    }

    /**
 
View Full Code Here

Examples of sun.security.util.BitArray.toByteArray()

            BitArray bitArray = new BitArray(MASKSIZE * 8);

            // set all most significant bits up to prefix length
            for (int i = 0; i < prefixLen; i++)
                bitArray.set(i, true);
            byte[] maskArray = bitArray.toByteArray();

            // copy mask bytes into mask portion of address
            for (int i = 0; i < MASKSIZE; i++)
                address[MASKSIZE+i] = maskArray[i];
        }
View Full Code Here

Examples of sun.security.util.DerOutputStream.toByteArray()

      try {
    dout.putOID(oid);
      } catch (IOException e) {
    throw new GSSException(GSSException.FAILURE, e.getMessage());
      }
      derEncoding = dout.toByteArray();
  }

        return (byte[])derEncoding.clone();
    }
   
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.