All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flipkart.hbaseobjectmapper.Util Maven / Gradle / Ivy

Go to download

HBase ORM is a light-weight, thread-safe and performant library that enables: [1] object-oriented access of HBase rows (Data Access Object) with minimal code and good testability [2] reading from and/or writing to HBase tables in Hadoop MapReduce jobs

There is a newer version: 1.19
Show newest version
package com.flipkart.hbaseobjectmapper;

import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.util.Bytes;

import java.util.ArrayList;
import java.util.List;

/**
 * Utility class
 */
public class Util {
    /**
     * Converts a {@link String} to {@link ImmutableBytesWritable} object
     */
    public static ImmutableBytesWritable strToIbw(String str) {
        return str == null ? null : new ImmutableBytesWritable(Bytes.toBytes(str));
    }

    /**
     * Converts a list of {@link String}s to a list of {@link ImmutableBytesWritable} objects
     */
    public static List strToIbw(Iterable strList) {
        List ibwList = new ArrayList();
        for (String str : strList) {
            ibwList.add(strToIbw(str));
        }
        return ibwList;
    }

    /**
     * Converts an {@link ImmutableBytesWritable} object to {@link String}
     */
    public static String ibwToStr(ImmutableBytesWritable ibw) {
        return ibw == null ? null : Bytes.toString(ibw.get());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy