Package com.reddit.pig

Source Code of com.reddit.pig.TO_36

package com.reddit.pig;

import java.lang.Number;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;


public class TO_36 extends EvalFunc<String> {
    public String exec(Tuple input) throws IOException {
        Object obj = input.get(0);
        Number number;

        if (obj instanceof Number) {
            number = (Number)obj;
        } else {
            number = Long.decode(obj.toString());
        }

        return Long.toString(number.longValue(), 36);
    }
}
TOP

Related Classes of com.reddit.pig.TO_36

TOP
Copyright © 2018 www.massapi.com. 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.