當前位置: 首頁>>代碼示例>>Java>>正文


Java BytesUtil.writeLong方法代碼示例

本文整理匯總了Java中org.apache.kylin.common.util.BytesUtil.writeLong方法的典型用法代碼示例。如果您正苦於以下問題:Java BytesUtil.writeLong方法的具體用法?Java BytesUtil.writeLong怎麽用?Java BytesUtil.writeLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.kylin.common.util.BytesUtil的用法示例。


在下文中一共展示了BytesUtil.writeLong方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: encode

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void encode(String valueStr, byte[] output, int outputOffset) {
    if (valueStr == null) {
        Arrays.fill(output, outputOffset, outputOffset + fixedLen, NULL);
        return;
    }

    long integer = Long.parseLong(valueStr);
    if (integer > CAP[fixedLen] || integer < TAIL[fixedLen]) {
        if (avoidVerbose++ % 10000 == 0) {
            logger.warn("Expect at most " + fixedLen + " bytes, but got " + valueStr + ", will truncate, hit times:" + avoidVerbose);
        }
    }

    if (integer == TAIL[fixedLen]) {
        if (avoidVerbose2++ % 10000 == 0) {
            logger.warn("Value " + valueStr + " does not fit into " + fixedLen + " bytes ");
        }
    }

    BytesUtil.writeLong(integer + CAP[fixedLen], output, outputOffset, fixedLen);//apply an offset to preserve binary order, overflow is okay
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:23,代碼來源:IntegerDimEnc.java

示例2: encode

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void encode(String valueStr, byte[] output, int outputOffset) {
    if (valueStr == null) {
        Arrays.fill(output, outputOffset, outputOffset + fixedLen, NULL);
        return;
    }

    long integer = Long.parseLong(valueStr);
    if (integer > CAP[fixedLen]) {
        if (avoidVerbose++ % 10000 == 0) {
            logger.warn("Expect at most " + fixedLen + " bytes, but got " + valueStr + ", will truncate, hit times:" + avoidVerbose);
        }
    }

    BytesUtil.writeLong(integer, output, outputOffset, fixedLen);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:17,代碼來源:IntDimEnc.java

示例3: encode

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void encode(String value, byte[] output, int outputOffset) {
    if (value == null) {
        Arrays.fill(output, outputOffset, outputOffset + fixedLen, NULL);
        return;
    }

    Integer encodeValue = map.get(value);
    if (encodeValue == null) {
        throw new IllegalArgumentException("Value '" + value + "' is not a recognized boolean value.");
    }

    BytesUtil.writeLong(encodeValue, output, outputOffset, fixedLen);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:15,代碼來源:BooleanDimEnc.java

示例4: encode

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void encode(String value, byte[] output, int outputOffset) {
    if (value == null) {
        Arrays.fill(output, outputOffset, outputOffset + fixedLen, NULL);
        return;
    }

    long code = codec.valueToCode(value);
    BytesUtil.writeLong(code, output, outputOffset, fixedLen);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:11,代碼來源:AbstractDateDimEnc.java

示例5: gt

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
private CompareTupleFilter gt(ColumnTupleFilter col, int v) {
    CompareTupleFilter r = new CompareTupleFilter(FilterOperatorEnum.GT);
    r.addChild(col);

    int c = col.getColumn().getColumnDesc().getZeroBasedIndex();
    int len = info.getCodeSystem().maxCodeLength(c);
    ByteArray bytes = new ByteArray(len);
    BytesUtil.writeLong(v, bytes.array(), bytes.offset(), len);
    r.addChild(new ConstantTupleFilter(bytes));

    return r;
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:13,代碼來源:GTScannerBenchmark.java

示例6: eq

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
private CompareTupleFilter eq(ColumnTupleFilter col, int... values) {
    CompareTupleFilter r = new CompareTupleFilter(FilterOperatorEnum.IN);
    r.addChild(col);

    List<ByteArray> list = Lists.newArrayList();
    for (int v : values) {
        int c = col.getColumn().getColumnDesc().getZeroBasedIndex();
        int len = info.getCodeSystem().maxCodeLength(c);
        ByteArray bytes = new ByteArray(len);
        BytesUtil.writeLong(v, bytes.array(), bytes.offset(), len);
        list.add(bytes);
    }
    r.addChild(new ConstantTupleFilter(list));
    return r;
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:16,代碼來源:GTScannerBenchmark.java

示例7: serialize

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void serialize(Long value, ByteBuffer out) {
    BytesUtil.writeLong(value, out);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:5,代碼來源:Long8Serializer.java

示例8: serialize

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
@Override
public void serialize(Object code, ByteBuffer buf) {
    BytesUtil.writeLong(Long.parseLong(code.toString()), buf);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:5,代碼來源:FilterCodeSystemFactory.java

示例9: decode

import org.apache.kylin.common.util.BytesUtil; //導入方法依賴的package包/類
private String decode(long code) {
    BytesUtil.writeLong(code, buf, 0, buf.length);
    return enc.decode(buf, 0, buf.length);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:5,代碼來源:TimeDimEncTest.java


注:本文中的org.apache.kylin.common.util.BytesUtil.writeLong方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。