docs: private static String truncateWS(String pStr) {
          char[] chars = pStr.toCharArray();
  
          int count = 0;
          boolean lastWasWS = true; // Avoids leading WS
          for (int i = 0; i < chars.length; i++) {
              if (!Character.isWhitespace(chars[i])) {
                  // if char is not WS, just store
                  chars[count++] = chars[i];
                  lastWasWS = false;
              }
              else {
                  // else, if char is WS, store first, skip the rest
                  if (!lastWasWS) {
                      if (chars[i] == 0x0d) {
                          chars[count++] = 0x0a; //Always new line
                      }
                      else {
                          chars[count++] = chars[i];
                      }
                  }
                  lastWasWS = true;
              }
          }
  
          // Return the trucated string
          return new String(chars, 0, count);
      }