本文整理汇总了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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}