接口 WritableJson
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
JSON content that can be written out.
- 从以下版本开始:
- 3.4.0
- 作者:
- Phillip Webb, Moritz Halbritter
- 另请参阅:
-
方法概要
修饰符和类型方法说明static WritableJson
of
(WritableJson writableJson) Factory method used to create aWritableJson
with a sensibleObject.toString()
that delegate totoJsonString()
.void
to
(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 String
Write the JSON to aString
.default void
Write the JSON to the providedOutputStream
usingUTF8
encoding.default void
toOutputStream
(OutputStream out, Charset charset) Write the JSON to the providedOutputStream
using the givenCharset
.default void
Write the JSON to the providedWritableResource
usingUTF8
encoding.default void
toResource
(WritableResource out, Charset charset) Write the JSON to the providedWritableResource
using the givenCharset
.default void
Write the JSON to the providedWriter
.
-
方法详细资料
-
to
Write the JSON to the providedAppendable
.- 参数:
out
- theAppendable
to 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 providedWritableResource
usingUTF8
encoding.- 参数:
out
- theOutputStream
to receive the JSON- 抛出:
IOException
- on IO error
-
toResource
Write the JSON to the providedWritableResource
using the givenCharset
.- 参数:
out
- theOutputStream
to receive the JSONcharset
- the charset to use- 抛出:
IOException
- on IO error
-
toOutputStream
Write the JSON to the providedOutputStream
usingUTF8
encoding. The output stream will not be closed.- 参数:
out
- theOutputStream
to receive the JSON- 抛出:
IOException
- on IO error- 另请参阅:
-
toOutputStream
Write the JSON to the providedOutputStream
using the givenCharset
. The output stream will not be closed.- 参数:
out
- theOutputStream
to 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
- theWriter
to receive the JSON- 抛出:
IOException
- on IO error- 另请参阅:
-
of
Factory method used to create aWritableJson
with a sensibleObject.toString()
that delegate totoJsonString()
.- 参数:
writableJson
- the sourceWritableJson
- 返回:
- a new
WritableJson
with a sensibleObject.toString()
.
-