How to know if an OutputStream can continue writing in Java?

104 views Asked by At

How to know if an OutputStream can continue writing in Java?

For InputStream, we can check whether return equals -1 to know if the input stream has ended, but how do I check for OutputStream?


Why do I ask this question? For example, I need to write data into a byte array or a buffer, but the methods provided by the API only have parameters of OutputStream type. How can I make my OutputStream implementation tell the API that the array/buffer has been full?

0

There are 0 answers