decodeAllCodes method

String decodeAllCodes(
  1. StringBuffer buff,
  2. int initialPosition
)

Implementation

String decodeAllCodes(StringBuffer buff, int initialPosition) {
  int currentPosition = initialPosition;
  String? remaining;
  do {
    final info = decodeGeneralPurposeField(currentPosition, remaining);
    final parsedFields =
        FieldParser.parseFieldsInGeneralPurpose(info.newString);
    if (parsedFields != null) {
      buff.write(parsedFields);
    }
    if (info.isRemaining) {
      remaining = info.remainingValue.toString();
    } else {
      remaining = null;
    }

    if (currentPosition == info.newPosition) {
      // No step forward!
      break;
    }
    currentPosition = info.newPosition;
  } while (true);

  return buff.toString();
}