Java ByteArrayOutputStream toByteArray() methodThe toByteArray() method of Java ByteArrayOutputStream class is used to create a newly allocated byte array with the size as the current size of this output stream. Syntax:ReturnsThe toByteArray() method returns the current contents of this output stream as a byte array. Example 1Test it NowOutput: 65 66 67 68 69 Example 2Test it NowOutput: 75 76 77 78 79
Next TopicJava ByteArrayOutputStream Class
|