Package org.apache.flink.core.memory

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


    int recordIndex = 0;
    for (int fileIndex = 0; fileIndex < this.degreeOfParallelism; fileIndex++) {
      ByteCounter byteCounter = new ByteCounter();
      DataOutputStream out = new DataOutputStream(byteCounter);
      for (int fileCount = 0; fileCount < this.getNumberOfTuplesPerFile(fileIndex); fileCount++, recordIndex++) {
        this.getRecord(recordIndex).write(new OutputViewDataOutputStreamWrapper(out));
      }
      this.rawDataSizes[fileIndex] = byteCounter.getLength();
    }
  }
View Full Code Here


  public static <T extends IOReadableWritable> T createCopy(final T original) throws IOException {

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final DataOutputStream dos = new DataOutputStream(baos);

    original.write(new OutputViewDataOutputStreamWrapper(dos));

    final String className = original.getClass().getName();
    if (className == null) {
      fail("Class name is null");
    }
View Full Code Here

  public static <T extends IOReadableWritable> T createCopyWritable(final T original) throws IOException {

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final DataOutputStream dos = new DataOutputStream(baos);

    original.write(new OutputViewDataOutputStreamWrapper(dos));

    final String className = original.getClass().getName();

    Class<T> clazz = null;
View Full Code Here

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final DataOutputStream dos = new DataOutputStream(baos);

    try {
      original.write(new OutputViewDataOutputStreamWrapper(dos));
    } catch (IOException ioe) {
      fail(ioe.getMessage());
    }

    final String className = original.getClass().getName();
View Full Code Here

    DataOutputStream dos = new DataOutputStream(baos);
   
    Tuple t = new Tuple();
    t.addAttribute("Hello world!");
    try {
      t.write(new OutputViewDataOutputStreamWrapper(dos));
    } catch (IOException e1) {
      e1.printStackTrace();
    }
   
    t.addAttribute("2ndAttribute");
    try {
      t.write(new OutputViewDataOutputStreamWrapper(dos));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    byte[] ba = "attr1|attr2|3|4|attr5|thisdoesnotbelongtothetuple".getBytes();
    int[] of2 = {0,6,12,14,16,22};
    t = new Tuple(ba, of2, 5);
   
    try {
      t.write(new OutputViewDataOutputStreamWrapper(dos));
    } catch (IOException e) {
      e.printStackTrace();
    }
   
    try {
View Full Code Here

      out = new DataOutputStream(new PipedOutputStream(pipedInput));
     
      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

      out = new DataOutputStream(new PipedOutputStream(pipedInput));
     
      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 writeStart = System.currentTimeMillis();
     
      int valsLeft = NUM_INTS_WRITTEN;
      while (valsLeft-- > 0) {
        rec.setValue(valsLeft);
        rec.write(new OutputViewDataOutputStreamWrapper(daos));
      }
      daos.close();
      daos = null;
     
      long writeElapsed = System.currentTimeMillis() - writeStart;
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()) {
View Full Code Here

TOP

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

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.