QuotationAwareTokenizer
public
class
QuotationAwareTokenizer
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.QuotationAwareTokenizer |
Summary
Public constructors | |
---|---|
QuotationAwareTokenizer()
|
Public methods | |
---|---|
static
String
|
combineTokens(String... tokens)
Perform the reverse of |
static
String[]
|
tokenizeLine(String line, String delim)
Tokenizes the string, splitting on specified delimiter. |
static
String[]
|
tokenizeLine(String line)
Tokenizes the string, splitting on spaces. |
Public constructors
QuotationAwareTokenizer
public QuotationAwareTokenizer ()
Public methods
combineTokens
public static String combineTokens (String... tokens)
Perform the reverse of tokenizeLine(String)
.
Given array of tokens, combine them into a single line.
Returns | |
---|---|
String |
A String created from all the tokens.
|
tokenizeLine
public static String[] tokenizeLine (String line, String delim)
Tokenizes the string, splitting on specified delimiter. Does not split between consecutive, unquoted double-quote marks.
How the tokenizer works:- Split the string into "characters" where each "character" is either an escaped character like \" (that is, "\\\"") or a single real character like f (just "f").
- For each "character"
- If it's a space, finish a token unless we're being quoted
- If it's a quotation mark, flip the "we're being quoted" bit
- Otherwise, add it to the token being built
- At EOL, we typically haven't added the final token to the (tokens)
ArrayList
- If the last "character" is an escape character, throw an exception; that's not valid
- If we're in the middle of a quotation, throw an exception; that's not valid
- Otherwise, add the final token to (tokens)
- Return a String[] version of (tokens)
Parameters | |
---|---|
line |
String : A String to be tokenized |
delim |
String |
Returns | |
---|---|
String[] |
A tokenized version of the string |
Throws | |
---|---|
IllegalArgumentException |
if the line cannot be parsed |
tokenizeLine
public static String[] tokenizeLine (String line)
Tokenizes the string, splitting on spaces. Does not split between consecutive, unquoted double-quote marks.
See also tokenizeLine(String, String)
Parameters | |
---|---|
line |
String |
Returns | |
---|---|
String[] |
Throws | |
---|---|
IllegalArgumentException |
Interfaces
Classes
- AaptParser
- AbiFormatter
- AbiUtils
- Alarm
- AppVersionFetcher
- ArrayUtil
- BluetoothUtils
- Bugreport
- BuildTestsZipUtils
- BulkEmailer
- ByteArrayList
- CircularAtraceUtil
- CircularByteArray
- ClassPathScanner
- ClassPathScanner.ClassNameFilter
- ClassPathScanner.ExternalClassNameFilter
- CommandResult
- ConditionPriorityBlockingQueue
- ConditionPriorityBlockingQueue.AlwaysMatch
- ConfigCompletor
- DeviceConcurrentUtil
- DeviceConcurrentUtil.ShellCommandCallable
- DeviceRecoveryModeUtil
- DirectedGraph
- EmmaXmlConstants
- EmmaXmlReportParser
- FakeTestsZipFolder
- FileUtil
- FixedByteArrayOutputStream
- GCSBucketUtil
- GCSFileDownloader
- HprofAllocSiteParser
- IEmail.Message
- JUnit4TestFilter
- JUnitXmlParser
- KeyguardControllerState
- ListInstrumentationParser
- ListInstrumentationParser.InstrumentationTarget
- LogcatUpdaterEventParser
- LogcatUpdaterEventParser.AsyncUpdaterEvent
- MetricsXmlParser
- MultiMap
- NullUtil
- Pair
- ProcessInfo
- PropertyChanger
- PsParser
- QuotationAwareTokenizer
- RegexTrie
- RegexTrie.CompPattern
- RunUtil
- RunUtil.RunnableResult
- SerializationUtil
- SimplePerfResult
- SimplePerfStatResultParser
- SimplePerfUtil
- SimpleStats
- SizeLimitedOutputStream
- StreamUtil
- StringEscapeUtils
- SubprocessEventHelper
- SubprocessEventHelper.BaseTestEventInfo
- SubprocessEventHelper.FailedTestEventInfo
- SubprocessEventHelper.InvocationFailedEventInfo
- SubprocessEventHelper.InvocationStartedEventInfo
- SubprocessEventHelper.LogAssociationEventInfo
- SubprocessEventHelper.TestEndedEventInfo
- SubprocessEventHelper.TestLogEventInfo
- SubprocessEventHelper.TestModuleStartedEventInfo
- SubprocessEventHelper.TestRunEndedEventInfo
- SubprocessEventHelper.TestRunFailedEventInfo
- SubprocessEventHelper.TestRunStartedEventInfo
- SubprocessEventHelper.TestStartedEventInfo
- SubprocessTestResultsParser
- SubprocessTestResultsParser.StatusKeys
- SystemUtil
- TableBuilder
- TableFormatter
- TarUtil
- TestFilterHelper
- TestLoader
- TestMapping
- TestMapping.TestInfo
- TestMapping.TestOption
- TimeUtil
- TimeVal
- UniqueMultiMap
- VersionParser
- ZipCompressionStrategy
- ZipUtil
- ZipUtil2
Enums
Exceptions