I need help with implementing an byteArrayOutputStream that stores the output from the server, which I can then read from and print. Does anyone know how to do this? Any help would be much appreciated. TCPAsk: Edit: my code is now working and it is similar to the answer (TCPClient) given below with some minor additions. ByteArrayOutputStream is not needed.
Tag: bytearrayoutputstream
Protect a SXSSFWorkbook (Excel) and convert it to a byte array
I am working on a Java function which is expected to return a protected Excel file (xlsx) in byte array. I found a solution which used the Encryption support of Apache POI: How to Protect Excel Workbook Via SXSSF? However, OutputStream cannot be cast into ByteArrayOutputStream. I tried to find a way to convert the OutputStream into ByteArray but all
Most efficient way to create InputStream from OutputStream
This page: http://blog.ostermiller.org/convert-java-outputstream-inputstream describes how to create an InputStream from OutputStream: Other alternatives are to use PipedStreams and new threads which is cumbersome. I do not like the idea of copying many megabytes to new in memory byte array. Is there a library that does this more efficiently? EDIT: By advice from Laurence Gonsalves, i tried PipedStreams and it turned