public interface Content
OutputStream.| Modifier and Type | Method and Description |
|---|---|
static Content |
of(byte[] bytes)
Create a new
Content from the given input stream. |
static Content |
of(File file)
Create a new
Content from the given file. |
static Content |
of(int size,
IOSupplier<InputStream> supplier)
Create a new
Content from the given input stream. |
static Content |
of(String string)
Create a new
Content 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.
|
int size()
void writeTo(OutputStream outputStream) throws IOException
outputStream - the output stream to write toIOException - on IO errorstatic Content of(String string)
Content from the given UTF-8 string.string - the string to writeContent instancestatic Content of(byte[] bytes)
Content from the given input stream.bytes - the bytes to writeContent instancestatic Content of(File file)
Content from the given file.file - the file to writeContent instancestatic Content of(int size, IOSupplier<InputStream> supplier)
Content 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 supplierContent instance