Package org.apache.flink.core.memory

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


  public T nextRecord(T record) throws IOException {
    if (this.reachedEnd()) {
      return null;
    }
   
    record = this.deserialize(record, new InputViewDataInputStreamWrapper(this.dataInputStream));
    this.readRecords++;
    return record;
  }
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

    }

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

    copy.read(new InputViewDataInputStreamWrapper(dis));
    if (dis.available() > 0) {
      throw new IOException("The coped result was not fully consumed.");
    }

    return copy;
View Full Code Here

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

    try {
      copy.read(new InputViewDataInputStreamWrapper(dis));
    } catch (IOException e) {
      fail(e.getMessage());
    }

    return copy;
View Full Code Here

      e.printStackTrace();
    }
   
    t = new Tuple();
    try {
      t.read(new InputViewDataInputStreamWrapper(dis));
     
      Assert.assertTrue(t.getNumberOfColumns() == 1);
      Assert.assertTrue(t.getStringValueAt(0).equals("Hello world!"));
      Assert.assertTrue(t.toString().equals("Hello world!|"));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    t = new Tuple();
    try {
      t.read(new InputViewDataInputStreamWrapper(dis));
     
      Assert.assertTrue(t.getNumberOfColumns() == 2);
      Assert.assertTrue(t.getStringValueAt(0).equals("Hello world!"));
      Assert.assertTrue(t.getStringValueAt(1).equals("2ndAttribute"));
      Assert.assertTrue(t.toString().equals("Hello world!|2ndAttribute|"));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    t = new Tuple();
    try {
      t.read(new InputViewDataInputStreamWrapper(dis));
     
      Assert.assertTrue(t.getNumberOfColumns() == 5);
      Assert.assertTrue(t.getStringValueAt(0).equals("attr1"));
      Assert.assertTrue(t.getStringValueAt(1).equals("attr2"));
      Assert.assertTrue(t.getLongValueAt(2) == 3);
View Full Code Here

      rec = new Record(1);
      rec.setField(0, new IntValue());
     
      rec.write(new OutputViewDataOutputStreamWrapper(out));
      rec = new Record();
      rec.read(new InputViewDataInputStreamWrapper(in));
   
    } catch (IOException e) {
      fail("Test erroneous");
    }
View Full Code Here

      rec = new Record(1);
      rec.setField(0, new IntValue());
     
      rec.write(new OutputViewDataOutputStreamWrapper(out));
      rec = new Record();
      rec.read(new InputViewDataInputStreamWrapper(in));
   
    } catch (IOException e) {
      fail("Test erroneous");
    }
View Full Code Here

     
      long readStart = System.currentTimeMillis();
     
      valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        rec.read(new InputViewDataInputStreamWrapper(dais));
      }
      dais.close();
      dais = null;
     
      long readElapsed = System.currentTimeMillis() - readStart;
View Full Code Here

    // test serialization
    try {
      NfIntStringPair mPairActual = new NfIntStringPair();

      pair1.write(new OutputViewDataOutputStreamWrapper(out));
      mPairActual.read(new InputViewDataInputStreamWrapper(in));

      Assert.assertEquals(pair1, mPairActual);
    } catch (IOException e) {
      Assert.fail("Unexpected IOException");
    }
View Full Code Here

    // now test data transfer
    NfIntStringMap nMap = new NfIntStringMap();
    try {
      map0.write(new OutputViewDataOutputStreamWrapper(out));
      nMap.read(new InputViewDataInputStreamWrapper(in));
    } catch (Exception e) {
      Assert.assertTrue(false);
    }
    for (Entry<IntValue, StringValue> entry : map0.entrySet()) {
      Assert.assertEquals(entry.getKey().getValue(), Integer.parseInt(entry.getValue().toString()));
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.