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 stre
InputStream
String
Below code might help you.
public String convertBytestoString(InputStream inputStream) { int bytes; byte[] buffer = new byte[1024]; bytes = inputStream.read(buffer); String stringData = new String(buffer,0,bytes); return stringData; }