convertStringExtra(stringp, dOut, false);
}
private void convertStringExtra(UTF8StringPointable stringp, DataOutput dOut, boolean connoicalForm)
throws SystemException, IOException {
ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
charIterator.reset();
byte decimalPlace = 0;
long value = 0;
boolean pastDecimal = false, negativeValue = false;
int count = 0;
int c = 0;
// Check sign.
c = charIterator.next();
if (c == Character.valueOf('-')) {
negativeValue = true;
c = charIterator.next();
}
// Read in the number.
do {
if (count + 1 > XSDecimalPointable.PRECISION) {
throw new SystemException(ErrorCode.FOCA0006);
} else if (Character.isDigit(c)) {
value = value * 10 + Character.getNumericValue(c);
if (pastDecimal) {
decimalPlace++;
}
count++;
} else if (c == Character.valueOf('.') && pastDecimal == false) {
pastDecimal = true;
} else if (c == Character.valueOf('E') || c == Character.valueOf('e') && connoicalForm) {
break;
} else {
throw new SystemException(ErrorCode.FORG0001);
}
} while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR);
// Parse the exponent.
if (c == Character.valueOf('E') || c == Character.valueOf('e') && connoicalForm) {
int moveOffset = 0;
boolean negativeOffset = false;
// Check for the negative sign.
c = charIterator.next();
if (c == Character.valueOf('-')) {
negativeOffset = true;
c = charIterator.next();
}
// Process the numeric value.
do {
if (Character.isDigit(c)) {
moveOffset = moveOffset * 10 + Character.getNumericValue(c);
} else {
throw new SystemException(ErrorCode.FORG0001);
}
} while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR);
decimalPlace -= (negativeOffset ? -moveOffset : moveOffset);
}
// Normalize the value and take off trailing zeros.
while (value != 0 && value % 10 == 0) {