/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
private static StringBuilder toString(StringBuilder dest, Accountable a, int depth) { for (int i = 1; i < depth; i++) { dest.append(" "); } if (depth > 0) { dest.append("|-- "); } dest.append(a.toString()); dest.append(": "); dest.append(RamUsageEstimator.humanReadableUnits(a.ramBytesUsed())); dest.append(System.lineSeparator()); for (Accountable child : a.getChildResources()) { toString(dest, child, depth + 1); } return dest; }
builder.field("size_of_user", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject(user).length())); builder.field("size_of_custom_attributes", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject((Serializable) user.getCustomAttributesMap()).getBytes(StandardCharsets.UTF_8).length)); builder.field("size_of_backendroles", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject((Serializable)user.getRoles()).getBytes(StandardCharsets.UTF_8).length)); } catch (Throwable e) {
/** * Return a human-readable size of a given object. * @see #sizeOf(Object) * @see #humanReadableUnits(long) */ public static String humanSizeOf(Object object) { return humanReadableUnits(sizeOf(object)); }
/** * The most recently estimated size of the value, null unless * estimateSize has been called. */ public String getEstimatedSize() { long bytesUsed = value == null ? 0L : value.ramBytesUsed(); return RamUsageEstimator.humanReadableUnits(bytesUsed); }
/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
/** * Returns <code>size</code> in human-readable units (GB, MB, KB or bytes). */ public static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
/** * The most recently estimated size of the value, null unless * estimateSize has been called. */ public String getEstimatedSize() { long bytesUsed = value == null ? 0L : value.ramBytesUsed(); return RamUsageEstimator.humanReadableUnits(bytesUsed); }
private static StringBuilder toString(StringBuilder dest, Accountable a, int depth) { for (int i = 1; i < depth; i++) { dest.append(" "); } if (depth > 0) { dest.append("|-- "); } dest.append(a.toString()); dest.append(": "); dest.append(RamUsageEstimator.humanReadableUnits(a.ramBytesUsed())); dest.append(System.lineSeparator()); for (Accountable child : a.getChildResources()) { toString(dest, child, depth + 1); } return dest; }
private static StringBuilder toString(StringBuilder dest, Accountable a, int depth) { for (int i = 1; i < depth; i++) { dest.append(" "); } if (depth > 0) { dest.append("|-- "); } dest.append(a.toString()); dest.append(": "); dest.append(RamUsageEstimator.humanReadableUnits(a.ramBytesUsed())); dest.append(System.lineSeparator()); for (Accountable child : a.getChildResources()) { toString(dest, child, depth + 1); } return dest; }
private static StringBuilder toString(StringBuilder dest, Accountable a, int depth) { for (int i = 1; i < depth; i++) { dest.append(" "); } if (depth > 0) { dest.append("|-- "); } dest.append(a.toString()); dest.append(": "); dest.append(RamUsageEstimator.humanReadableUnits(a.ramBytesUsed())); dest.append(System.lineSeparator()); for (Accountable child : a.getChildResources()) { toString(dest, child, depth + 1); } return dest; }
builder.field("size_of_user", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject(user).length())); builder.field("size_of_custom_attributes", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject((Serializable) user.getCustomAttributesMap()).getBytes(StandardCharsets.UTF_8).length)); builder.field("size_of_backendroles", RamUsageEstimator.humanReadableUnits(Base64Helper.serializeObject((Serializable)user.getRoles()).getBytes(StandardCharsets.UTF_8).length)); } catch (Throwable e) {