当前位置: 动力学知识库 > 问答 > 编程问答 >

sockets - How to clear Buffer from BufferedInputStream in android

问题描述:

for eg if client send "nick" then BuffredInputStream will read "nick" and then if client send "sanders" then BuffredInputStream will automatically append "nicksanders".

so how to clear old chunck from BuffredInputStream so that i always get new string every time from while reading from BuffredInputStream...

code:

if (bos1.available() > 0) {

int ij = bos1.read();

// msgLog is string

msgLog += new Character((char) ij).toString();

}

网友答案:

It is not possible to flush inputstream , outputstream can be flushed because it implements Flushable interface.

分享给朋友:
您可能感兴趣的文章:
随机阅读: