forum

home / developersection / forums / read/convert an inputstream to a string

Read/convert an InputStream to a String

Anonymous User 2432 04-May-2015
If you have 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 this to a String (for example, so I can write the contents of the stream to a log file).

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

public String convertStreamToString(InputStream is) { 
    // ???
}

Updated on 04-May-2015

I am a content writter !


Message
Can you answer this question?

Answer

1 Answers

Liked By