Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.DataInputBuffer.reset()


    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    WritableHelper.writeInstance(dataOutputBuffer, expression);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    Expression clonedExpression = WritableHelper.readInstance(dataInputBuffer, Expression.class);

    Assert.assertEquals("The expression was not the same after being written and read", expression, clonedExpression);
  }
View Full Code Here


    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    WritableHelper.writeInstanceNullable(dataOutputBuffer, expression);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    Expression clonedExpression = WritableHelper.readInstanceNullable(dataInputBuffer, Expression.class);

    Assert.assertEquals("The expression was not the same after being written and read", expression, clonedExpression);
  }
View Full Code Here

  public void testWriteReadInstanceNullableWithNull() throws IOException {
    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    WritableHelper.writeInstanceNullable(dataOutputBuffer, null);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    Expression clonedExpression = WritableHelper.readInstanceNullable(dataInputBuffer, Expression.class);

    Assert.assertNull("A null value was expected", clonedExpression);
  }
View Full Code Here

    IdxScan idxScan = new IdxScan(expression);
    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    idxScan.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    IdxScan clonedScan = new IdxScan();
    clonedScan.readFields(dataInputBuffer);

    Assert.assertEquals("The expression was not the same after being written and read", idxScan.getExpression(), clonedScan.getExpression());
View Full Code Here

    IdxScan idxScan = new IdxScan();
    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    idxScan.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    IdxScan clonedScan = new IdxScan();
    clonedScan.readFields(dataInputBuffer);

    Assert.assertEquals("The expression was not the same after being written and read", idxScan.getExpression(), clonedScan.getExpression());
View Full Code Here

    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    descriptor.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    IdxColumnDescriptor clonedDescriptor = new IdxColumnDescriptor();
    clonedDescriptor.readFields(dataInputBuffer);

    Assert.assertEquals("The expression was not the same after being written and read", descriptor, clonedDescriptor);
View Full Code Here

    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    descriptor.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    IdxIndexDescriptor clonedDescriptor = new IdxIndexDescriptor();
    clonedDescriptor.readFields(dataInputBuffer);

    Assert.assertEquals("The descriptor was not the same after being written and read", descriptor, clonedDescriptor);
View Full Code Here

    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    expression.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    Expression clonedExpression = new Comparison();
    clonedExpression.readFields(dataInputBuffer);

    Assert.assertEquals("The expression was not the same after being written and read", expression, clonedExpression);
View Full Code Here

    DataOutputBuffer dataOutputBuffer = new DataOutputBuffer();
    expression.write(dataOutputBuffer);

    DataInputBuffer dataInputBuffer = new DataInputBuffer();
    dataInputBuffer.reset(dataOutputBuffer.getData(), dataOutputBuffer.getLength());

    Expression clonedExpression = new Or();
    clonedExpression.readFields(dataInputBuffer);

    Assert.assertEquals("The expression was not the same after being written and read", expression, clonedExpression);
View Full Code Here

                                         " not found");
      wrap.initCause(exp);
      throw wrap;
    }
    DataInputBuffer splitBuffer = new DataInputBuffer();
    splitBuffer.reset(split.get(), 0, split.getSize());
    instantiatedSplit.readFields(splitBuffer);
   
    // if it is a file split, we can give more details
    if (instantiatedSplit instanceof FileSplit) {
      FileSplit fileSplit = (FileSplit) instantiatedSplit;
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.