当前位置: 首页>>代码示例>>Java>>正文


Java JBBPBitInputStream.getCounter方法代码示例

本文整理汇总了Java中com.igormaznitsa.jbbp.io.JBBPBitInputStream.getCounter方法的典型用法代码示例。如果您正苦于以下问题:Java JBBPBitInputStream.getCounter方法的具体用法?Java JBBPBitInputStream.getCounter怎么用?Java JBBPBitInputStream.getCounter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.igormaznitsa.jbbp.io.JBBPBitInputStream的用法示例。


在下文中一共展示了JBBPBitInputStream.getCounter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import com.igormaznitsa.jbbp.io.JBBPBitInputStream; //导入方法依赖的package包/类
/**
 * Parse am input stream with defined external value provider.
 *
 * @param in                    an input stream which content will be parsed, it must not be null
 * @param varFieldProcessor     a var field processor, it may be null if there is
 *                              not any var field in a script, otherwise NPE will be thrown during parsing
 * @param externalValueProvider an external value provider, it can be null but
 *                              only if the script doesn't have fields desired the provider
 * @return the parsed content as the root structure
 * @throws IOException it will be thrown for transport errors
 */
public JBBPFieldStruct parse(final InputStream in, final JBBPVarFieldProcessor varFieldProcessor, final JBBPExternalValueProvider externalValueProvider) throws IOException {
    final JBBPBitInputStream bitInStream = in instanceof JBBPBitInputStream ? (JBBPBitInputStream) in : new JBBPBitInputStream(in, bitOrder);
    this.finalStreamByteCounter = bitInStream.getCounter();

    final JBBPNamedNumericFieldMap fieldMap;
    if (this.compiledBlock.hasEvaluatedSizeArrays() || this.compiledBlock.hasVarFields()) {
        fieldMap = new JBBPNamedNumericFieldMap(externalValueProvider);
    } else {
        fieldMap = null;
    }

    if (this.compiledBlock.hasVarFields()) {
        JBBPUtils.assertNotNull(varFieldProcessor, "The Script contains VAR fields, a var field processor must be provided");
    }
    try {
        return new JBBPFieldStruct(new JBBPNamedFieldInfo("", "", -1), parseStruct(bitInStream, new JBBPIntCounter(), varFieldProcessor, fieldMap, new JBBPIntCounter(), new JBBPIntCounter(), false));
    } finally {
        this.finalStreamByteCounter = bitInStream.getCounter();
    }
}
 
开发者ID:raydac,项目名称:java-binary-block-parser,代码行数:32,代码来源:JBBPParser.java

示例2: eval

import com.igormaznitsa.jbbp.io.JBBPBitInputStream; //导入方法依赖的package包/类
@Override
public int eval(final JBBPBitInputStream inStream, final int currentCompiledBlockOffset, final JBBPCompiledBlock block, final JBBPNamedNumericFieldMap fieldMap) {
    return externalFieldName == null
            ? fieldMap.get(block.getNamedFields()[this.namedFieldIndex]).getAsInt()
            : this.externalFieldName.equals("$")
            ? (int) inStream.getCounter()
            : fieldMap.getExternalFieldValue(this.externalFieldName, block, this);
}
 
开发者ID:raydac,项目名称:java-binary-block-parser,代码行数:9,代码来源:JBBPOnlyFieldEvaluator.java


注:本文中的com.igormaznitsa.jbbp.io.JBBPBitInputStream.getCounter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。