Examples of DataOutput


Examples of com.alibaba.dubbo.common.serialize.DataOutput

  public void testMain() throws Exception
  {
    // write.
    UnsafeByteArrayOutputStream os = new UnsafeByteArrayOutputStream();
    DataOutput cos = new GenericDataOutput(os);
    writeTest(cos);

    // read.
    byte[] b = os.toByteArray();
    DataInput cis = new GenericDataInput(new UnsafeByteArrayInputStream(b));
View Full Code Here

Examples of com.thinkaurelius.titan.graphdb.database.serialize.DataOutput

            IDHandler.writeInlineEdgeType(wb, id);
            long newId = IDHandler.readInlineEdgeType(wb.getStaticBuffer().asReadBuffer());
            assertEquals(id,newId);

            //Compare to Kryo
            DataOutput out = serializer.getDataOutput(10, true);
            IDHandler.writeEdgeType(out, id, dirID);
            assertEquals(b, out.getStaticBuffer());

            //Make sure the bounds are right
            StaticBuffer[] bounds = IDHandler.getBounds(type);
            assertTrue(bounds[0].compareTo(b)<0);
            assertTrue(bounds[1].compareTo(b)>0);
View Full Code Here

Examples of java.io.DataOutput

                dataOut.writeByte(type);
                bs.marshal(dataOut);
                dsm.tightMarshal2(this, c, dataOut, bs);

            } else {
                DataOutput looseOut = dataOut;

                if (!sizePrefixDisabled) {
                    bytesOut.restart();
                    looseOut = bytesOut;
                }

                looseOut.writeByte(type);
                dsm.looseMarshal(this, c, looseOut);

                if (!sizePrefixDisabled) {
                    Buffer sequence = bytesOut.toBuffer();
                    dataOut.writeInt(sequence.getLength());
View Full Code Here

Examples of java.io.DataOutput

        headers.add("key1", "value1");
        headers.add("key1", "value2");
        headers.add("key2", "value3");

        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        DataOutput out = new DataOutputStream(byteStream);
        headers.write(out);
       
        HttpHeaders newHeaders = new HttpHeaders();
        DataInput in = new DataInputStream(new ByteArrayInputStream(byteStream.toByteArray()));
        newHeaders.readFields(in);
View Full Code Here

Examples of java.io.DataOutput

    }

    public static void roundtrip(Writable wn1, Writable wn2)
            throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutput out=new DataOutputStream(bos);
        wn1.write(out);
        byte[] result=bos.toByteArray();
        ByteArrayInputStream bis = new ByteArrayInputStream(result);
        DataInput in=new DataInputStream(bis);
        wn2.readFields(in);
View Full Code Here

Examples of java.io.DataOutput

     */
    @Test
    public void stress_write() throws Exception {
        int count = 10000000;
        DecimalOption option = new DecimalOption(new BigDecimal("3.14"));
        DataOutput out = new DataOutputStream(new NullOutputStream());
        for (int i = 0; i < count; i++) {
            option.write(out);
        }
    }
View Full Code Here

Examples of java.io.DataOutput

   * @return A decimal response code
   * @throws GeneralSecurityException If a JCE exception occur
   */
  public String generateResponseCode(long challenge) {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    DataOutput dout = new DataOutputStream(out);
    try {
      dout.writeLong(challenge);
    } catch (IOException e) {
      // This should never happen with a ByteArrayOutputStream
      throw new RuntimeException("Unexpected IOException");
    }
    byte[] value = out.toByteArray();
View Full Code Here

Examples of java.io.DataOutput

  public void testWritable() throws Exception {

    Random rng = RandomUtils.getRandom();
    ByteArrayOutputStream byteOutStream = new ByteArrayOutputStream();
    DataOutput out = new DataOutputStream(byteOutStream);

    int n = 10;
    for (int nloop=0; nloop< n; nloop++) {
      byteOutStream.reset();
     
View Full Code Here

Examples of java.io.DataOutput

        Tuple t1 = giveMeOneOfEach();

        File file = File.createTempFile("Tuple", "put");
        FileOutputStream fos = new FileOutputStream(file);
        DataOutput out = new DataOutputStream(fos);
        t1.write(out);
        t1.write(out); // twice in a row on purpose
        fos.close();

        FileInputStream fis = new FileInputStream(file);
View Full Code Here

Examples of java.io.DataOutput

        map.put(new Long(3L), new String("all"));
        t1.set(0, map);

        File file = File.createTempFile("Tuple", "put");
        FileOutputStream fos = new FileOutputStream(file);
        DataOutput out = new DataOutputStream(fos);
        t1.write(out);
        fos.close();

        FileInputStream fis = new FileInputStream(file);
        DataInput in = new DataInputStream(fis);
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.