- 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 String
debug(Object object)
static String
debug(Object object, OutputSettings settings)
Returns the developer-readableDisplay
string for the givemobject
, output using the givensettings
.static <T> Output<T>
debug(Output<T> output, Object object)
static <T> Output<T>
debugChar(Output<T> output, int value)
Writes the code points of the Java character literal for the givenvalue
tooutput
.static <T> Output<T>
debugDouble(Output<T> output, double value)
Writes the code points of the Java numeric literal for the givenvalue
tooutput
.static <T> Output<T>
debugFloat(Output<T> output, float value)
Writes the code points of the Java numeric literal for the givenvalue
tooutput
.static <T> Output<T>
debugInt(Output<T> output, int value)
Writes the code points of the Java numeric literal for the givenvalue
tooutput
.static <T> Output<T>
debugLong(Output<T> output, long value)
Writes the code points of the Java numeric literal for the givenvalue
tooutput
.static <T> Output<T>
debugString(Output<T> output, String value)
Writes the code points of the Java string literal for the givenvalue
tooutput
.static String
display(Object object)
static String
display(Object object, OutputSettings settings)
static <T> Output<T>
display(Output<T> output, Object object)
static <T> Output<T>
displayDouble(Output<T> output, double value)
Writes the code points of the numeric string for the givenvalue
tooutput
.static <T> Output<T>
displayFloat(Output<T> output, float value)
Writes the code points of the numeric string for the givenvalue
tooutput
.static <T> Output<T>
displayInt(Output<T> output, int value)
Writes the code points of the numeric string for the givenvalue
tooutput
.static <T> Output<T>
displayLong(Output<T> output, long value)
Writes the code points of the numeric string for the givenvalue
tooutput
.static String
lineSeparator()
Returns the operting system specific string used to separate lines of text.
-
-
-
Method Detail
-
display
public static <T> Output<T> display(Output<T> output, Object object)
Writes the code points of the human-readableDisplay
string for the givenobject
tooutput
. Assumesoutput
is a UnicodeOutput
writer with sufficient capacity. Delegates toDisplay.display(Output)
, ifobject
implementsDisplay
; otherwise writes the result ofObject.toString()
.- Returns:
- the continuation of the
output
.
-
display
public static String display(Object object, OutputSettings settings)
Returns the human-readableDisplay
string for the givemobject
, output using the givensettings
. Delegates toDisplay.display(Output)
, ifobject
implementsDisplay
; otherwise returns the result ofObject.toString()
.- Throws:
OutputException
- if theoutput
exits the cont state before the full display string has been written.
-
display
public static String display(Object object)
- Throws:
OutputException
- if theoutput
exits the cont state before the full display string has been written.- See Also:
display(Object, OutputSettings)
-
debug
public static <T> Output<T> debug(Output<T> output, Object object)
Writes the code points of the developer-readableDebug
string for the givenobject
tooutput
. Assumesoutput
is a UnicodeOutput
writer with sufficient capacity. Delegates toDebug.debug(Output)
, ifobject
implementsDebug
; writes a Java string literal, ifobject
is aString
, and writes a Java number literal, ifobject
is 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-readableDisplay
string for the givemobject
, output using the givensettings
. Delegates toDebug.debug(Output)
, ifobject
implementsDebug
; returns a Java string literal, ifobject
is aString
, and returns a Java number literal, ifobject
is aNumber
; otherwise returns the result ofObject.toString()
.- Throws:
OutputException
- if theoutput
exits the cont state before the full display string has been written.
-
debug
public static String debug(Object object)
- Throws:
OutputException
- if theoutput
exits the cont state before the full display string has been written.- See Also:
debug(Object, OutputSettings)
-
displayInt
public static <T> Output<T> displayInt(Output<T> output, int value)
Writes the code points of the numeric string for the givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- 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 givenvalue
tooutput
.- Returns:
- the continuation of the
output
.
-
lineSeparator
public static String lineSeparator()
Returns the operting system specific string used to separate lines of text.
-
-