Package com.fizzed.rocker.runtime
Class OutputStreamOutput
- java.lang.Object
-
- com.fizzed.rocker.runtime.AbstractRockerOutput<OutputStreamOutput>
-
- com.fizzed.rocker.runtime.OutputStreamOutput
-
- All Implemented Interfaces:
RockerOutput<AbstractRockerOutput>
public class OutputStreamOutput extends AbstractRockerOutput<OutputStreamOutput>
Output that wraps anOutputStream. Optimized for writing bytes vs. Strings. Strings are converted to bytes using the specified charset on each write.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.OutputStreamstream-
Fields inherited from class com.fizzed.rocker.runtime.AbstractRockerOutput
byteLength, charset, contentType
-
-
Constructor Summary
Constructors Constructor Description OutputStreamOutput(ContentType contentType, java.io.OutputStream stream, java.lang.String charsetName)OutputStreamOutput(ContentType contentType, java.io.OutputStream stream, java.nio.charset.Charset charset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.OutputStreamgetStream()OutputStreamOutputw(byte[] bytes)OutputStreamOutputw(java.lang.String string)Writes a String to the output.-
Methods inherited from class com.fizzed.rocker.runtime.AbstractRockerOutput
getByteLength, getCharset, getContentType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.fizzed.rocker.RockerOutput
toString
-
-
-
-
Constructor Detail
-
OutputStreamOutput
public OutputStreamOutput(ContentType contentType, java.io.OutputStream stream, java.lang.String charsetName)
-
OutputStreamOutput
public OutputStreamOutput(ContentType contentType, java.io.OutputStream stream, java.nio.charset.Charset charset)
-
-
Method Detail
-
getStream
public java.io.OutputStream getStream()
-
w
public OutputStreamOutput w(java.lang.String string) throws java.io.IOException
Description copied from interface:RockerOutputWrites a String to the output. Implementations are responsible for handling the conversion to the correct charset. Note that underlying implementations may be optimized to handle Strings vs. Bytes.- Parameters:
string- The string to write- Returns:
- This output (so builder pattern can be used)
- Throws:
java.io.IOException- Thrown on exception.
-
w
public OutputStreamOutput w(byte[] bytes) throws java.io.IOException
- Throws:
java.io.IOException
-
-