QuotedString.BourneStyle
, QuotedString.GitPathStyle
public abstract class QuotedString extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
QuotedString.BourneStyle |
Quoting style used by the Bourne shell.
|
static class |
QuotedString.BourneUserPathStyle |
Bourne style, but permits
~user at the start of the string. |
static class |
QuotedString.GitPathStyle |
Quoting style that obeys the rules Git applies to file names
|
Modifier and Type | Field | Description |
---|---|---|
static QuotedString.BourneStyle |
BOURNE |
Quoting style used by the Bourne shell.
|
static QuotedString.BourneUserPathStyle |
BOURNE_USER_PATH |
Bourne style, but permits
~user at the start of the string. |
static QuotedString.GitPathStyle |
GIT_PATH |
Quoting style that obeys the rules Git applies to file names
|
Constructor | Description |
---|---|
QuotedString() |
Modifier and Type | Method | Description |
---|---|---|
abstract String |
dequote(byte[] in,
int offset,
int end) |
Decode a previously quoted input, scanning a UTF-8 encoded buffer.
|
String |
dequote(String in) |
Clean a previously quoted input, decoding the result via UTF-8.
|
abstract String |
quote(String in) |
Quote an input string by the quoting rules.
|
public static final QuotedString.GitPathStyle GIT_PATH
public static final QuotedString.BourneStyle BOURNE
Quotes are unconditionally inserted during quote(String)
. This
protects shell meta-characters like $
or ~
from
being recognized as special.
public static final QuotedString.BourneUserPathStyle BOURNE_USER_PATH
~user
at the start of the string.public abstract String quote(String in)
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.
in
- any non-null Unicode string.public String dequote(String in)
This method must match quote such that:
a.equals(dequote(quote(a)));is true for any
a
.in
- a Unicode string to remove quoting from.dequote(byte[], int, int)
public abstract String dequote(byte[] in, int offset, int end)
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
quote(String)
.
in
- the input buffer to parse.offset
- first position within in
to scan.end
- one position past in in
to scan.Copyright © 2018. All rights reserved.