Module swim.codec
Package swim.codec

Class Format


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static String debug​(Object object)
      Returns the human-readable Debug string for the givem object, output using standard settings.
      static void debug​(Object object, Output<?> output)
      Writes the code points of the developer-readable Debug string for the given object to output.
      static String debug​(Object object, OutputSettings settings)
      Returns the developer-readable Display string for the givem object, output using the given settings.
      static void debugChar​(int character, Output<?> output)
      Writes the code points of the Java character literal for the given character to output.
      static void debugDouble​(double value, Output<?> output)
      Writes the code points of the Java numeric literal for the given value to output.
      static void debugFloat​(float value, Output<?> output)
      Writes the code points of the Java numeric literal for the given value to output.
      static void debugInt​(int value, Output<?> output)
      Writes the code points of the Java numeric literal for the given value to output.
      static void debugLong​(long value, Output<?> output)
      Writes the code points of the Java numeric literal for the given value to output.
      static void debugString​(String string, Output<?> output)
      Writes the code points of the Java string literal for the given string to output.
      static String display​(Object object)
      Returns the human-readable Display string for the givem object, output using standard settings.
      static void display​(Object object, Output<?> output)
      Writes the code points of the human-readable Display string for the given object to output.
      static String display​(Object object, OutputSettings settings)
      Returns the human-readable Display string for the givem object, output using the given settings.
      static void displayDouble​(double value, Output<?> output)
      Writes the code points of the numeric string for the given value to output.
      static void displayFloat​(float value, Output<?> output)
      Writes the code points of the numeric string for the given value to output.
      static void displayInt​(int value, Output<?> output)
      Writes the code points of the numeric string for the given value to output.
      static void displayLong​(long value, Output<?> output)
      Writes the code points of the numeric string for the given value to output.
      static String lineSeparator()
      Returns the operting system specific string used to separate lines of text.
    • Method Detail

      • display

        public static void display​(Object object,
                                   Output<?> output)
        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().
        Throws:
        OutputException - if the output exits the cont state before the full display string has been written.
      • debug

        public static void debug​(Object object,
                                 Output<?> output)
        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().
        Throws:
        OutputException - if the output exits the cont state before the full debug string has been written.
      • 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().
      • displayInt

        public static void displayInt​(int value,
                                      Output<?> output)
        Writes the code points of the numeric string for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric string has been written.
      • displayLong

        public static void displayLong​(long value,
                                       Output<?> output)
        Writes the code points of the numeric string for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric string has been written.
      • displayFloat

        public static void displayFloat​(float value,
                                        Output<?> output)
        Writes the code points of the numeric string for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric string has been written.
      • displayDouble

        public static void displayDouble​(double value,
                                         Output<?> output)
        Writes the code points of the numeric string for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric string has been written.
      • debugInt

        public static void debugInt​(int value,
                                    Output<?> output)
        Writes the code points of the Java numeric literal for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric literal has been written.
      • debugLong

        public static void debugLong​(long value,
                                     Output<?> output)
        Writes the code points of the Java numeric literal for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric literal has been written.
      • debugFloat

        public static void debugFloat​(float value,
                                      Output<?> output)
        Writes the code points of the Java numeric literal for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric literal has been written.
      • debugDouble

        public static void debugDouble​(double value,
                                       Output<?> output)
        Writes the code points of the Java numeric literal for the given value to output.
        Throws:
        OutputException - if the output exits the cont state before the full numeric literal has been written.
      • debugChar

        public static void debugChar​(int character,
                                     Output<?> output)
        Writes the code points of the Java character literal for the given character to output.
        Throws:
        OutputException - if the output exits the cont state before the full character literal has been written.
      • debugString

        public static void debugString​(String string,
                                       Output<?> output)
        Writes the code points of the Java string literal for the given string to output.
        Throws:
        OutputException - if the output exits the cont state before the full string literal has been written.
      • lineSeparator

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