CharBuffer buffer = DECODER_POOL.get().decode(contents.get()); if (buffer.hasRemaining() == false) { throw invalidNumber(contents); int column = Character.digit(c, 10); if (column < 0) { throw invalidNumber(contents); throw invalidNumber(contents); throw invalidNumber(contents); } else { if (negativeResult == Long.MIN_VALUE) { throw invalidNumber(contents);
CharBuffer buffer = DECODER_POOL.get().decode(contents.get()); if (buffer.hasRemaining() == false) { throw invalidNumber(contents); int column = Character.digit(c, 10); if (column < 0) { throw invalidNumber(contents); throw invalidNumber(contents); throw invalidNumber(contents); } else { if (negativeResult == Integer.MIN_VALUE) { throw invalidNumber(contents);
/** * Parses the given {@link StringOption} which may represent a decimal value. * @param contents the text contents * @return the parsed decimal value * @throws NullPointerException if the {@link StringOption} is/represents {@code null} * @throws IllegalArgumentException if the character sequence is wrong * @since 0.9.1 */ public static BigDecimal parseDecimal(StringOption contents) { CharBuffer buffer = DECODER_POOL.get().decode(contents.get()); if (buffer.hasRemaining() == false) { throw invalidNumber(contents); } int length = buffer.remaining(); if (buffer.hasArray()) { char[] array = buffer.array(); int offsetInArray = buffer.position() + buffer.arrayOffset(); return new BigDecimal(array, offsetInArray, length); } else { char[] cbuf = borrowCharArrayBuf(length); buffer.get(cbuf, 0, length); return new BigDecimal(cbuf, 0, length); } }