Created
April 10, 2016 00:49
-
-
Save Wajihulhassan/eca620a5d0199ad9f3534a7d57576392 to your computer and use it in GitHub Desktop.
Closing OutputStream before calling toByteArray on the underlying ByteArrayOutputStream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When a `DataOutputStream` or an `ObjectOutputStream` instance wraps an underlying ByteArrayOutputStream instance, | |
it is recommended to flush or close the DataOutputStream and ObjectOutputStream before invoking the | |
underlying instances's toByteArray(). Also, it is a good practice to call flush/close explicitly | |
as mentioned for example [here] (http://stackoverflow.com/questions/2984538/how-to-use-bytearrayoutputstream-and-dataoutputstream-simultaneously-java). | |
This pull request adds a `flush` method before calling toByteArray(). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment