当前位置: 首页>>代码示例>>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;未经允许,请勿转载。