Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.VIntWritable


  public void testKeyItr() throws Exception
  {
    int i = 0;
    for(i = table.length - 1; i >= 0; i--
    {
      bm.put(new Text(table[i]), new VIntWritable(i));
    }
    Assert.assertEquals(table.length, bm.size());
   
    Iterator<Writable> it = bm.keyIterator(wObj);
    i=0;
View Full Code Here


  public void testEntryItr() throws Exception
  {
    int i = 0;
    for(i = table.length - 1; i >= 0; i--
    {
      bm.put(new Text(table[i]), new VIntWritable(i));
    }
    Assert.assertEquals(table.length, bm.size());
   
    Iterator<ByteBasedSortedMap.WritableEntry> it = bm.entryIterator(wEntry);
    i=0;
View Full Code Here

  public void testMultiplePut() throws Exception
  {
    int i = 0;
    for(i = table.length - 1; i >= 0; i--
    {
      bm.put(new Text(table[i]), new VIntWritable(i));
    }
    for(i = table.length - 1; i >= 0; i--
    {
      bm.put(new Text(table[i]), new VIntWritable(i));
    }
    Assert.assertEquals(table.length, bm.size());
    for(i=0; i < table.length; i++)
    {
      bm.getKey(i, wObj);
View Full Code Here

  {
    int i = 0;
    for(i = 0; i < table.length; i++
    {
      int j = (i + 13) % table.length;
      bm.put(new Text(table[j]), new VIntWritable(j));
    }
    Assert.assertEquals(table.length, bm.size());
    for(i=0; i < table.length; i++)
    {
      bm.getKey(i, wObj);
View Full Code Here

    return readShort(null);
  }

  public VIntWritable readVInt(VIntWritable iw) throws IOException {
    if (iw == null) {
      iw = new VIntWritable();
    }
    iw.set(in.readInt());
    return iw;
  }
View Full Code Here

      byte[] buffer = new byte[in.readInt()];
      in.readFully(buffer);
      return new String(buffer, UTF8);

    case DataType.INTEGER:
      VIntWritable vint = new VIntWritable();
      vint.readFields(in);
      return vint.get();

    case DataType.LONG:
      VLongWritable vlong = new VLongWritable();
      vlong.readFields(in);
      return vlong.get();
View Full Code Here

        writeDatum(out, entry.getValue());
      }
      return;

    case DataType.INTEGER:
      new VIntWritable((Integer) val).write(out);
      return;

    case DataType.LONG:
      new VLongWritable((Long) val).write(out);
      return;
View Full Code Here

      byte[] buffer = new byte[in.readInt()];
      in.readFully(buffer);
      return new String(buffer, UTF8);

    case DataType.INTEGER:
      VIntWritable vint = new VIntWritable();
      vint.readFields(in);
      return vint.get();

    case DataType.LONG:
      VLongWritable vlong = new VLongWritable();
      vlong.readFields(in);
      return vlong.get();
View Full Code Here

      }
      return;

    case DataType.INTEGER:
      out.writeByte(DataType.INTEGER);
      new VIntWritable((Integer) val).write(out);
      return;

    case DataType.LONG:
      out.writeByte(DataType.LONG);
      new VLongWritable((Long) val).write(out);
View Full Code Here

 
  @Override
  public void readFields(DataInput in) throws IOException {
    representedAsList = in.readBoolean();
   
    VIntWritable vInt = new VIntWritable();
    VLongWritable vLong = new VLongWritable();
   
    if (representedAsList) {
      transactionSet = new ArrayList<Pair<List<Integer>,Long>>();
      vInt.readFields(in);
      int numTransactions = vInt.get();
      for (int i = 0; i < numTransactions; i++) {
        vLong.readFields(in);
        Long support = vLong.get();
       
        vInt.readFields(in);
        int length = vInt.get();
       
        Integer[] items = new Integer[length];
        for (int j = 0; j < length; j++) {
          vInt.readFields(in);
          items[j] = vInt.get();
        }
        Pair<List<Integer>,Long> transaction = new Pair<List<Integer>,Long>(Arrays.asList(items), support);
        transactionSet.add(transaction);
      }
    } else {
      vInt.readFields(in);
      nodes = vInt.get();
      attribute = new int[nodes];
      nodeCount = new long[nodes];
      childCount = new int[nodes];
      nodeChildren = new int[nodes][];
      for (int i = 0; i < nodes; i++) {
        vInt.readFields(in);
        attribute[i] = vInt.get();
        vLong.readFields(in);
        nodeCount[i] = vLong.get();
        vInt.readFields(in);
        int childCountI = vInt.get();
        childCount[i] = childCountI;
        nodeChildren[i] = new int[childCountI];
        for (int j = 0; j < childCountI; j++) {
          vInt.readFields(in);
          nodeChildren[i][j] = vInt.get();
        }
      }
    }
  }
View Full Code Here

TOP

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

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.