接口 WritableJson
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
JSON content that can be written out.
- 从以下版本开始:
- 3.4.0
- 作者:
- Phillip Webb, Moritz Halbritter
- 另请参阅:
-
方法概要
修饰符和类型方法说明static WritableJsonof(WritableJson writableJson) Factory method used to create aWritableJsonwith a sensibleObject.toString()that delegate totoJsonString().voidto(Appendable out) Write the JSON to the providedAppendable.default byte[]Write the JSON to a UTF-8 encoded byte array.default byte[]toByteArray(Charset charset) Write the JSON to a byte array.default StringWrite the JSON to aString.default voidWrite the JSON to the providedOutputStreamusingUTF8encoding.default voidtoOutputStream(OutputStream out, Charset charset) Write the JSON to the providedOutputStreamusing the givenCharset.default voidWrite the JSON to the providedWritableResourceusingUTF8encoding.default voidtoResource(WritableResource out, Charset charset) Write the JSON to the providedWritableResourceusing the givenCharset.default voidWrite the JSON to the providedWriter.
-
方法详细资料
-
to
Write the JSON to the providedAppendable.- 参数:
out- theAppendableto receive the JSON- 抛出:
IOException- on IO error
-
toJsonString
Write the JSON to aString.- 返回:
- the JSON string
-
toByteArray
default byte[] toByteArray()Write the JSON to a UTF-8 encoded byte array.- 返回:
- the JSON bytes
-
toByteArray
Write the JSON to a byte array.- 参数:
charset- the charset- 返回:
- the JSON bytes
-
toResource
Write the JSON to the providedWritableResourceusingUTF8encoding.- 参数:
out- theOutputStreamto receive the JSON- 抛出:
IOException- on IO error
-
toResource
Write the JSON to the providedWritableResourceusing the givenCharset.- 参数:
out- theOutputStreamto receive the JSONcharset- the charset to use- 抛出:
IOException- on IO error
-
toOutputStream
Write the JSON to the providedOutputStreamusingUTF8encoding. The output stream will not be closed.- 参数:
out- theOutputStreamto receive the JSON- 抛出:
IOException- on IO error- 另请参阅:
-
toOutputStream
Write the JSON to the providedOutputStreamusing the givenCharset. The output stream will not be closed.- 参数:
out- theOutputStreamto receive the JSONcharset- the charset to use- 抛出:
IOException- on IO error
-
toWriter
Write the JSON to the providedWriter. The writer will be flushed but not closed.- 参数:
out- theWriterto receive the JSON- 抛出:
IOException- on IO error- 另请参阅:
-
of
Factory method used to create aWritableJsonwith a sensibleObject.toString()that delegate totoJsonString().- 参数:
writableJson- the sourceWritableJson- 返回:
- a new
WritableJsonwith a sensibleObject.toString().
-