public interface SimpleContentBuilder extends ContentBuilder<SimpleContentBuilder>
Such a builder can be created using ContentFactory.newBuilder(Class)
,
for example:
ContentFactory factory = Diffusion.content();
SimpleContentBuilder builder = factory.newBuilder(SimpleContentBuilder.class);
Modifier and Type | Method and Description |
---|---|
SimpleContentBuilder |
put(byte[] bytes)
Relative put of bytes into the content.
|
SimpleContentBuilder |
putString(Object data)
Convenience method to put the
toString() evaluation of a given
object into the content. |
build, encoding, reset
SimpleContentBuilder put(byte[] bytes) throws IllegalArgumentException
If the builder already has bytes, this will effectively append the bytes to the existing bytes to form a new byte array.
bytes
- the content to append to any existing contentIllegalArgumentException
- if bytes
is nullSimpleContentBuilder putString(Object data) throws IllegalArgumentException
toString()
evaluation of a given
object into the content.
The toString()
method will be called on the specified object and
then the resulting String converted to bytes using the UTF-8 character
set. The bytes are then written in the same way as for
put(byte[])
.
data
- the object to get string data from, typically a StringIllegalArgumentException
- if data
is nullCopyright © 2016 Push Technology Ltd. All Rights Reserved.