StringEscapeUtils

public class StringEscapeUtils
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.StringEscapeUtils


Utility class for escaping strings for specific formats. Include methods to escape strings that are being passed to the Android Shell.

Summary

Public constructors

StringEscapeUtils()

Public methods

static String escapeShell(String str)

Escapes a String for use in an Android shell command.

static paramsToArgs( params)

Converts the provided parameters via options to command line args to sub process

This method will do a simplistic generic unescape for each parameter in the list.

Public constructors

StringEscapeUtils

public StringEscapeUtils ()

Public methods

escapeShell

public static String escapeShell (String str)

Escapes a String for use in an Android shell command.

Parameters
str String: the String to escape

Returns
String the Android shell escaped String

paramsToArgs

public static  paramsToArgs ( params)

Converts the provided parameters via options to command line args to sub process

This method will do a simplistic generic unescape for each parameter in the list. It replaces \[char] with [char]. For example, \" is converted to ". This allows string with escaped double quotes to stay as a string after being parsed by QuotationAwareTokenizer. Without this QuotationAwareTokenizer will break the string into sections if it has space in it.

Parameters
params : parameters received via options

Returns
list of string representing command line args