{"id":1503,"date":"2017-03-21T18:04:24","date_gmt":"2017-03-21T12:34:24","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=1503"},"modified":"2017-03-29T10:38:33","modified_gmt":"2017-03-29T05:08:33","slug":"java-readconvert-inputstream-string","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/java-readconvert-inputstream-string\/","title":{"rendered":"JAVA &#8211; Read\/convert an InputStream to a String"},"content":{"rendered":"<ul>\n<li>The <b>Java.io.InputStream<\/b> class is the superclass of all classes representing an input stream of bytes.<\/li>\n<li>Applications that need to define a subclass of InputStream must always provide a method that returns the next byte of input<\/li>\n<\/ul>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-1506 size-full\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/03\/Pictu.png\" alt=\"\" width=\"717\" height=\"386\" \/><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>It explains concept of how to read and write date e.g. bytes from input source like file, network, keyboard and writing data to console, file, network and program.<\/li>\n<li>InputStream is used to read data and OutputStream is used to write data.<\/li>\n<li>Data can be on any format (e.g. Text or Binary). We can even read data in particular type by using DataInputStream.<\/li>\n<li>Java provides char, int, float, double, long and other data types to store data read in that way.<\/li>\n<li>Character streams (e.g. Readers) are used to read character data while Byte Streams (e.g. InputStream) are used to read binary data.<\/li>\n<\/ul>\n<h4 id=\"example-read-and-convert-an-inputstream-to-a-string\"><span style=\"color: #808000;\"><b>Example:<\/b> <b>Read and Convert an InputStream to a String<\/b><\/span><\/h4>\n<p>Here is the complete example of how to read and convert an InputStream to a String.<\/p>\n<p>The steps involved are:<\/p>\n<ul>\n<li>We have initialized the Input Stream after converting the file content to bytes using get Bytes() method and then using the Byte Array Input Stream which contains an internal buffer that contains bytes that may be read from the stream.<\/li>\n<li>Read the Input Stream using Input Stream Reader.<\/li>\n<li>Read Input Stream Reader using Buffered Reader.<\/li>\n<li>Appended each line to a String Builder object which has been read by Buffered Reader.<\/li>\n<li>Finally converted the String Builder to String using to String() method.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">import java.io.BufferedReader;<br\/>import java.io.ByteArrayInputStream;<br\/>import java.io.IOException;<br\/>import java.io.InputStream;<br\/>import java.io.InputStreamReader;<\/code><\/pre> <\/div>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">public class WikitechyExample <br\/>{<br\/>   public static void main(String[] args) throws IOException <br\/>{<br\/>       InputStreamReader isr = null;<br\/>       BufferedReader br = null;<br\/>       InputStream is = new ByteArrayInputStream(&quot;Welcome to wikitechy&quot;.getBytes());<br\/>StringBuilder sb = new StringBuilder();<br\/>       String content;<br\/> try <br\/>{<br\/>           isr = new InputStreamReader(is);<br\/>\t   br = new BufferedReader(isr);<br\/>\t   while ((content = br.readLine()) != null) <br\/>{<br\/>\t\tsb.append(content);<br\/>}<br\/>} catch (IOException ioe) <br\/>{<br\/>\t\tSystem.out.println(&quot;IO Exception occurred&quot;);<br\/>\t\tioe.printStackTrace();\t<br\/> } finally <br\/>{<br\/>\t\tisr.close();<br\/>\t\tbr.close();<br\/>}<br\/>        String mystring = sb.toString();<br\/>\tSystem.out.println(mystring);<br\/> }<br\/>}<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<h4 id=\"output\"><strong><span style=\"color: #ff6600;\">Output:<\/span><\/strong><\/h4>\n<p><strong>Welcome to wikitechy<\/strong><\/p>\n<h4 id=\"3-ways-to-read-files-in-java-nio\"><span style=\"color: #800080;\"><b>3 Ways to Read files in java NIO:<\/b><\/span><\/h4>\n<ul>\n<li>If we are using java.nio package for reading a file, we can read some effective ways to read files in java NIO.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-1510 size-full\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2017\/03\/Pic-1.png\" alt=\"\" width=\"575\" height=\"191\" \/><\/p>\n<ul>\n<li>Using BufferedReader<\/li>\n<li>Using apache commons IOUtils<\/li>\n<li>Using java.util.Scanner<\/li>\n<\/ul>\n<h4 id=\"using-bufferedreader\"><span style=\"color: #ff6600;\"><b>U<\/b><b>sing <\/b><b>BufferedReader<\/b><\/span><\/h4>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">package com.howtodoinjava.demo.io;<br\/> import java.io.BufferedReader;<br\/>import java.io.File;<br\/>import java.io.FileInputStream;<br\/>import java.io.FileNotFoundException;<br\/>import java.io.IOException;<br\/>import java.io.InputStream;<br\/>import java.io.InputStreamReader;<br\/> public class ReadStreamIntoStringUsingReader{<br\/>    public static void main(String[] args) throws FileNotFoundException, IOException  {<br\/>        InputStream wikiin = new FileInputStream(new File(&quot;C:\/temp\/test.txt&quot;));<br\/>        BufferedReader reader = new BufferedReader(new InputStreamReader(wikiin));<br\/>        StringBuilder out = new StringBuilder();<br\/>        String line;<br\/>        while ((line = reader.readLine()) != null) {<br\/>            out.append(line);<br\/>}<br\/>        System.out.println(out.toString());   \/\/Prints the string content read from input stream<br\/>        reader.close();<br\/>}<br\/>}<\/code><\/pre> <\/div>\n<h4 id=\"using-apache-commons-ioutils\"><span style=\"color: #808000;\"><b>Using apache commons IOUtils<\/b><\/span><\/h4>\n<ul>\n<li>Apache commons has a very classy facility for this purpose which makes code is easy to read.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">package com.howtodoinjava.demo.io;<br\/>import java.io.File;<br\/>import java.io.FileInputStream;<br\/>import java.io.FileNotFoundException;<br\/>import java.io.IOException;<br\/>import java.io.StringWriter;<br\/>import org.apache.commons.io.IOUtils;<br\/> public class ReadStreamIntoStringUsingIOUtils<br\/>{<br\/> public static void main(String[] args) throws FileNotFoundException, IOException {<br\/>        \/\/Method 1 IOUtils.copy()<br\/>        StringWriter writer = new StringWriter();<br\/>        IOUtils.copy(new FileInputStream(new File(&quot;C:\/temp\/test.txt&quot;)), writer, &quot;UTF-8&quot;);<br\/>        String theString = writer.toString();<br\/>        System.out.println(theString);<br\/>         <br\/>        \/\/Method 2 IOUtils.toString()<br\/>        String theString2 = IOUtils.toString(new FileInputStream(new File(&quot;C:\/temp\/test.txt&quot;)), &quot;UTF-8&quot;);<br\/>        System.out.println(theString2);<br\/>    }}<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<h4 id=\"using-java-util-scanner\"><span style=\"color: #ff6600;\"><b>Using <\/b><b>java.util.Scanner<\/b><\/span><\/h4>\n<ul>\n<li>The reason it works is because Scanner iterates over tokens in the stream, and in this case we separate tokens using \u201cbeginning of the input boundary\u201d (A) thus giving us only one token for the entire contents of the stream.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">package com.howtodoinjava.demo.io;<br\/>import java.io.File;<br\/>import java.io.FileInputStream;<br\/>import java.io.FileNotFoundException;<br\/>import java.io.IOException;<br\/>public class ReadStreamIntoStringUsingScanner<br\/>{<br\/>    @SuppressWarnings(&quot;resource&quot;)<br\/>    public static void main(String[] args) throws FileNotFoundException, IOException <br\/>{<br\/>        FileInputStream fin = new FileInputStream(new File(&quot;C:\/temp\/test.txt&quot;));<br\/>        java.util.Scanner scanner = new java.util.Scanner(fin,&quot;UTF-8&quot;).useDelimiter(&quot;\\A&quot;);<br\/>        String theString = scanner.hasNext() ? scanner.next() : &quot;&quot;;<br\/>        System.out.println(theString);<br\/>        scanner.close();<br\/>}<br\/>}<\/code><\/pre> <\/div>\n<h4 id=\"read-inputstream-as-string-in-java-jdk7-guava-and-apache-commons\"><span style=\"color: #808000;\"><b>Read InputStream as String in Java &#8211; JDK7, Guava and Apache Commons<\/b><\/span><\/h4>\n<ul>\n<li>Inside Java program, we often use String object to store and pass file data, that&#8217;s why we need a way to convert InputStream to String in Java.<\/li>\n<li>For example In Java, we read data from file or socket using InputStream and write data using OutputStream.<\/li>\n<li>Java programming language provides streams to read data from a file, a socket and from other sources e.g. byte array, but developers often find themselves with several issues e.g. how to open connection to read data, how to close connection after reading or writing into file, how to handle IOException (e.g. FileNotFoundException, EOFFileException etc).<\/li>\n<\/ul>\n<h4 id=\"3-example-to-read-inputstream-as-string-in-java\"><span style=\"color: #800080;\"><b>3 Example to Read InputStream as String in java:<\/b><\/span><\/h4>\n<ul>\n<li><b>Using Core Java classes<\/b><\/li>\n<li><b>Using Apache Commons IO<\/b><\/li>\n<li><b>Using Google Guava library<\/b><\/li>\n<\/ul>\n<h4 id=\"using-core-java-classes\"><span style=\"color: #ff6600;\"><b>Using Core Java classes<\/b><\/span><\/h4>\n<ul>\n<li>This approach is best suited to application running on Java 7, as we are using try-with-resource statements to automatically close input streams, but we can just take out that piece and can close streams in finally block, if we are running on Java 6 or lower version.<\/li>\n<li>Here is the steps and\u00a0 code sample of reading InputStream as String in Java :<\/li>\n<\/ul>\n<p>Step 1: Open FileInputStream to read contents of File as InputStream.<\/p>\n<p>Step 2: Create InputStreamReader with character encoding to read byte as characters<\/p>\n<p>Step 3: Create BufferedReader to read file data line by line<\/p>\n<p>Step 4: Use StringBuilder to combine lines<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">try\u00a0(InputStream\u00a0in\u00a0=\u00a0new\u00a0FileInputStream(&quot;wikitechy.txt&quot;);<br\/>\u00a0BufferedReader\u00a0r\u00a0=\u00a0new\u00a0BufferedReader(new\u00a0InputStreamReader(in,\u00a0StandardCharsets.UTF_8)))<br\/> {\u00a0<br\/>String\u00a0str\u00a0=\u00a0null;\u00a0<br\/>StringBuilder\u00a0sb\u00a0=\u00a0new\u00a0StringBuilder(8192);\u00a0<br\/>while\u00a0((str\u00a0=\u00a0r.readLine())\u00a0!=\u00a0null) <br\/>{<br\/> sb.append(str); <br\/>}\u00a0<br\/>System.out.println(&quot;data from InputStream as String : &quot;\u00a0+\u00a0sb.toString()); <br\/>}<br\/>\u00a0catch\u00a0(IOException\u00a0ioe) <br\/>{ <br\/>ioe.printStackTrace(); <br\/>}<\/code><\/pre> <\/div>\n<ul>\n<li>Closing of InputStream is taken care by Java itself because they are declared as try-with-resource statement.<\/li>\n<li>Our File contains a single line, which contains some French characters, to demonstrate use of character encoding.<\/li>\n<li>We have provided UTF-8 to InputStreamReader just for this purpose.<\/li>\n<\/ul>\n<h4 id=\"using-apache-commons-io\"><span style=\"color: #808000;\"><b>Using Apache Commons IO<\/b><\/span><\/h4>\n<ul>\n<li>In this example, we are using IOUtils class from Apache commons IO to read InputStream data as String.<\/li>\n<li>It provides a toString() method to convert InputStream to String.<\/li>\n<li>This is the most easiest way to get String from stream, but we should also don&#8217;t rely on them to close our streams.<\/li>\n<li>If we are using automatic resource management feature of Java 7, which closes any resource opened in try() statement.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">try\u00a0(FileInputStream\u00a0fis\u00a0=\u00a0new\u00a0FileInputStream(&quot;wikitechy.txt&quot;);) <br\/>{\u00a0<br\/>String\u00a0text\u00a0=\u00a0IOUtils.toString(fis,\u00a0StandardCharsets.UTF_8.name());\u00a0<br\/>System.out.println(&quot;String generated by reading InputStream in Java : &quot;\u00a0+\u00a0text); <br\/>}\u00a0<br\/>catch\u00a0(IOException\u00a0io) <br\/>{ <br\/>io.printStackTrace();<br\/> }<\/code><\/pre> <\/div>\n[ad type=&#8221;banner&#8221;]\n<h4 id=\"using-google-guava-library\"><span style=\"color: #800080;\"><b>Using Google Guava library<\/b><\/span><\/h4>\n<ul>\n<li>In this example, we have used Google Guava library to read contents of InputStream as String.<\/li>\n<li>Here input stream is not obtained from file instead from a byte array, which is generated by converting an String to byte array.<\/li>\n<li>It always better to provide encoding while calling getBytes() method of String, so that data is converted correctly.<\/li>\n<li>In example, we have provided &#8220;UTF-8&#8221;, though we can also use StandardCharsets.UTF_8.name().<\/li>\n<li>CharStreams.toString() doesn&#8217;t close Stream from which it is reading characters, that&#8217;s why we have opened stream in try (&#8230;) parenthesis, so that it will be automatically closed by Java.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">String\u00a0stringWithSpecialChar\u00a0=\u00a0&quot;Soci\u00e9t\u00e9 G\u00e9n\u00e9rale&quot;;<br\/>\u00a0try\u00a0(final\u00a0InputStream\u00a0in\u00a0=\u00a0new\u00a0ByteArrayInputStream(stringWithSpecialChar.getBytes(&quot;UTF-8&quot;));<br\/>\u00a0final\u00a0InputStreamReader\u00a0inr\u00a0=\u00a0new\u00a0InputStreamReader(in)) <br\/>{<br\/>\u00a0String\u00a0text\u00a0=\u00a0CharStreams.toString(inr);\u00a0System.out.println(&quot;String from InputStream in Java: &quot;\u00a0+\u00a0text); <br\/>}\u00a0<br\/>catch\u00a0(IOException\u00a0e)<br\/> {<br\/> e.printStackTrace();<br\/> }<\/code><\/pre> <\/div>\n<h4 id=\"complete-java-program-of-inputstream-to-string-in-java\"><span style=\"color: #ff6600;\"><b>Complete java program of inputstream to string in java<\/b><\/span><\/h4>\n<ul>\n<li>Here is the full code listing of 3 ways to read InputStream as String in Java Program.<\/li>\n<li>In order to run this program, copy this code into a file and save it as InputStreamToString.java, after this compile this file using javac command, if javac is not in our included in our PATH environment variable, then we can directly run it from bin folder of our JDK installation directory, also known as JAVA_HOME.<\/li>\n<li>After compilation, we can run our program by using java command e.g. java -classpath . InputStreamToString .<\/li>\n<\/ul>\n<p>It shows examples from core Java, Google Guava and Apache commons library.<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">import\u00a0java.io.BufferedReader;\u00a0<br\/>import\u00a0java.io.ByteArrayInputStream;\u00a0<br\/>import\u00a0java.io.FileInputStream;\u00a0<br\/>import\u00a0java.io.FileNotFoundException;\u00a0<br\/>import\u00a0java.io.IOException;<br\/>\u00a0import\u00a0java.io.InputStream;\u00a0<br\/>import\u00a0java.io.InputStreamReader;\u00a0<br\/>import\u00a0java.nio.charset.StandardCharsets;<br\/>\u00a0import\u00a0org.apache.commons.io.Charsets;\u00a0<br\/>import\u00a0org.apache.commons.io.IOUtils;<br\/>\u00a0importcom.google.common.io.CharStreams;<br\/>\u00a0import\u00a0com.google.common.io.InputSupplier<br\/>public\u00a0class\u00a0InputStreamToString\u00a0{\u00a0public\u00a0static\u00a0void\u00a0main(String\u00a0args[])<br\/> {<br\/>\u00a0\/\/ InputStream to String - Core Java Example\u00a0<br\/>try\u00a0(InputStream\u00a0in\u00a0=\u00a0new\u00a0FileInputStream(&quot;wikitechy.txt&quot;);\u00a0<br\/>BufferedReader\u00a0r\u00a0=\u00a0new\u00a0BufferedReader(new\u00a0InputStreamReader(in,\u00a0StandardCharsets.UTF_8))) <br\/>{\u00a0<br\/>String\u00a0str\u00a0=\u00a0null;\u00a0<br\/>StringBuilder\u00a0sb\u00a0=\u00a0new\u00a0StringBuilder(8192);\u00a0<br\/>while\u00a0((str\u00a0=\u00a0r.readLine())\u00a0!=\u00a0null) <br\/>{ <br\/>sb.append(str); <br\/>}\u00a0<br\/>System.out.println(&quot;data from InputStream as String : &quot;\u00a0+\u00a0sb.toString()); <br\/>}\u00a0<br\/>catch\u00a0(IOException\u00a0ioe) <br\/>{ <br\/>ioe.printStackTrace();<br\/>}<\/code><\/pre> <\/div>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">\/\/ Converting InputStream to String in Java - Google Guava Example\u00a0<br\/>String\u00a0stringWithSpecialChar\u00a0=\u00a0&quot;Soci\u00e9t\u00e9G\u00e9n\u00e9rale&quot;;\u00a0<br\/>try\u00a0(final\u00a0InputStream\u00a0in\u00a0=\u00a0new\u00a0ByteArrayInputStream(stringWithSpecialChar.getBytes(&quot;UTF-8&quot;));\u00a0<br\/>final\u00a0InputStreamReader\u00a0inr\u00a0=\u00a0new\u00a0InputStreamReader(in)) <br\/>{\u00a0<br\/>String\u00a0text\u00a0=\u00a0CharStreams.toString(inr);\u00a0<br\/>System.out.println(&quot;String from InputStream in Java: &quot;\u00a0+text);<br\/> }\u00a0<br\/>catch\u00a0(IOException\u00a0e) { e.printStackTrace(); <br\/>}\u00a0<\/code><\/pre> <\/div>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <span class=\"code-embed-name\">java code<\/span> <\/div> <pre class=\"language-java code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-java code-embed-code\">\/\/ Reading data from InputStream as String in Java - Apache Commons Example\u00a0<br\/>try\u00a0(FileInputStream\u00a0fis\u00a0=\u00a0new\u00a0FileInputStream(&quot;wikitechy.txt&quot;);)<br\/> {\u00a0<br\/>String\u00a0text\u00a0=\u00a0IOUtils.toString(fis,\u00a0StandardCharsets.UTF_8.name());\u00a0<br\/>System.out.println(&quot;String generated by reading InputStream in Java : &quot;\u00a0+\u00a0text);<br\/> }\u00a0<br\/>catch\u00a0(IOException\u00a0io) <br\/>{ <br\/>io.printStackTrace(); <br\/>} <br\/>}<br\/> }<\/code><\/pre> <\/div>\n<h4 id=\"output-2\"><span style=\"color: #808000;\"><b>Output:\u00a0<\/b><\/span><\/h4>\n<p><strong>data from\u00a0InputStream\u00a0as\u00a0String\u00a0:\u00a0Soci\u00e9t\u00e9\u00a0G\u00e9n\u00e9rale\u00a0is a\u00a0French\u00a0bank\u00a0Headquarters\u00a0at \u00cele-de-France,\u00a0France\u00a0<\/strong><\/p>\n<p><strong>String\u00a0from\u00a0InputStream\u00a0in\u00a0Java:\u00a0Soci\u00e9t\u00e9\u00a0G\u00e9n\u00e9rale\u00a0<\/strong><\/p>\n<p><strong>String\u00a0generated by reading\u00a0InputStream\u00a0in\u00a0Java\u00a0:\u00a0Soci\u00e9t\u00e9\u00a0G\u00e9n\u00e9rale\u00a0is a\u00a0French\u00a0bank\u00a0Headquarters\u00a0at \u00cele-de-France, France<\/strong><\/p>\n[ad type=&#8221;banner&#8221;]<b><br \/>\n<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Java.io.InputStream class is the superclass of all classes representing an input stream of bytes. Applications that need to define a subclass of InputStream must always provide a method that returns the next byte of input &nbsp; It explains concept of how to read and write date e.g. bytes from input source like file, network, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2139],"tags":[3065,3063,3054,3067,3069,3062,3057,2172,3064,3068,1128,3066,3056,3055,3061,3060,3058,3059],"class_list":["post-1503","post","type-post","status-publish","format-standard","hentry","category-java","tag-convert-inputstream-to-bufferedreader","tag-convert-inputstream-to-byte-array-in-java","tag-convert-inputstream-to-string-in-java","tag-converting-inputstream-from-a-zipfile-to-string","tag-converting-string-path-to-inputstream","tag-get-an-outputstream-into-a-string","tag-guava-inputstream-to-string","tag-how-do-i-convert-a-string-to-an-inputstream-in-java","tag-how-do-i-convert-an-inputstream-to-a-string-in-java","tag-how-to-chain-multiple-different-inputstreams-into-one-inputstream","tag-how-to-check-whether-a-string-contains-a-substring-in-javascript","tag-how-to-convert-a-string-to-an-int-in-java","tag-inputstream-to-string-android","tag-inputstream-to-string-java-8","tag-java-8-stream-to-string","tag-java-read-inputstream-line-by-line","tag-java-read-inputstream-to-byte-array","tag-scala-inputstream-to-string"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=1503"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/1503\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=1503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=1503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=1503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}