简体   繁体   中英

Using BufferedReader and DataInputStream in harmony

I've been poking around the internet for quite a while now, and I was wondering how I could use BufferedReader and DataInputStream together without opening a different port. I've tried to stream images, but as the buffered reader stores extra bytes, it creates a corrupt image. When I attempt to use DataInputStream.read(), I can't read full lines of text as easily. Is there some sort of solution for my problem?

DataInputStream.readLine(), and yes I know it's deprecated. The real solution is not to use lines in your protocol. Use readUTF() for example.

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