Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 1.61 KB

README.md

File metadata and controls

38 lines (30 loc) · 1.61 KB

quantify

quantify is a poor attempt to deal with the surprisingly difficult issue of representing the size of digital quantities.

Overview

It is notoriously hard to deal with the digital units of bytes and bits when representing and converting sizes of the file system and memory. Do you use SI Units? Do you use the JEDEC Standard? How do you print a human readable string to System.out? It is so hard that The most copied StackOverflow snippet of all time is flawed.

With quantify do yourself a favor and write code like this:

final Path file = Paths.get(...);
final long size = Files.size(file);
...
System.out.println(DataSizeFormatter.usingDefaultLocale().format(size, DecimalByteUnit.BYTES));
...
final long megabytes = DecimalByteUnit.BYTES.toMegabytes(bytes);

Goals

  • Easy to use for common cases
  • A simple, concise, and user-friendly API which caters to 90 percent of application needs
  • Java 8 or higher
  • No dependencies (other than the JDK)
  • And more...

What's next?

  • Publish the project on Maven Central
  • Should this project implement the JSR 385 specification (Units of Measurement API)?

Can I help?

Yes! Send me your patches and contributions. I will come up with a Contributor License Agreement.