How do I read / convert an InputStream into a String in Java?

已回答

If you have a java.io.InputStream object, how should you process that object and produce a String?

Suppose I have an InputStream that contains text data, and I want to convert it to a String, so for example I can write that to a log file. PartyCity Feedback

What is the easiest way to take the InputStream and convert it to a String?

public String convertStreamToString(InputStream is) {
    // ???
}
评论操作 固定链接

Hi Alisauxbpn53 This forum is for IntelliJ IDEA related questions only. I'd recommend you discuss Java-related questions at https://stackoverflow.com .

Thank you!

See if https://stackoverflow.com/a/35446009/12844632 helps.

0

请先登录再写评论。