this.consumerProperties = Preconditions.checkNotNull(consumerProperties, "consumerProperties"); Preconditions.checkNotNull(consumerProperties.get(BOOTSTRAP_SERVERS_KEY), StringUtils.format("consumerProperties must contain entry for [%s]", BOOTSTRAP_SERVERS_KEY));
@Override public String fromByteBuffer(final ByteBuffer buffer, final int numBytes) { return StringUtils.fromUtf8(buffer, numBytes); }
public SegmentValidationException(Throwable cause, String formatText, Object... arguments) { super(StringUtils.nonStrictFormat(formatText, arguments), cause); } }
@Override public String getUserDataBase64() { final String finalData; if (versionReplacementString != null && version != null) { finalData = data.replace(versionReplacementString, version); } else { finalData = data; } return Base64.encodeBase64String(StringUtils.toUtf8(finalData)); }
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; } }
@JsonCreator public static CacheExecutorFactory from(String str) { return Enum.valueOf(CacheExecutorFactory.class, StringUtils.toUpperCase(str)); } }
static boolean storeDoubleAsFloat() { String value = System.getProperty(DOUBLE_STORAGE_TYPE_PROPERTY, "float"); return !StringUtils.toLowerCase(value).equals("double"); }
@Override public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(1 + fieldNameBytes.length) .put(AggregatorUtil.LONG_LAST_CACHE_TYPE_ID) .put(fieldNameBytes) .array(); }
GcGeneration(Map<String, JStatData.Counter<?>> jStatCounters, long genIndex, String name) { this.name = StringUtils.toLowerCase(name); long spacesCount = ((JStatData.LongCounter) jStatCounters.get( StringUtils.format("sun.gc.generation.%d.spaces", genIndex) )).getLong(); for (long spaceIndex = 0; spaceIndex < spacesCount; spaceIndex++) { spaces.add(new GcGenerationSpace(jStatCounters, genIndex, spaceIndex)); } if (jStatCounters.containsKey(StringUtils.format("sun.gc.collector.%d.name", genIndex))) { collector = new GcGenerationCollector(jStatCounters, genIndex); } else { collector = null; } }
@JsonCreator public static ValueType fromString(String name) { if (name == null) { return null; } return valueOf(StringUtils.toUpperCase(name)); }
private static String checkAndGetScheme(String scheme) { String schemeLowerCase = StringUtils.toLowerCase(scheme); Preconditions.checkState(schemeLowerCase.equals("http") || schemeLowerCase.equals("https")); return schemeLowerCase; }
@Override public String toString() { return StringUtils.format("serverTime-%s", windowPeriod); } };
@Override public byte[] getCacheKey() { byte[] exprBytes = StringUtils.toUtf8(expr); return ByteBuffer.allocate(1 + exprBytes.length) .put(ExtractionCacheHelper.CACHE_TYPE_ID_MATCHING_DIM) .put(exprBytes) .array(); }
public IOE(Throwable cause, String formatText, Object... arguments) { super(StringUtils.nonStrictFormat(formatText, arguments), cause); } }
@JsonCreator public static LongEncodingStrategy fromString(String name) { return valueOf(StringUtils.toUpperCase(name)); } }
public static Set<String> findDuplicates(Iterable<String> fieldNames) { Set<String> duplicates = Sets.newHashSet(); Set<String> uniqueNames = Sets.newHashSet(); for (String fieldName : fieldNames) { String next = StringUtils.toLowerCase(fieldName); if (uniqueNames.contains(next)) { duplicates.add(next); } uniqueNames.add(next); } return duplicates; }
@Override public byte[] getCacheKey() { byte[] fieldNameBytes = StringUtils.toUtf8(fieldName); return ByteBuffer.allocate(1 + fieldNameBytes.length) .put(AggregatorUtil.FLOAT_FIRST_CACHE_TYPE_ID) .put(fieldNameBytes) .array(); }