Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.BooleanWritable


    }

    @Override
    Object next(Object previous) throws IOException {
      super.next(previous);
      BooleanWritable result = null;
      if (valuePresent) {
        if (previous == null) {
          result = new BooleanWritable();
        } else {
          result = (BooleanWritable) previous;
        }
        result.set(reader.next() == 1);
      }
      return result;
    }
View Full Code Here


  }

  @Test
  public void testBoolean() throws Exception {
    boolean j = false;
    BooleanWritable w = new BooleanWritable(j);
    testInputOutputFn(Writables.booleans(), j, w);
  }
View Full Code Here

          } else if (args[i] instanceof ImmutableBytesWritable) {
            arr[i] = (ImmutableBytesWritable)args[i];
          } else if (args[i] instanceof String) {
            arr[i] = new ImmutableBytesWritable(Bytes.toBytes((String)args[i]));
          } else if (args[i] instanceof Boolean) {
            arr[i] = new BooleanWritable(((Boolean)args[i]).booleanValue());
          } else {
            throw new IllegalArgumentException("Requires byte [] or " +
              "ImmutableBytesWritable, not " + args[i]);
          }
        }
View Full Code Here

    return ((BooleanWritable)o).get();
  }

  @Override
  public Object copyObject(Object o) {
    return o == null ? null : new BooleanWritable(((BooleanWritable)o).get());
  }
View Full Code Here

    return o == null ? null : Boolean.valueOf(((BooleanWritable)o).get());
  }

  @Override
  public Object create(boolean value) {
    return new BooleanWritable(value);
  }
View Full Code Here

    super(PrimitiveObjectInspectorUtils.booleanTypeEntry);
  }
 
  @Override
  public Object getPrimitiveWritableObject(Object o) {
    return o == null ? null : new BooleanWritable(((Boolean)o).booleanValue());
  }
View Full Code Here

  private Writable allocateWritable(Type type) {
    switch (type) {
    case BYTE:
      return new ByteWritable();
    case BOOL:
      return new BooleanWritable();
    case INT:
      return new IntWritable();
    case SHORT:
      return new ShortWritable();
    case LONG:
View Full Code Here

          case VOID: {
            return null;
          }

          case BOOLEAN: {
            BooleanWritable r = reuse == null ? new BooleanWritable() : (BooleanWritable)reuse;
            r = (BooleanWritable)in.readBoolean(r);
            return r;
          }
          case BYTE: {
            ByteWritable r = reuse == null ? new ByteWritable() : (ByteWritable)reuse;
View Full Code Here

    return readByte(null);
  }

  public BooleanWritable readBoolean(BooleanWritable bw) throws IOException {
    if (bw == null) {
      bw = new BooleanWritable();
    }
    bw.set(in.readBool());
    return bw;
  }
View Full Code Here

          case VOID: {
            return;
          }
          case BOOLEAN: {
            BooleanObjectInspector boi = (BooleanObjectInspector)poi;
            BooleanWritable r = reuse == null ? new BooleanWritable() : (BooleanWritable)reuse;
            r.set(boi.get(o));
            tbOut.write(r);
            return;
          }
          case BYTE: {
            ByteObjectInspector boi = (ByteObjectInspector)poi;
            ByteWritable r = reuse == null ? new ByteWritable() : (ByteWritable)reuse;
            r.set(boi.get(o));
            tbOut.write(r);
            return;
          }
          case SHORT: {
            ShortObjectInspector spoi = (ShortObjectInspector)poi;
            ShortWritable r = reuse == null ? new ShortWritable() : (ShortWritable)reuse;
            r.set(spoi.get(o));
            tbOut.write(r);
            return;
          }
          case INT: {
            IntObjectInspector ioi = (IntObjectInspector)poi;
            IntWritable r = reuse == null ? new IntWritable() : (IntWritable)reuse;
            r.set(ioi.get(o));
            tbOut.write(r);
            return;
          }
          case LONG: {
            LongObjectInspector loi = (LongObjectInspector)poi;
            LongWritable r = reuse == null ? new LongWritable() : (LongWritable)reuse;
            r.set(loi.get(o));
            tbOut.write(r);
            return;
          }
          case FLOAT: {
            FloatObjectInspector foi = (FloatObjectInspector)poi;
            FloatWritable r = reuse == null ? new FloatWritable() : (FloatWritable)reuse;
            r.set(foi.get(o));
            tbOut.write(r);
            return;
          }
          case DOUBLE: {
            DoubleObjectInspector doi = (DoubleObjectInspector)poi;
            DoubleWritable r = reuse == null ? new DoubleWritable() : (DoubleWritable)reuse;
            r.set(doi.get(o));
            tbOut.write(r);
            return;
          }
          case STRING: {
            StringObjectInspector soi = (StringObjectInspector)poi;
View Full Code Here

TOP

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

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.