dOut.write(durationp.getByteArray(), durationp.getStartOffset(), durationp.getLength());
}
@Override
public void convertString(UTF8StringPointable stringp, DataOutput dOut) throws SystemException, IOException {
ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
charIterator.reset();
boolean pastDecimal = false, timeSection = false;
byte decimalPlace = 3;
int value = 0;
long year = 0, month = 0, day = 0, hour = 0, minute = 0, millisecond = 0;
long negativeResult = 1;
// First character
int c = charIterator.next();
if (c == Character.valueOf('-')) {
negativeResult = -1;
c = charIterator.next();
}
if (c != Character.valueOf('P')) {
// Invalid duration format.
throw new SystemException(ErrorCode.FORG0001);
}
while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR) {
if (Character.isDigit(c)) {
value = value * 10 + Character.getNumericValue(c);
if (pastDecimal) {
--decimalPlace;
}