Brooklyn

brooklyn.util.text
[Java] Class StringEscapes.BashStringEscapes

java.lang.Object
  brooklyn.util.text.StringEscapes.BashStringEscapes

public static class StringEscapes.BashStringEscapes

Method Summary
static void assertValidForDoubleQuotingInBash(java.lang.String x)

static java.lang.String doubleQuoteLiteralsForBash(java.lang.String... args)

transforms e.g. [ "-Dname=Bob Johnson", "-Dnet.worth=$100" ] to a java string "\"-Dname=Bob Johnson\" \"-Dnet.worth=\$100\"" -- which can be inserted into a bash command where it will be picked up as 2 params

static java.lang.String escapeLiteralForDoubleQuotedBash(java.lang.String unquotedInputToBeEscaped)

performs replacements on a string so that it can be legally inserted into a double-quoted bash context (without the surrounding double quotes; see also wrapBash(String))

static boolean isValidForDoubleQuotingInBash(java.lang.String x)

static java.lang.String unwrapBashQuotesAndEscapes(java.lang.String s)

given a string in bash notation, e.g. with quoted portions needing unescaped, returns the unescaped and unquoted version

static java.lang.String wrapBash(java.lang.String value)

wraps plain text in double quotes escaped for use in bash double-quoting

static void wrapBash(java.lang.String value, java.lang.Appendable out)

@see #wrapBash(String)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Method Detail

assertValidForDoubleQuotingInBash

public static void assertValidForDoubleQuotingInBash(java.lang.String x)


doubleQuoteLiteralsForBash

public static java.lang.String doubleQuoteLiteralsForBash(java.lang.String... args)
transforms e.g. [ "-Dname=Bob Johnson", "-Dnet.worth=$100" ] to a java string "\"-Dname=Bob Johnson\" \"-Dnet.worth=\$100\"" -- which can be inserted into a bash command where it will be picked up as 2 params


escapeLiteralForDoubleQuotedBash

public static java.lang.String escapeLiteralForDoubleQuotedBash(java.lang.String unquotedInputToBeEscaped)
performs replacements on a string so that it can be legally inserted into a double-quoted bash context (without the surrounding double quotes; see also wrapBash(String))


isValidForDoubleQuotingInBash

public static boolean isValidForDoubleQuotingInBash(java.lang.String x)


unwrapBashQuotesAndEscapes

public static java.lang.String unwrapBashQuotesAndEscapes(java.lang.String s)
given a string in bash notation, e.g. with quoted portions needing unescaped, returns the unescaped and unquoted version


wrapBash

public static java.lang.String wrapBash(java.lang.String value)
wraps plain text in double quotes escaped for use in bash double-quoting


wrapBash

public static void wrapBash(java.lang.String value, java.lang.Appendable out)
See Also:
wrapBash(String)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.