Answers for "inputstream to string java 8 example"

4

java create inputstream from string

InputStream targetStream = new ByteArrayInputStream("your string".getBytes());
Posted by: Guest on December-18-2019
1

inputstream to string java

StringBuilder textBuilder = new StringBuilder();
        try (Reader reader = new BufferedReader(new InputStreamReader
            (stream, Charset.forName(StandardCharsets.UTF_8.name())))) {
            int c = 0;
            while ((c = reader.read()) != -1) {
                textBuilder.append((char) c);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
 textBuilder.toString;
Posted by: Guest on May-21-2020

Code answers related to "inputstream to string java 8 example"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language