<p>Adapt char to Json and add into stringbuffer.</p>
@param pCh to be adapted
@param pSb StringBuffer
@param pIsStartSpaces if it is start/continue spaces
@return if it is start/continue spaces
168965
public final boolean addJsonChar(final char pCh,
    final StringBuffer pSb, final boolean pIsStartSpaces) {
    boolean isStartSpaces;
    if (pCh == ' ') {
      if (!pIsStartSpaces) {
        isStartSpaces = true;
      } else {
        return true; //it's continue spaces, so remove them
      }
    } else {
      isStartSpaces = false;
    }
    if (!isUseless(pCh)) { //JSP make a lot of useless new lines,
      //so they will be removed
      if (isJsonAdaptable(pCh)) {
        pSb.append('\\');
      }
      pSb.append(pCh);
    }
    return isStartSpaces;
  }
798180
private boolean compareChars(byte[] chars, int pos) {
        for (int i = 0; i < len; i++) {
            if (differentChars((char) this.chars[i + this.pos], (char) chars[i + pos])) return false;
        }
        return true;
    }
1280907
public static void mainUsage(PrintStream ps) {
    StringBuilder b = new StringBuilder("\nUsage: java -jar [opentsdb.jar] [command] [args]\nValid commands:")
      .append("\n\ttsd: Starts a new TSDB instance")
      .append("\n\tfsck: Searches for and optionally fixes corrupted data in a TSDB")
      .append("\n\timport: Imports data from a file into HBase through a TSDB")
      .append("\n\tmkmetric: Creates a new metric")
      .append("\n\tquery: Queries time series data from a TSDB ")
      .append("\n\tscan: Dumps data straight from HBase")
      .append("\n\tuid: Provides various functions to search or modify information in the tsdb-uid table. ")
      .append("\n\texportui: Exports the OpenTSDB UI static content")
      .append("\n\n\tUse help <command> for details on a command\n");
    ps.println(b);
  }
353413
public static int skipSpaces (final String sIn, final int nStart)
  {
    int pos = nStart;
    while (pos < sIn.length () && (sIn.charAt (pos) == ' ' || sIn.charAt (pos) == '\n'))
      pos++;
    return pos < sIn.length () ? pos : -1;
  }
1332623
public void doJson(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
        if (req.getParameter("jsonp") == null || permit(req)) {
            setHeaders(rsp);
            rsp.serveExposedBean(req,bean, req.getParameter("jsonp") == null ? Flavor.JSON : Flavor.JSONP);
        } else {
            rsp.sendError(HttpURLConnection.HTTP_FORBIDDEN, "jsonp forbidden; implement jenkins.security.SecureRequester");
        }
    }
263401
public boolean parseString(final String pStringToBeParsed) {

    if (mDebugging) {
      out.println();
    }
    if (mDebugging) {
      out.println(DebugUtil.getPrefixDebugMessage(this) + "parsing \"" + pStringToBeParsed + "\"...");
    }

    // Update statistics
    mTotalNumberOfStringsParsed++;

    // Check string to be parsed
    if (!checkStringToBeParsed(pStringToBeParsed)) {
      return false;
    }

    // Perform parsing and return accetance/rejection flag
    if (mInitialized) {
      return mRegexpParser.matcher(pStringToBeParsed).matches();
    } else {
      out.println(DebugUtil.getPrefixErrorMessage(this) + "trying to use non-initialized parser - string rejected!");
    }
    return false;
  }
297262
public boolean processCharWithTextParser(final char ch) {
        textParser = textParser.processChar(ch, textParserContext);
        if (textParser == TextParserState.DELIMITER_REACHED) {
            parsedText = textParserContext.getText();
            textParser = TextParserState.LEADING_WHITESPACE;
            textParserContext.reset();
            return true;
        }
        return false;
    }
850578
public static CharBuf sputl(CharBuf buf, Object... messages) {

        for (Object message : messages) {
            if (message == null) {
                buf.add("<NULL>");
            } else if (message.getClass().isArray()) {
                buf.add(toListOrSingletonList(message).toString());
            } else {
                buf.add(message.toString());
            }
            buf.add('\n');
        }
        buf.add('\n');

        return buf;


    }
468593
private final void consumeWhiteSpace(){
		char c=cbuf[n];
		while(c==CH_SPACE|| c==CH_LINEFEED || c==CH_TAB || c==CH_CARRIAGE_RETURN){
			n++;
			c=cbuf[n];
		}
	}
842537
private boolean isWhitespace(char ch)
    {
        if (linews) 
            return Character.isWhitespace(ch);
        else
            return ch != '\n' && ch != '\r' && Character.isWhitespace(ch);
    }
1225392
public static boolean isInAlphabet(final char pCharToCheck) {

    for (int i = 0; i < ALPHABET.length; i++) {
      if (pCharToCheck == ALPHABET[i]) {
        return true;
      }
    }
    return false;
  }
38098
public static HppResponse fromJsonHppResponse(String json) {
		try {
			return hppResponseReader.readValue(json);
		} catch (Exception ex) {
			LOGGER.error("Error creating HppResponse from JSON.", ex);
			throw new RealexException("Error creating HppResponse from JSON.", ex);
		}
	}
175021
public static boolean startWith(@Nullable CharSequence s, char c) {
		if (StringUtils.isEmpty(s)) {
			return false;
		}
		return s.charAt(0) == c;
	}
178974
private static int skipWhite(char[] part, int startPos) {
    for (int i = startPos; i < part.length; i++) {
      if (!Character.isWhitespace(part[i])) {
        return i;
      }
    }
    return part.length;
  }
923843
public static boolean isSpaceChar(char c) {
		if (c == 0x20) return true;
		if (c > 0xD) return false;
		if (c < 0x9) return false;
		return isSpace[c - 9];
	}
1000550
public static String ltrim(String pString) {
        if ((pString == null) || (pString.length() == 0)) {
            return pString;// Null or empty string
        }
        for (int i = 0; i < pString.length(); i++) {
            if (!Character.isWhitespace(pString.charAt(i))) {
                if (i == 0) {
                    return pString;// First char is not whitespace
                }
                else {
                    return pString.substring(i);// Return rest after whitespace
                }
            }
        }

        // If all whitespace, return empty string
        return "";
    }
1338644
public static void exec(ProcessBuilder pb) throws IOException
    {
        Process p = pb.start();
        try
        {
            int errCode = p.waitFor();
            if (errCode != 0)
            {
                BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
                BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream()));
                StringBuilder sb = new StringBuilder();
                String str;
                while ((str = in.readLine()) != null)
                    sb.append(str).append(System.getProperty("line.separator"));
                while ((str = err.readLine()) != null)
                    sb.append(str).append(System.getProperty("line.separator"));
                throw new IOException("Exception while executing the command: "+ StringUtils.join(pb.command(), " ") +
                                      ", command error Code: " + errCode +
                                      ", command output: "+ sb.toString());
            }
        }
        catch (InterruptedException e)
        {
            throw new AssertionError(e);
        }
    }