code: public static boolean isWhiteSpace(StringBuffer buf)
    {
  
      int n = buf.length();
  
      for (int i = 0; i < n; i++)
      {
        if (!isWhiteSpace(buf.charAt(i)))
          return false;
      }
  
      return true;
    }
docs: Tell if the string is whitespace.
  
  @param buf StringBuffer to check as XML whitespace.
  @return True if characters in buffer are XML whitespace, false otherwise