i ask myself if there is a nice solution for receiving data via TCP and reading the data in a DataInputStream and store the data in a bytearray of "dynamic" size. I thought about some solutions like writing in buffers and finally store it in a created array that is as large as the packet i received.
Here an example: the data i receive via TCP (byte by byte) is n*13 Byte large and the end of a packet is 13 Bytes of zeros (13 Byte of zeros are unique, cant be in the data before). The next packet is m*13 Byte + 13 Byte of zeros and so on. So i want to listen to the stream and store e.g. n*13 Byte in a bytearray without zeros (i dont know the size of one dataset before).
Can you tell me how to do it a slim way?
Thanks in advance!
Chris