Class SerializerPipe
- All Implemented Interfaces:
Closeable,AutoCloseable
For character-based serializers, the output object can be any of the following:
WriterOutputStream- Output will be written as UTF-8 encoded stream.File- Output will be written as system-default encoded stream.StringBuilder
For stream-based serializers, the output object can be any of the following:
See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the output pipe.Wraps the specified output object inside an output stream.Returns the raw output object passed into this session.Wraps the specified output object inside a writer.voidsetOutputStream(OutputStream outputStream) Overwrites the output stream in this pipe.voidOverwrites the writer in this pipe.
-
Method Details
-
close
Closes the output pipe.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getOutputStream
Wraps the specified output object inside an output stream.Subclasses can override this method to implement their own specialized output streams.
This method can be used if the output object is any of the following class types:
- Returns:
- The output object wrapped in an output stream.
Calling
OutputStream.close()on the returned object simply flushes the response and does not close the underlying stream. - Throws:
IOException- If object could not be converted to an output stream.
-
getRawOutput
Returns the raw output object passed into this session.- Returns:
- The raw output object passed into this session.
-
getWriter
Wraps the specified output object inside a writer.Subclasses can override this method to implement their own specialized writers.
This method can be used if the output object is any of the following class types:
WriterOutputStream- Output will be written as UTF-8 encoded stream.File- Output will be written as system-default encoded stream.
- Returns:
- The output object wrapped in a writer.
Calling
Writer.close()on the returned object simply flushes the response and does not close the underlying writer. - Throws:
SerializeException- If object could not be converted to a writer.
-
setOutputStream
Overwrites the output stream in this pipe.Used when wrapping the stream returned by
getOutputStream()so that the wrapped stream will be flushed whenclose()is called.- Parameters:
outputStream- The wrapped stream.
-
setWriter
Overwrites the writer in this pipe.Used when wrapping the writer returned by
getWriter()so that the wrapped writer will be flushed and closed whenclose()is called.- Parameters:
writer- The wrapped writer.
-