本文整理了Java中org.apache.kafka.common.utils.Utils.formatBytes()
方法的一些代码示例,展示了Utils.formatBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.formatBytes()
方法的具体详情如下:
包路径:org.apache.kafka.common.utils.Utils
类名称:Utils
方法名:formatBytes
[英]Formats a byte number as a human readable String ("3.2 MB")
[中]将字节数格式化为人类可读的字符串(“3.2MB”)
代码示例来源:origin: apache/kafka
@Override
public String toString() {
long allocated = sizeBytes - availableMemory.get();
return "SimpleMemoryPool{" + Utils.formatBytes(allocated) + "/" + Utils.formatBytes(sizeBytes) + " used}";
}
代码示例来源:origin: apache/kafka
@Override
public String toString() {
long allocated = sizeBytes - availableMemory.get();
return "GarbageCollectedMemoryPool{" + Utils.formatBytes(allocated) + "/" + Utils.formatBytes(sizeBytes) + " used in " + buffersInFlight.size() + " buffers}";
}
}
代码示例来源:origin: apache/kafka
@Test
public void testFormatBytes() {
assertEquals("-1", formatBytes(-1));
assertEquals("1023 B", formatBytes(1023));
assertEquals("1 KB", formatBytes(1024));
assertEquals("1024 KB", formatBytes((1024 * 1024) - 1));
assertEquals("1 MB", formatBytes(1024 * 1024));
assertEquals("1.1 MB", formatBytes((long) (1.1 * 1024 * 1024)));
assertEquals("10 MB", formatBytes(10 * 1024 * 1024));
}
代码示例来源:origin: apache/kafka
+ " buffers allocated: " + buffersAllocated + " heap " + Utils.formatBytes(maxHeap)
+ " pool " + Utils.formatBytes(maxPool) + " single allocation "
+ Utils.formatBytes(maxSingleAllocation), success);
内容来源于网络,如有侵权,请联系作者删除!