Is there a Null OutputStream in Java?

前端 未结 11 647
灰色年华
灰色年华 2020-12-08 13:04

I need to specify an OutputStream for an API I\'m using, but I don\'t actually have a need for the output. Does Java have an OutputStream equivale

11条回答
  •  南方客
    南方客 (楼主)
    2020-12-08 13:43

    ByteArrayOutputStream is what you want (assuming that the API will be outputting text). Just instantiate a new one.

提交回复
热议问题