Package org.apache.flink.core.memory

Examples of org.apache.flink.core.memory.InputViewDataInputStreamWrapper


    // test data transfer
    NfStringList mList2 = new NfStringList();
    try {
      list.write(new OutputViewDataOutputStreamWrapper(out));
      mList2.read(new InputViewDataInputStreamWrapper(in));
    } catch (Exception e) {
      Assert.assertTrue(false);
    }
    Assert.assertTrue(list.equals(mList2));
  }
View Full Code Here


    }

    final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    final DataInputStream dis = new DataInputStream(bais);

    copy.read(new InputViewDataInputStreamWrapper(dis));

    return copy;
  }
View Full Code Here

      int2.write(new OutputViewDataOutputStreamWrapper(mOut));
      int3.write(new OutputViewDataOutputStreamWrapper(mOut));
      IntValue int1n = new IntValue();
      IntValue int2n = new IntValue();
      IntValue int3n = new IntValue();
      int1n.read(new InputViewDataInputStreamWrapper(mIn));
      int2n.read(new InputViewDataInputStreamWrapper(mIn));
      int3n.read(new InputViewDataInputStreamWrapper(mIn));
      Assert.assertEquals(int0.compareTo(int1n), 0);
      Assert.assertEquals(int0.getValue(), int1n.getValue());
      Assert.assertEquals(int2.compareTo(int2n), 0);
      Assert.assertEquals(int2.getValue(), int2n.getValue());
      Assert.assertEquals(int3.compareTo(int3n), 0);
View Full Code Here

      double2.write(new OutputViewDataOutputStreamWrapper(mOut));
      double3.write(new OutputViewDataOutputStreamWrapper(mOut));
      DoubleValue double1n = new DoubleValue();
      DoubleValue double2n = new DoubleValue();
      DoubleValue double3n = new DoubleValue();
      double1n.read(new InputViewDataInputStreamWrapper(mIn));
      double2n.read(new InputViewDataInputStreamWrapper(mIn));
      double3n.read(new InputViewDataInputStreamWrapper(mIn));
      Assert.assertEquals(double0.compareTo(double1n), 0);
      Assert.assertEquals(double0.getValue(), double1n.getValue(), 0.0001);
      Assert.assertEquals(double2.compareTo(double2n), 0);
      Assert.assertEquals(double2.getValue(), double2n.getValue(), 0.0001);
      Assert.assertEquals(double3.compareTo(double3n), 0);
View Full Code Here

      StringValue string1n = new StringValue();
      StringValue string2n = new StringValue();
      StringValue string3n = new StringValue();
      StringValue string4n = new StringValue();
      StringValue string7n = new StringValue();
      string1n.read(new InputViewDataInputStreamWrapper(mIn));
      string4n.read(new InputViewDataInputStreamWrapper(mIn));
      string2n.read(new InputViewDataInputStreamWrapper(mIn));
      string3n.read(new InputViewDataInputStreamWrapper(mIn));
      string7n.read(new InputViewDataInputStreamWrapper(mIn));
      Assert.assertEquals(string0.compareTo(string1n), 0);
      Assert.assertEquals(string0.toString(), string1n.toString());
      Assert.assertEquals(string4.compareTo(string4n), 0);
      Assert.assertEquals(string4.toString(), string4n.toString());
      Assert.assertEquals(string2.compareTo(string2n), 0);
View Full Code Here

        pn.write(new OutputViewDataOutputStreamWrapper(mOut));
      }
     
      // read it multiple times
      for (int i = 0; i < numWrites; i++) {
        pn.read(new InputViewDataInputStreamWrapper(mIn));
      }
     
      Assert.assertEquals("Reading PactNull does not consume the same data as was written.", mIn.available(), 0);
    }
    catch (IOException ioex) {
View Full Code Here

  {
    try {
      // test deserialize into self
      Record empty = new Record();
      empty.write(new OutputViewDataOutputStreamWrapper(this.out));
      empty.read(new InputViewDataInputStreamWrapper(this.in));
      Assert.assertTrue("Deserialized Empty record is not another empty record.", empty.getNumFields() == 0);
     
      // test deserialize into new
      empty = new Record();
      empty.write(new OutputViewDataOutputStreamWrapper(this.out));
      empty = new Record();
      empty.read(new InputViewDataInputStreamWrapper(this.in));
      Assert.assertTrue("Deserialized Empty record is not another empty record.", empty.getNumFields() == 0);
     
    } catch (Throwable t) {
      Assert.fail("Test failed due to an exception: " + t.getMessage());
    }
View Full Code Here

 
      try {
        // serialize and deserialize to remove all buffered info
        r.write(new OutputViewDataOutputStreamWrapper(out));
        r = new Record();
        r.read(new InputViewDataInputStreamWrapper(in));
 
        r.setField(1, new IntValue(10));
        r.setField(4, new StringValue("Some long value"));
        r.setField(5, new StringValue("An even longer value"));
        r.setField(10, new IntValue(10));
 
        r.write(new OutputViewDataOutputStreamWrapper(out));
        r = new Record();
        r.read(new InputViewDataInputStreamWrapper(in));
 
        assertTrue(r.getField(0, IntValue.class).getValue() == 0);
        assertTrue(r.getField(1, IntValue.class).getValue() == 10);
        assertTrue(r.getField(2, IntValue.class).getValue() == 2);
        assertTrue(r.getField(3, IntValue.class).getValue() == 3);
View Full Code Here

      Record record1 = new Record(origValue1, origValue2);
      Record record2 = new Record();
      try {
        // De/Serialize the record
        record1.write(new OutputViewDataOutputStreamWrapper(this.out));
        record2.read(new InputViewDataInputStreamWrapper(this.in));
 
        assertTrue(record1.getNumFields() == record2.getNumFields());
 
        StringValue rec1Val1 = record1.getField(0, StringValue.class);
        IntValue rec1Val2 = record1.getField(1, IntValue.class);
View Full Code Here

 
      record.clear();
      Assert.assertEquals(0, record.getNumFields());
 
      Record record2 = new Record(new IntValue(42));
      record2.read(new InputViewDataInputStreamWrapper(in));
      Assert.assertEquals(42, record2.getField(0, IntValue.class).getValue());
      record2.read(new InputViewDataInputStreamWrapper(in));
      Assert.assertEquals(23, record2.getField(0, IntValue.class).getValue());
    } catch (Throwable t) {
      Assert.fail("Test failed due to an exception: " + t.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.core.memory.InputViewDataInputStreamWrapper

Copyright © 2018 www.massapicom. 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.