Skip to content

Java utilities to represent and convert digital quantities of bits and bytes.

License

Notifications You must be signed in to change notification settings

zleonov/quantify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Java utilities to represent and convert digital quantities of bits and bytes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages