Wraps a PrimitiveSink as an OutputStream, so it is easy to Funnel#funnel funnel an object to a PrimitiveSink if there is already a way to write the contents of the object to an OutputStream. The close and flush methods of the returned {@cod
(PrimitiveSink sink)
| 250 | |
| 251 | |
| 252 | public static OutputStream asOutputStream(PrimitiveSink sink) { |
| 253 | return new SinkAsStream(sink); |
| 254 | } |
| 255 | |
| 256 | private static class SinkAsStream extends OutputStream { |
| 257 | final PrimitiveSink sink; |