简体   繁体   中英

How to read and write integer -1 into DataOutputStream

I want to read and write some values into the DataOutputStream, but sometimes the value is int -1.

I am able to write this value but while reading getting EOFException, I think the value -1 its reading a EOF.

Can someone help me to figure out how can I read and write -1 into DataOutputStream.

Thanks in advance.

要编写一个int值,您可以使用dos.writeInt(x)来读取,您可以得到int x = dis.readInt()无法写入一个看似EOF的值并触发EOFException

像int一样阅读,您可以:

 int valueInt = Integer.parseInt(readed_Value);

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