简体   繁体   English

android Client中的java.io.StreamCorrupted Exception`

[英]java.io.StreamCorrupted Exception` in android Client

I am making a connection from Android client to Servlet using url connection. 我正在使用url连接从Android客户端建立到Servlet的连接。 I am sending a string to server on button click.Server is receiving string and able to print it. 我在按钮click上向服务器发送字符串。服务器正在接收字符串并能够打印它。 When the Servlet sends response as a string, The Android Client Client is showing the following Exceoption 当Servlet以字符串形式发送响应时,Android客户端客户端将显示以下Exceoption
java.io.StreamCorrupted Exception
What can be the reason for such an exception? 发生这种例外的原因可能是什么?

This exception will be thrown if the expected input stream is not proper . 如果预期的输入流不正确,则将抛出此异常。

For example: 例如:

If the expected input stream on the client side is ObjectInputStream and the server is not writing using ObjectOutputStream . 如果客户端上预期的输入流是ObjectInputStream,并且服务器未使用ObjectOutputStream进行写入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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