接口 Content
- 所有已知实现类:
InspectedContent
,Layer
public interface Content
Content with a known size that can be written to an
OutputStream
.- 从以下版本开始:
- 2.3.0
- 作者:
- Phillip Webb
-
方法概要
修饰符和类型方法说明static Content
of
(byte[] bytes) Create a newContent
from the given input stream.static Content
of
(int size, IOSupplier<InputStream> supplier) Create a newContent
from the given input stream.static Content
Create a newContent
from the given file.static Content
Create a newContent
from the given UTF-8 string.int
size()
The size of the content in bytes.void
writeTo
(OutputStream outputStream) Write the content to the given output stream.
-
方法详细资料
-
size
int size()The size of the content in bytes.- 返回:
- the content size
-
writeTo
Write the content to the given output stream.- 参数:
outputStream
- the output stream to write to- 抛出:
IOException
- on IO error
-
of
Create a newContent
from the given UTF-8 string.- 参数:
string
- the string to write- 返回:
- a new
Content
instance
-
of
Create a newContent
from the given input stream.- 参数:
bytes
- the bytes to write- 返回:
- a new
Content
instance
-
of
Create a newContent
from the given file.- 参数:
file
- the file to write- 返回:
- a new
Content
instance
-
of
Create a newContent
from the given input stream. The stream will be closed after it has been written.- 参数:
size
- the size of the supplied input streamsupplier
- the input stream supplier- 返回:
- a new
Content
instance
-