Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.ByteWritable$Comparator


    MapWritable map = new MapWritable();
    map.put(new Text("one"), new VIntWritable(1));
    map.put(new Text("two"), new VLongWritable(2));
    Writable[] writables = new Writable[] {
      new BytesWritable(new byte[] { 1, 2, 3, 4 }),
      new ByteWritable((byte) 123), new BooleanWritable(true),
      new VIntWritable(12345), new VLongWritable(123456789L),
      new FloatWritable((float) 1.2), new DoubleWritable(1.234),
      new Text("random string"),
      new ObjectWritable("test")
    };
View Full Code Here


        }
        if(object instanceof Integer) {
            return new VIntWritable((Integer) object);
        }
        if(object instanceof Byte) {
            return new ByteWritable((Byte) object);
        }
        if(object instanceof Double) {
            return new DoubleWritable((Double) object);
        }
        if(object instanceof Float) {
View Full Code Here

    return readBytes(null);
  }

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

    }
    if(hadoopType == org.apache.hadoop.io.BooleanWritable.class) {
      return (T) new BooleanWritable((flinkType.getField(pos, BooleanValue.class)).getValue());
    }
    if(hadoopType == org.apache.hadoop.io.ByteWritable.class) {
      return (T) new ByteWritable((flinkType.getField(pos, ByteValue.class)).getValue());
    }

    throw new RuntimeException("Unable to convert Flink type ("+flinkType.getClass().getCanonicalName()+") to Hadoop.");
  }
View Full Code Here

        final Path file = new Path(new File("target/test/test-camel-byte").getAbsolutePath());
        Configuration conf = new Configuration();
        FileSystem fs1 = FileSystem.get(file.toUri(), conf);
        SequenceFile.Writer writer = createWriter(fs1, conf, file, NullWritable.class, ByteWritable.class);
        NullWritable keyWritable = NullWritable.get();
        ByteWritable valueWritable = new ByteWritable();
        byte value = 3;
        valueWritable.set(value);
        writer.append(keyWritable, valueWritable);
        writer.sync();
        writer.close();

        MockEndpoint resultEndpoint = context.getEndpoint("mock:result", MockEndpoint.class);
View Full Code Here

    }
    if(hadoopType == org.apache.hadoop.io.BooleanWritable.class) {
      return (T) new BooleanWritable((stratosphereType.getField(pos, BooleanValue.class)).getValue());
    }
    if(hadoopType == org.apache.hadoop.io.ByteWritable.class) {
      return (T) new ByteWritable((stratosphereType.getField(pos, ByteValue.class)).getValue());
    }

    throw new RuntimeException("Unable to convert Stratosphere type ("+stratosphereType.getClass().getCanonicalName()+") to Hadoop.");
  }
View Full Code Here

        return new IntWritable(Integer.parseInt(value));
    }

    @Override
    protected Object parseByte(String value) {
        return new ByteWritable(Byte.parseByte(value));
    }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.ByteWritable$Comparator

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.