Tabnine Logo
ByteSizeStrings.formatted
Code IndexAdd Tabnine to your IDE (free)

How to use
formatted
method
in
org.apache.brooklyn.util.text.ByteSizeStrings

Best Java code snippets using org.apache.brooklyn.util.text.ByteSizeStrings.formatted (Showing top 1 results out of 315)

origin: org.apache.brooklyn/brooklyn-utils-common

public void testFormatter() {
  ByteSizeStrings iso = ByteSizeStrings.iso();
  assertEquals(String.format("%s", iso.formatted(23456789L)), "22.4 MiB");
  assertEquals(String.format("%.6s", iso.formatted(23456789L)), "22.3701 MiB");
  assertEquals(String.format("%#s", iso.formatted(23456789L)), "23.5 MB");
}
org.apache.brooklyn.util.textByteSizeStringsformatted

Javadoc

Returns a Formattable object that can be used with String#format(String,Object...).

When used as the argument for a %s format string element, the bytes value will be formatted using the current ByteSizeStrings values, or if the alternative flag is set (using the %#s format string) it will use the ByteSizeStrings#metric()formatter. Finally, the precision of the formatted value can be adjusted using format string argumenbts like %.6s.

Popular methods of ByteSizeStrings

  • metric
    Default byte size formatter using metric multiples of 1000.
  • java
    Format byte sizes suitable for Java -Xms arguments.
  • makeSizeString
    Format the size bytes as a String with the given precision.
  • parse
    parses the given string as a byte size string, e.g. "4gb"
  • iso
    Formats byte sizes using ISO standard suffixes and binary multiples of 1024
  • <init>
  • apply
    A Function implementation that formats its input using the current ByteSizeStrings values.
  • builder
    Returns a builder for a ByteSizeStrings formatter.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setScale (BigDecimal)
  • setRequestProperty (URLConnection)
  • onCreateOptionsMenu (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • ImageIO (javax.imageio)
  • JFileChooser (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now