Package org.apache.hadoop.hbase.io

Examples of org.apache.hadoop.hbase.io.ImmutableBytesWritable


   * @param key The key.
   * @return The value.
   * @see #values
   */
  public byte[] getValue(byte[] key) {
    return getValue(new ImmutableBytesWritable(key));
  }
View Full Code Here


  public byte[] getValue(byte[] key) {
    return getValue(new ImmutableBytesWritable(key));
  }

  private byte[] getValue(final ImmutableBytesWritable key) {
    ImmutableBytesWritable ibw = values.get(key);
    if (ibw == null)
      return null;
    return ibw.get();
  }
View Full Code Here

   * @param key The key.
   * @param value The value.
   * @see #values
   */
  public void setValue(byte[] key, byte[] value) {
    setValue(new ImmutableBytesWritable(key), new ImmutableBytesWritable(value));
  }
View Full Code Here

   * @param key The key.
   * @param value The value.
   */
  private void setValue(final ImmutableBytesWritable key,
      final String value) {
    setValue(key, new ImmutableBytesWritable(Bytes.toBytes(value)));
  }
View Full Code Here

   *
   * @param key Key whose key and value we're to remove from HTableDescriptor
   * parameters.
   */
  public void remove(final String key) {
    remove(new ImmutableBytesWritable(Bytes.toBytes(key)));
  }
View Full Code Here

   *
   * @param key Key whose key and value we're to remove from HTableDescriptor
   * parameters.
   */
  public void remove(final byte [] key) {
    remove(new ImmutableBytesWritable(key));
  }
View Full Code Here

  /**
   * @param key The key.
   * @return The value.
   */
  public byte[] getValue(byte[] key) {
    ImmutableBytesWritable ibw = values.get(new ImmutableBytesWritable(key));
    if (ibw == null)
      return null;
    return ibw.get();
  }
View Full Code Here

   * @param key The key.
   * @param value The value.
   * @return this (for chained invocation)
   */
  public HColumnDescriptor setValue(byte[] key, byte[] value) {
    values.put(new ImmutableBytesWritable(key),
      new ImmutableBytesWritable(value));
    return this;
  }
View Full Code Here

  /**
   * @param key Key whose key and value we're to remove from HCD parameters.
   */
  public void remove(final byte [] key) {
    values.remove(new ImmutableBytesWritable(key));
  }
View Full Code Here

      // version 6+
      this.name = Bytes.readByteArray(in);
      this.values.clear();
      int numValues = in.readInt();
      for (int i = 0; i < numValues; i++) {
        ImmutableBytesWritable key = new ImmutableBytesWritable();
        ImmutableBytesWritable value = new ImmutableBytesWritable();
        key.readFields(in);
        value.readFields(in);

        // in version 8, the BloomFilter setting changed from bool to enum
        if (version < 8 && Bytes.toString(key.get()).equals(BLOOMFILTER)) {
          value.set(Bytes.toBytes(
              Boolean.getBoolean(Bytes.toString(value.get()))
                ? BloomType.ROW.toString()
                : BloomType.NONE.toString()));
        }

        values.put(key, value);
      }
      if (version == 6) {
        // Convert old values.
        setValue(COMPRESSION, Compression.Algorithm.NONE.getName());
      }
      String value = getValue(HConstants.VERSIONS);
      this.cachedMaxVersions = (value != null)?
          Integer.valueOf(value).intValue(): DEFAULT_VERSIONS;
      if (version > 10) {
        configuration.clear();
        int numConfigs = in.readInt();
        for (int i = 0; i < numConfigs; i++) {
          ImmutableBytesWritable key = new ImmutableBytesWritable();
          ImmutableBytesWritable val = new ImmutableBytesWritable();
          key.readFields(in);
          val.readFields(in);
          configuration.put(
            Bytes.toString(key.get(), key.getOffset(), key.getLength()),
            Bytes.toString(val.get(), val.getOffset(), val.getLength()));
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.ImmutableBytesWritable

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.