ResultDBUtil
public
final
class
ResultDBUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.result.resultdb.ResultDBUtil |
Utility class for ResultDB reporter.
Summary
Public constructors | |
|---|---|
ResultDBUtil()
|
|
Public methods | |
|---|---|
static
String
|
bytesToHex(byte[] bytes)
Converts a byte array to a hexadecimal string. |
static
String
|
makeValidKey(String key)
Ensure the key is valid for ResultDB. |
static
String
|
truncateString(String input, int maxBytes)
Truncates the string to the given max bytes, avoiding breaking up a multi-byte character. |
Public constructors
ResultDBUtil
public ResultDBUtil ()
Public methods
bytesToHex
public static String bytesToHex (byte[] bytes)
Converts a byte array to a hexadecimal string.
| Parameters | |
|---|---|
bytes |
byte |
| Returns | |
|---|---|
String |
|
makeValidKey
public static String makeValidKey (String key)
Ensure the key is valid for ResultDB.
The key must match the regex: ^[a-z][a-z0-9_]*(/[a-z][a-z0-9_]*)*$
| Parameters | |
|---|---|
key |
String |
| Returns | |
|---|---|
String |
|
truncateString
public static String truncateString (String input,
int maxBytes)Truncates the string to the given max bytes, avoiding breaking up a multi-byte character.
| Parameters | |
|---|---|
input |
String: the string to truncate |
maxBytes |
int: the maximum number of bytes (in utf-8 encoding) to truncate to |
| Returns | |
|---|---|
String |
the truncated string |