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


Java NumberInput.inLongRange方法代码示例

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


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

示例1: _parseSlowInt

import com.fasterxml.jackson.core.io.NumberInput; //导入方法依赖的package包/类
private void _parseSlowInt(int expType) throws IOException
{
    String numStr = _textBuffer.contentsAsString();
    try {
        int len = _intLength;
        char[] buf = _textBuffer.getTextBuffer();
        int offset = _textBuffer.getTextOffset();
        if (_numberNegative) {
            ++offset;
        }
        // Some long cases still...
        if (NumberInput.inLongRange(buf, offset, len, _numberNegative)) {
            // Probably faster to construct a String, call parse, than to use BigInteger
            _numberLong = Long.parseLong(numStr);
            _numTypesValid = NR_LONG;
        } else {
            // nope, need the heavy guns... (rare case)
            _numberBigInt = new BigInteger(numStr);
            _numTypesValid = NR_BIGINT;
        }
    } catch (NumberFormatException nex) {
        // Can this ever occur? Due to overflow, maybe?
        _wrapError("Malformed numeric value '"+numStr+"'", nex);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:ParserBase.java

示例2: parse

import com.fasterxml.jackson.core.io.NumberInput; //导入方法依赖的package包/类
public Date parse(String paramString, ParsePosition paramParsePosition)
{
  if (looksLikeISO8601(paramString))
    return parseAsISO8601(paramString, paramParsePosition);
  int i = paramString.length();
  int j;
  do
  {
    i--;
    if (i < 0)
      break;
    j = paramString.charAt(i);
  }
  while (((j < 48) || (j > 57)) && ((i <= 0) && (j == 45)));
  if ((i < 0) && (NumberInput.inLongRange(paramString, false)))
    return new Date(Long.parseLong(paramString));
  return parseAsRFC1123(paramString, paramParsePosition);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:19,代码来源:StdDateFormat.java

示例3: _parseSlowInt

import com.fasterxml.jackson.core.io.NumberInput; //导入方法依赖的package包/类
private void _parseSlowInt(int expType, char[] buf, int offset, int len)
    throws IOException, JsonParseException
{
    String numStr = _textBuffer.contentsAsString();
    try {
        // [JACKSON-230] Some long cases still...
        if (NumberInput.inLongRange(buf, offset, len, _numberNegative)) {
            // Probably faster to construct a String, call parse, than to use BigInteger
            _numberLong = Long.parseLong(numStr);
            _numTypesValid = NR_LONG;
        } else {
            // nope, need the heavy guns... (rare case)
            _numberBigInt = new BigInteger(numStr);
            _numTypesValid = NR_BIGINT;
        }
    } catch (NumberFormatException nex) {
        // Can this ever occur? Due to overflow, maybe?
        _wrapError("Malformed numeric value '"+numStr+"'", nex);
    }
}
 
开发者ID:BFergerson,项目名称:Beam,代码行数:21,代码来源:ParserBase.java

示例4: _parseSlowIntValue

import com.fasterxml.jackson.core.io.NumberInput; //导入方法依赖的package包/类
private void _parseSlowIntValue(int expType, char[] buf, int offset, int len)
    throws IOException, JsonParseException
{
    String numStr = _textBuffer.contentsAsString();
    try {
        // [JACKSON-230] Some long cases still...
        if (NumberInput.inLongRange(buf, offset, len, _numberNegative)) {
            // Probably faster to construct a String, call parse, than to use BigInteger
            _numberLong = Long.parseLong(numStr);
            _numTypesValid = NR_LONG;
        } else {
            // nope, need the heavy guns... (rare case)
            _numberBigInt = new BigInteger(numStr);
            _numTypesValid = NR_BIGINT;
        }
    } catch (NumberFormatException nex) {
        // Can this ever occur? Due to overflow, maybe?
        _wrapError("Malformed numeric value '"+numStr+"'", nex);
    }
}
 
开发者ID:kbase,项目名称:cmonkey,代码行数:21,代码来源:KBaseJsonParser.java

示例5: parse

import com.fasterxml.jackson.core.io.NumberInput; //导入方法依赖的package包/类
@Override
public Date parse(String dateStr, ParsePosition pos)
{
    if (looksLikeISO8601(dateStr)) { // also includes "plain"
        return parseAsISO8601(dateStr, pos);
    }
    /* 14-Feb-2010, tatu: As per [JACKSON-236], better also
     *   consider "stringified" simple time stamp
     */
    int i = dateStr.length();
    while (--i >= 0) {
        char ch = dateStr.charAt(i);
        if (ch < '0' || ch > '9') break;
    }
    if (i < 0) { // all digits
        if (NumberInput.inLongRange(dateStr, false)) {
            return new Date(Long.parseLong(dateStr));
        }
    }
    // Otherwise, fall back to using RFC 1123
    return parseAsRFC1123(dateStr, pos);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:23,代码来源:StdDateFormat.java


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