code: private void dataBufferNormalize() {
          int i = 0;
          int j = 0;
          int end = dataBufferPos;
  
          // Skip spaces at the start.
          while ((j < end) && (dataBuffer[j] == ' ')) {
              j++;
          }
  
          // Skip whitespace at the end.
          while ((end > j) && (dataBuffer[end - 1] == ' ')) {
              end--;
          }
  
          // Start copying to the left.
          while (j < end) {
  
              char c = dataBuffer[j++];
  
              // Normalise all other spaces to
              // a single space.
              if (c == ' ') {
                  while ((j < end) && (dataBuffer[j++] == ' ')) {
                      continue;
                  }
                  dataBuffer[i++] = ' ';
                  dataBuffer[i++] = dataBuffer[j - 1];
              } else {
                  dataBuffer[i++] = c;
              }
          }
  
          // The new length is <= the old one.
          dataBufferPos = i;
      }
docs: Normalise space characters in the data buffer.