Class QuotedString.GitPathStyle

java.lang.Object
org.eclipse.jgit.util.QuotedString
org.eclipse.jgit.util.QuotedString.GitPathStyle
Enclosing class:
QuotedString

public static final class QuotedString.GitPathStyle extends QuotedString
Quoting style that obeys the rules Git applies to file names
  • Field Details

    • quote

      private static final byte[] quote
    • quoteHigh

      private final boolean quoteHigh
  • Constructor Details

    • GitPathStyle

      private GitPathStyle(boolean doQuote)
  • Method Details

    • quote

      public String quote(String instr)
      Description copied from class: QuotedString
      Quote an input string by the quoting rules.

      If the input string does not require any quoting, the same String reference is returned to the caller.

      Otherwise a quoted string is returned, including the opening and closing quotation marks at the start and end of the string. If the style does not permit raw Unicode characters then the string will first be encoded in UTF-8, with unprintable sequences possibly escaped by the rules.

      Specified by:
      quote in class QuotedString
      Parameters:
      instr - any non-null Unicode string.
      Returns:
      a quoted string. See above for details.
    • dequote

      public String dequote(byte[] in, int inPtr, int inEnd)
      Description copied from class: QuotedString
      Decode a previously quoted input, scanning a UTF-8 encoded buffer.

      This method must match quote such that:

       a.equals(dequote(Constants.encode(quote(a))));
       
      is true for any a.

      This method removes any opening/closing quotation marks added by QuotedString.quote(String).

      Specified by:
      dequote in class QuotedString
      Parameters:
      in - the input buffer to parse.
      inPtr - first position within in to scan.
      inEnd - one position past in in to scan.
      Returns:
      the cleaned string.
    • dq

      private static String dq(byte[] in, int inPtr, int inEnd)