Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.DataInputBuffer


    Expression expression = Expression.comparison("columnName1", "qualifier1", Comparison.Operator.EQ, Bytes.toBytes("value"));

    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


    Expression expression = Expression.comparison("columnName1", "qualifier1", Comparison.Operator.EQ, Bytes.toBytes("value"));

    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

  public void testWritableNullExpression() throws IOException {
    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

    descriptor.addIndexDescriptor(indexDescriptor2);

    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

        = new IdxIndexDescriptor(qualifierName1, IdxQualifierType.INT);

    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

    Expression expression = Expression.comparison("columnName1", "qualifier1", Comparison.Operator.EQ, Bytes.toBytes("value"));

    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

      r = new SequenceFile.Reader(fs, f.getPath(), getConf());
      key = (WritableComparable)ReflectionUtils.newInstance(
          r.getKeyClass(), getConf());
      val = (Writable)ReflectionUtils.newInstance(
          r.getValueClass(), getConf());
      inbuf = new DataInputBuffer();
      outbuf = new DataOutputBuffer();
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.DataInputBuffer

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.