I have to send a large amount of xml data through sockets. Example of xml file (server side generates such a file):
<message>
<data>
<param1>12345</param1>
<param2>234</param2>
</data>
...
<data>
<param1>321</param1>
<param2>34234</param2>
</data>
</message>
And then client receive such data. Client have to parse this file and insert parameters to db.
Client receives this data by parts (size of byte):
byte[] receivedData = new byte[1024];
int receivedBytesLen = streamFromServer.read(receivedData);
How can I process this data?
- For example, if I read all the file data to the variable on the client side and then process. I think it's not good - may be problems (large amount of data).
- Write all data to the temp file and then to process? Create file, delete...
- Read and process in the same time. But the xml is not full.
- Something else?