Class SerializerPipe
- All Implemented Interfaces:
Closeable
,AutoCloseable
For character-based serializers, the output object can be any of the following:
Writer
OutputStream
- 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 TypeMethodDescriptionvoid
close()
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.void
setOutputStream
(OutputStream outputStream) Overwrites the output stream in this pipe.void
Overwrites the writer in this pipe.
-
Method Details
-
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.
-
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:
Writer
OutputStream
- 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.
-
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.
-
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.
-
getRawOutput
Returns the raw output object passed into this session.- Returns:
- The raw output object passed into this session.
-
close
Closes the output pipe.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-