[英]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. 我想将一个XML文件从服务器发送到客户端。 The XML file has been generated by the XMLEncoder class and contains some persistent objects.
XML文件由XMLEncoder类生成,包含一些持久对象。
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. 客户端使用XMLDecoder读取XML文件并将对象存储在集合中,但不必将文件写入磁盘。 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();
XMLDecoder采用一个InputStream,它可以是socket.getInputSteam();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.