Interface Content
- All Known Implementing Classes:
InspectedContent, Layer
public interface Content
Content with a known size that can be written to an
OutputStream.- Since:
- 2.3.0
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionstatic Contentof(byte[] bytes) Create a newContentfrom the given input stream.static Contentof(int size, IOSupplier<InputStream> supplier) Create a newContentfrom the given input stream.static ContentCreate a newContentfrom the given file.static ContentCreate a newContentfrom the given UTF-8 string.intsize()The size of the content in bytes.voidwriteTo(OutputStream outputStream) Write the content to the given output stream.
-
Method Details
-
size
int size()The size of the content in bytes.- Returns:
- the content size
-
writeTo
Write the content to the given output stream.- Parameters:
outputStream- the output stream to write to- Throws:
IOException- on IO error
-
of
-
of
-
of
-
of
-