Verwin Tate Vikas Tate
Home

Jobs

Blogs

Profile

Contact us
Verwin Forum Ask Question
1 Following this Question
Verwin User Default Image
How to convert Inputstreamtsring to String data? Like if i get data from java.io.Inputstream , how do i convert it to String form???
Verwin Posted Date Posted on 1/8/2020
Verwin Count 4 Answers
Verwin User Default Image Venkat Mahesh Verwin Posted DateAnswered on 11/8/2020
String theString = IOUtils.toString(inputStream, encoding); 
using Apache commons IOUils to copy the Inputstream into a StringWriter or  using java 8 Stream Api



Verwin Sonu Gupta Sonu Gupta Verwin Posted DateAnswered on 10/8/2020

Using Stream Api (Java 8). This solution convert different line breaks (like \r\n) to \n.

String result = new BufferedReader(new InputStreamReader(inputStream))
  .lines().collect(Collectors.joining("\n"));
Verwin User Default Image Srini Mahesh Verwin Posted DateAnswered on 1/8/2020
Hey, You can use an InputStreamReader and StrngBuilder functions from JDK to read and convert the values to a String. I have used UTF_8 for conversion. Try it. Not sure if other standards work.
How to convert Inputstreamtsring to String data? Like if i get data from java.io.Inputstream , how do i convert it to String form???
String theString = IOUtils.toString(inputStream, encoding); 
using Apache commons IOUils to copy the Inputstream into a StringWriter or  using java 8 Stream Api



Verwin User Default Image
Answered on: 11/8/2020
Verwin User Default Image
Answered on: 10/8/2020

Using Stream Api (Java 8). This solution convert different line breaks (like \r\n) to \n.

String result = new BufferedReader(new InputStreamReader(inputStream))
  .lines().collect(Collectors.joining("\n"));
Verwin Sonu Gupta
Answered on: 10/8/2020
Hey, You can use an InputStreamReader and StrngBuilder functions from JDK to read and convert the values to a String. I have used UTF_8 for conversion. Try it. Not sure if other standards work.
Verwin User Default Image
Answered on: 1/8/2020