Module swim.codec
Package swim.codec

Class Format


  • public final class Format
    extends Object
    Text format utility functions.
    • Method Detail

      • display

        public static <T> Output<T> display​(Output<T> output,
                                            Object object)
        Writes the code points of the human-readable Display string for the given object to output. Assumes output is a Unicode Output writer with sufficient capacity. Delegates to Display.display(Output), if object implements Display; otherwise writes the result of Object.toString().
        Returns:
        the continuation of the output.
      • debug

        public static <T> Output<T> debug​(Output<T> output,
                                          Object object)
        Writes the code points of the developer-readable Debug string for the given object to output. Assumes output is a Unicode Output writer with sufficient capacity. Delegates to Debug.debug(Output), if object implements Debug; writes a Java string literal, if object is a String, and writes a Java number literal, if object is a Number; otherwise writes the result of Object.toString().
        Returns:
        the continuation of the output.
      • debug

        public static String debug​(Object object,
                                   OutputSettings settings)
        Returns the developer-readable Display string for the givem object, output using the given settings. Delegates to Debug.debug(Output), if object implements Debug; returns a Java string literal, if object is a String, and returns a Java number literal, if object is a Number; otherwise returns the result of Object.toString().
        Throws:
        OutputException - if the output exits the cont state before the full display string has been written.
      • displayInt

        public static <T> Output<T> displayInt​(Output<T> output,
                                               int value)
        Writes the code points of the numeric string for the given value to output.
        Returns:
        the continuation of the output.
      • displayLong

        public static <T> Output<T> displayLong​(Output<T> output,
                                                long value)
        Writes the code points of the numeric string for the given value to output.
        Returns:
        the continuation of the output.
      • displayFloat

        public static <T> Output<T> displayFloat​(Output<T> output,
                                                 float value)
        Writes the code points of the numeric string for the given value to output.
        Returns:
        the continuation of the output.
      • displayDouble

        public static <T> Output<T> displayDouble​(Output<T> output,
                                                  double value)
        Writes the code points of the numeric string for the given value to output.
        Returns:
        the continuation of the output.
      • debugInt

        public static <T> Output<T> debugInt​(Output<T> output,
                                             int value)
        Writes the code points of the Java numeric literal for the given value to output.
        Returns:
        the continuation of the output.
      • debugLong

        public static <T> Output<T> debugLong​(Output<T> output,
                                              long value)
        Writes the code points of the Java numeric literal for the given value to output.
        Returns:
        the continuation of the output.
      • debugFloat

        public static <T> Output<T> debugFloat​(Output<T> output,
                                               float value)
        Writes the code points of the Java numeric literal for the given value to output.
        Returns:
        the continuation of the output.
      • debugDouble

        public static <T> Output<T> debugDouble​(Output<T> output,
                                                double value)
        Writes the code points of the Java numeric literal for the given value to output.
        Returns:
        the continuation of the output.
      • debugChar

        public static <T> Output<T> debugChar​(Output<T> output,
                                              int value)
        Writes the code points of the Java character literal for the given value to output.
        Returns:
        the continuation of the output.
      • debugString

        public static <T> Output<T> debugString​(Output<T> output,
                                                String value)
        Writes the code points of the Java string literal for the given value to output.
        Returns:
        the continuation of the output.
      • lineSeparator

        public static String lineSeparator()
        Returns the operting system specific string used to separate lines of text.