public int getSerializedStringByteSize(String str) { return Integer.BYTES + StringUtils.toUtf8(str).length; } }
@JsonCreator public static CacheExecutorFactory from(String str) { return Enum.valueOf(CacheExecutorFactory.class, StringUtils.toUpperCase(str)); } }
/** * Convert an input to base 64 and return the utf8 string of that byte array * * @param input The string to convert to base64 * @return the base64 of the input in string form */ public static String utf8Base64(String input) { return fromUtf8(encodeBase64(toUtf8(input))); }
@Nullable public static String decodeUserSecret(String encodedUserSecret) { try { return StringUtils.fromUtf8(StringUtils.decodeBase64String(encodedUserSecret)); } catch (IllegalArgumentException iae) { return null; } }
GcGenerationSpace(Map<String, JStatData.Counter<?>> jStatCounters, long genIndex, long spaceIndex) { String spaceKeyPrefix = StringUtils.format("sun.gc.generation.%d.space.%d", genIndex, spaceIndex); String nameKey = StringUtils.format("%s.name", spaceKeyPrefix); StringCounter nameCounter = (StringCounter) jStatCounters.get(nameKey); name = StringUtils.toLowerCase(nameCounter.toString()); maxCounter = (LongCounter) jStatCounters.get(StringUtils.format("%s.maxCapacity", spaceKeyPrefix)); capacityCounter = (LongCounter) jStatCounters.get(StringUtils.format("%s.capacity", spaceKeyPrefix)); usedCounter = (LongCounter) jStatCounters.get(StringUtils.format("%s.used", spaceKeyPrefix)); initCounter = (LongCounter) jStatCounters.get(StringUtils.format("%s.initCapacity", spaceKeyPrefix)); }
@Nullable private String charsetFix(String s) { if (s != null && !enc.canEncode(s)) { // Some whacky characters are in this string (e.g. \uD900). These are problematic because they are decodeable // by new String(...) but will not encode into the same character. This dance here will replace these // characters with something more sane. return StringUtils.fromUtf8(StringUtils.toUtf8(s)); } else { return s; } }
@Override public String fromByteBuffer(final ByteBuffer buffer, final int numBytes) { return StringUtils.fromUtf8(buffer, numBytes); }
@Override public Object put(String key, Object value) { return super.put(StringUtils.toLowerCase(key), value); }
public CannotBuildQueryException(RelNode relNode, AggregateCall aggregateCall) { super(StringUtils.nonStrictFormat("Cannot translate aggregator[%s] from rel[%s]", aggregateCall, relNode)); } }
/** * Encode the serialized form generated by toBytes() in Base64, used as the JSON serialization format. * * @return Base64 serialization */ @JsonValue public String toBase64() { byte[] asBytes = toBytes(); return StringUtils.fromUtf8(StringUtils.encodeBase64(asBytes)); }
@Override public boolean containsKey(Object obj) { return super.containsKey(StringUtils.toLowerCase((String) obj)); } }
public RE(Throwable cause, String formatText, Object... arguments) { super(StringUtils.nonStrictFormat(formatText, arguments), cause); } }
private String getBrokerURL() { return StringUtils.format( "%s/druid/v2/datasources", brokerUrl ); }
@JsonCreator public static AnalysisType fromString(String name) { return valueOf(StringUtils.toUpperCase(name)); }
public static String fromUtf8(final ByteBuffer buffer, final int numBytes) { final byte[] bytes = new byte[numBytes]; buffer.get(bytes); return fromUtf8(bytes); }
@Override public Object get(Object obj) { return super.get(StringUtils.toLowerCase((String) obj)); }
public SegmentNotWritableException(String message, Object... messageArgs) { super(StringUtils.nonStrictFormat(message, messageArgs)); } }