if (quoteStart < 0 && isQuoteChar(buffer, i)) { if (buffer.charAt(quoteStart) == buffer.charAt(i) && !isEscaped(buffer, i)) { } else if (!isEscapeChar(buffer, i)) { if (isDelimiter(buffer, i)) { if (arg.length() > 0) { args.add(arg.toString()); arg.setLength(0); // reset the arg } else if (!isEscapeChar(buffer, i)) { arg.append(buffer.charAt(i));
if (quoteStart < 0 && isQuoteChar(buffer, i)) { if (buffer.charAt(quoteStart) == buffer.charAt(i) && !isEscaped(buffer, i)) { } else if (!isEscapeChar(buffer, i)) { if (isDelimiter(buffer, i)) { if (arg.length() > 0) { args.add(arg.toString()); arg.setLength(0); // reset the arg } else if (!isEscapeChar(buffer, i)) { arg.append(buffer.charAt(i));
/** * Check if a character is escaped (i.e. if the previous character is an escape) * * @param buffer * the buffer to check in * @param pos * the position of the character to check * @return true if the character at the specified position in the given buffer is an escape character and the character immediately preceding it is not an * escape character. */ public boolean isEscaped(final CharSequence buffer, final int pos) { if (pos <= 0) { return false; } return isEscapeChar(buffer, pos - 1); }
/** * Check if this character is a valid escape char (i.e. one that has not been escaped) */ public boolean isEscapeChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) { if (buffer.charAt(pos) == escapeChars[i]) { return !isEscaped(buffer, pos); // escape escape } } return false; }
public boolean isQuoteChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (quoteChars != null) && (i < quoteChars.length); i++) { if (buffer.charAt(pos) == quoteChars[i]) { return !isEscaped(buffer, pos); } } return false; }
/** * Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not * escaped by any of {@link #getQuoteChars}, and is not escaped by ant of the {@link #getEscapeChars}, and * returns true from {@link #isDelimiterChar}. * * @param buffer The complete command buffer * @param pos The index of the character in the buffer * @return True if the character should be a delimiter */ public boolean isDelimiter(final CharSequence buffer, final int pos) { return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }
/** * Check if a character is escaped (i.e. if the previous character is an escape) * * @param buffer * the buffer to check in * @param pos * the position of the character to check * @return true if the character at the specified position in the given buffer is an escape character and the character immediately preceding it is not an * escape character. */ public boolean isEscaped(final CharSequence buffer, final int pos) { if (pos <= 0) { return false; } return isEscapeChar(buffer, pos - 1); }
/** * Check if this character is a valid escape char (i.e. one that has not been escaped) */ public boolean isEscapeChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (escapeChars != null) && (i < escapeChars.length); i++) { if (buffer.charAt(pos) == escapeChars[i]) { return !isEscaped(buffer, pos); // escape escape } } return false; }
public boolean isQuoteChar(final CharSequence buffer, final int pos) { if (pos < 0) { return false; } for (int i = 0; (quoteChars != null) && (i < quoteChars.length); i++) { if (buffer.charAt(pos) == quoteChars[i]) { return !isEscaped(buffer, pos); } } return false; }
/** * Returns true if the specified character is a whitespace parameter. Check to ensure that the character is not * escaped by any of {@link #getQuoteChars}, and is not escaped by ant of the {@link #getEscapeChars}, and * returns true from {@link #isDelimiterChar}. * * @param buffer The complete command buffer * @param pos The index of the character in the buffer * @return True if the character should be a delimiter */ public boolean isDelimiter(final CharSequence buffer, final int pos) { return !isQuoted(buffer, pos) && !isEscaped(buffer, pos) && isDelimiterChar(buffer, pos); }