我从网络套接字的输入流读入buffer
count = input.read(buffer)
然后在下一行,我正在使用
打印阅读内容str = new String(buffer,0,count);
Log.e("str",str);
然后我尝试将其写入PipedOutputStream
PipedInputStream
pipedOutputStream .write(buffer);
其中,
pipedOutputStream = new PipedOutputStream(pipedInputStream)
问题是线程在pipedOutputStream .write(buffer);
下面是确认,取自DDMS的线程调试工具,
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:401)
at java.io.PipedInputStream.receive(PipedInputStream.java:394)
at java.io.PipedOutputStream.write(PipedOutputStream.java:176)
at java.io.OutputStream.write(OutputStream.java:106)
at java.io.PipedOutputStream.write(PipedOutputStream.java:147)
at java.io.OutputStream.write(OutputStream.java:82)
at com.example.Receiver.run(DRCReceiver.java:104)
任何人都可以告诉我,为什么以下内容不起作用(阻止帖子)(对所有语句进行分组)
count = input.read(buffer)
str = new String(buffer,0,count);
Log.e("str",str);
pipedOutputStream .write(buffer);
但以下工作正常(未阻止帖子)。
count = input.read(buffer)
str = new String(buffer,0,count);
Log.e("str",str);
pipedOutputStream .write(str.getBytes());
提前致谢