- java.lang.Object
-
- swim.codec.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 Stringdebug(Object object)static <T> Output<T>debug(Object object, Output<T> output)static Stringdebug(Object object, OutputSettings settings)Returns the developer-readableDisplaystring for the givemobject, output using the givensettings.static <T> Output<T>debugChar(int character, Output<T> output)Writes the code points of the Java character literal for the givencharactertooutput.static <T> Output<T>debugDouble(double value, Output<T> output)Writes the code points of the Java numeric literal for the givenvaluetooutput.static <T> Output<T>debugFloat(float value, Output<T> output)Writes the code points of the Java numeric literal for the givenvaluetooutput.static <T> Output<T>debugInt(int value, Output<T> output)Writes the code points of the Java numeric literal for the givenvaluetooutput.static <T> Output<T>debugLong(long value, Output<T> output)Writes the code points of the Java numeric literal for the givenvaluetooutput.static <T> Output<T>debugString(String string, Output<T> output)Writes the code points of the Java string literal for the givenstringtooutput.static Stringdisplay(Object object)static <T> Output<T>display(Object object, Output<T> output)static Stringdisplay(Object object, OutputSettings settings)static <T> Output<T>displayDouble(double value, Output<T> output)Writes the code points of the numeric string for the givenvaluetooutput.static <T> Output<T>displayFloat(float value, Output<T> output)Writes the code points of the numeric string for the givenvaluetooutput.static <T> Output<T>displayInt(int value, Output<T> output)Writes the code points of the numeric string for the givenvaluetooutput.static <T> Output<T>displayLong(long value, Output<T> output)Writes the code points of the numeric string for the givenvaluetooutput.static StringlineSeparator()Returns the operting system specific string used to separate lines of text.
-
-
-
Method Detail
-
display
public static <T> Output<T> display(Object object, Output<T> output)
Writes the code points of the human-readableDisplaystring for the givenobjecttooutput. Assumesoutputis a UnicodeOutputwriter with sufficient capacity. Delegates toDisplay.display(Output), ifobjectimplementsDisplay; otherwise writes the result ofObject.toString().- Returns:
- the continuation of the
output.
-
display
public static String display(Object object, OutputSettings settings)
Returns the human-readableDisplaystring for the givemobject, output using the givensettings. Delegates toDisplay.display(Output), ifobjectimplementsDisplay; otherwise returns the result ofObject.toString().- Throws:
OutputException- if theoutputexits the cont state before the full display string has been written.
-
display
public static String display(Object object)
- Throws:
OutputException- if theoutputexits the cont state before the full display string has been written.- See Also:
display(Object, OutputSettings)
-
debug
public static <T> Output<T> debug(Object object, Output<T> output)
Writes the code points of the developer-readableDebugstring for the givenobjecttooutput. Assumesoutputis a UnicodeOutputwriter with sufficient capacity. Delegates toDebug.debug(Output), ifobjectimplementsDebug; writes a Java string literal, ifobjectis aString, and writes a Java number literal, ifobjectis aNumber; otherwise writes the result ofObject.toString().- Returns:
- the continuation of the
output.
-
debug
public static String debug(Object object, OutputSettings settings)
Returns the developer-readableDisplaystring for the givemobject, output using the givensettings. Delegates toDebug.debug(Output), ifobjectimplementsDebug; returns a Java string literal, ifobjectis aString, and returns a Java number literal, ifobjectis aNumber; otherwise returns the result ofObject.toString().- Throws:
OutputException- if theoutputexits the cont state before the full display string has been written.
-
debug
public static String debug(Object object)
- Throws:
OutputException- if theoutputexits the cont state before the full display string has been written.- See Also:
debug(Object, OutputSettings)
-
displayInt
public static <T> Output<T> displayInt(int value, Output<T> output)
Writes the code points of the numeric string for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
displayLong
public static <T> Output<T> displayLong(long value, Output<T> output)
Writes the code points of the numeric string for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
displayFloat
public static <T> Output<T> displayFloat(float value, Output<T> output)
Writes the code points of the numeric string for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
displayDouble
public static <T> Output<T> displayDouble(double value, Output<T> output)
Writes the code points of the numeric string for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
debugInt
public static <T> Output<T> debugInt(int value, Output<T> output)
Writes the code points of the Java numeric literal for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
debugLong
public static <T> Output<T> debugLong(long value, Output<T> output)
Writes the code points of the Java numeric literal for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
debugFloat
public static <T> Output<T> debugFloat(float value, Output<T> output)
Writes the code points of the Java numeric literal for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
debugDouble
public static <T> Output<T> debugDouble(double value, Output<T> output)
Writes the code points of the Java numeric literal for the givenvaluetooutput.- Returns:
- the continuation of the
output.
-
debugChar
public static <T> Output<T> debugChar(int character, Output<T> output)
Writes the code points of the Java character literal for the givencharactertooutput.- Returns:
- the continuation of the
output.
-
debugString
public static <T> Output<T> debugString(String string, Output<T> output)
Writes the code points of the Java string literal for the givenstringtooutput.- Returns:
- the continuation of the
output.
-
lineSeparator
public static String lineSeparator()
Returns the operting system specific string used to separate lines of text.
-
-