简体   繁体   中英

Java: Reading XML file from a TCP stream without writing it to disk

I would like to send a XML file from a server to client. The XML file has been generated by the XMLEncoder class and contains some persistent objects.

The client reads the XML file by using a XMLDecoder and storing the objects in a collection, but it's not necessary to write the file to disk. Is that possible? If so, how could it be done? Thanks.

Is that possible? If so, how could it be done?

Read the data from the socket instead of reading from a File. XMLDecoder takes an InputStream which can be the socket.getInputSteam();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM