{"id":85,"date":"2021-01-16T21:38:33","date_gmt":"2021-01-16T21:38:33","guid":{"rendered":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/?page_id=85"},"modified":"2021-01-16T22:11:30","modified_gmt":"2021-01-16T22:11:30","slug":"streams","status":"publish","type":"page","link":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/","title":{"rendered":"Streams"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a6d4a89db405\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a6d4a89db405\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Streams_Stream_Classification\" >Streams &amp; Stream Classification<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#What_is_a_Stream\" >What is a Stream?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Classification_of_Streams\" >Classification of Streams<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Input_vs_Output\" >Input vs Output<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Character_vs_Byte\" >Character vs Byte<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Other_Classifications\" >Other Classifications<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Character_Streams\" >Character Streams<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#The_Reader_Class\" >The Reader Class<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#The_Writer_Class\" >The Writer Class<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Data_SourceSink_Character_Streams\" >Data Source\/Sink Character Streams<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Reading_from_and_Writing_to_a_File\" >Reading from and Writing to a File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Reading_from_and_Writing_to_a_String\" >Reading from and Writing to a String<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Processing_Character_Streams\" >Processing Character Streams<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#BufferedReader_and_BufferedWriter\" >BufferedReader and BufferedWriter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#FilterReader_and_FilterWriter\" >FilterReader and FilterWriter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#InputStreamReader_and_OutputStreamWriter\" >InputStreamReader and OutputStreamWriter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#LineNumberReader\" >LineNumberReader<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#PushbackReader\" >PushbackReader<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#PrintWriter\" >PrintWriter<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Wrapping_Streams_within_Streams\" >Wrapping Streams within Streams<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#An_Example\" >An Example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Using_a_BufferedReader\" >Using a BufferedReader<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Using_BufferedReader_Entry_Points\" >Using BufferedReader Entry Points<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/course-topics\/i-o-files-streams\/streams\/#Buffering_the_Output_too\" >Buffering the Output, too<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Streams_Stream_Classification\"><\/span>Streams &amp; Stream Classification<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_a_Stream\"><\/span>What is a Stream?<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A stream is a very useful abstraction that exists in a number of environments. A stream conceptually has:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A source<\/li><li>A &#8220;sink&#8221; (a destination)<\/li><li>A flow of data from the source to the destination<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The UNIX operating system has the concept of streams of data which may be read or written. The various UNIX shells (such as the Bourne shell, the C shell, etc) take great advantage of the concept of a stream to &#8216;pipe&#8217; data from one place to another<\/li><li>The C++ programming language has its I\/O streams which provide similar functionality.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you wish to perform I\/O in Java (or move data around in memory), then you will use <strong><em>Java Streams<\/em><\/strong><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Classification_of_Streams\"><\/span>Classification of Streams<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In Java, streams may be classified in the following ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Input streams vs Output streams<\/li><li>Character streams vs Byte streams<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Input_vs_Output\"><\/span>Input vs Output<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Depending on whether the stream is an input stream or an output stream, a program can interact with the stream in the following ways:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th><strong>Reading<\/strong><\/th><th><strong>Writing<\/strong><\/th><\/tr><tr><td><code>open the stream <br>while more data exists <br>  read data from stream<br>close the stream<\/code><\/td><td><code>open the stream <br>while more data <br>  write data to stream<br>close the stream<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Character_vs_Byte\"><\/span>Character vs Byte<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Java separates its stream classes into two types:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Streams dealing with characters (<code><strong>Reader<\/strong><\/code>s and&nbsp;<code><strong>Writer<\/strong><\/code>s)<\/li><li>Streams dealing with bytes (binary data)<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Problems were found in JDK 1.0 when using the existing byte-oriented streams to deal with input and output of&nbsp;<em>internationalized character sets<\/em>. Consequently, JDK 1.1 introduced the set of classes called&nbsp;<code><strong>Reader<\/strong><\/code>s and&nbsp;<code><strong>Writer<\/strong><\/code>s.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong><em>Note:<\/em><\/strong>&nbsp;Don&#8217;t even think about using the byte-based streams to input or output characters &#8212; they can&#8217;t handle anything but ISO Latin-1 8-bit bytes. If you did, your code would not be portable to other character sets (and eventually you&nbsp;<em>will<\/em>&nbsp;be worrying about producing products for the rest of the world!).<\/p><\/blockquote>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Other_Classifications\"><\/span>Other Classifications<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">The set of stream classes is so large that there are also other ways you could classify them:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Data Source\/Sink streams<\/strong>&nbsp;&#8212; streams that write\/read data to\/from memory buffers, files, etc.<\/li><li><strong>Processing streams<\/strong>&nbsp;&#8212; streams that perform some kind of operation on the data as they read or write<ul><li>Buffering streams<\/li><li>Filtering streams<\/li><li>Conversion streams<\/li><li>etc.<\/li><\/ul><\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Character_Streams\"><\/span>Character Streams<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you wish to move&nbsp;<em>characters<\/em>&nbsp;or&nbsp;<em>strings<\/em>&nbsp;through a stream, then this is the set of classes you will need to use. If you try to use byte streams to move characters or strings, you&#8217;ll find that they don&#8217;t work properly with non-ISO-Latin-1 characters.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code><strong>java.io<\/strong><\/code>&nbsp;package contains the following set of c<em>haracter streams<\/em>, also known as&nbsp;<code><strong>Reader<\/strong><\/code>s and <strong>Writer<\/strong>s:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(Package&nbsp;<code><strong>java.io<\/strong><\/code>)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Object<strong>\n    Reader\n        BufferedReader\n            LineNumberReader\n        CharArrayReader\n        FilterReader\n            PushbackReader\n        InputStreamReader\n            FileReader\n        PipedReader\n        StringReader\n    Writer\n        BufferedWriter\n        CharArrayWriter\n        FilterWriter\n        OutputStreamWriter\n            FileWriter\n        PipedWriter\n        PrintWriter\n        StringWriter<\/strong><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Reader_Class\"><\/span>The Reader Class<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code><strong>Reader<\/strong><\/code>&nbsp;is the abstract base class (abstract superclass) of all input character streams. It provides the following methods:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Method<\/th><th>Description<\/th><\/tr><tr><td><code>public abstract void close() throws IOException<\/code><\/td><td>Close the stream. Once a stream has been closed, further&nbsp;<code>read()<\/code>,&nbsp;<code>ready()<\/code>,&nbsp;<code>mark()<\/code>, or&nbsp;<code>reset()<\/code>&nbsp;invocations will throw an&nbsp;<code>IOException<\/code>. Closing a previously-closed stream, however, has no effect.<\/td><\/tr><tr><td><code>public void mark(int readAheadLimit)<br>throws IOException<\/code><\/td><td>Mark the present position in the stream. Subsequent calls to&nbsp;<code>reset()<\/code>&nbsp;will attempt to reposition the stream to this point. Not all character-input streams support the&nbsp;<code>mark()<\/code>&nbsp;operation.<\/td><\/tr><tr><td><code>public boolean markSupported()<\/code><\/td><td>Tell whether this stream supports the&nbsp;<code>mark()<\/code>&nbsp;operation.<\/td><\/tr><tr><td><code>public int read(char[] cbuf) throws IOException<\/code><\/td><td>Read characters into an array. This method will block until some input is available, an I\/O error occurs, or the end of the stream is reached. Returns the number of bytes read, or&nbsp;<code>-1<\/code>&nbsp;if the end of the stream has been reached<\/td><\/tr><tr><td><code>public int read()<br>throws IOException<\/code><\/td><td>Read a single character. This method will block until a character is available, an I\/O error occurs, or the end of the stream is reached. Returns the character read, as an integer in the range&nbsp;<code>0<\/code>&nbsp;to&nbsp;<code>16383<\/code>&nbsp;(<code>0x00-0xffff<\/code>), or&nbsp;<code>-1<\/code>&nbsp;if the end of the stream has been reached<br>Subclasses that intend to support efficient single-character input should override this method.<\/td><\/tr><tr><td><code>public abstract int read(char[] cbuf, int off, int len)<br>throws IOException<\/code><\/td><td>Read characters into a portion of an array. This method will block until some input is available, an I\/O error occurs, or the end of the stream is reached. Returns the number of characters read, or&nbsp;<code>-1<\/code>&nbsp;if the end of the stream has been reached<\/td><\/tr><tr><td><code>public boolean ready() throws IOException<\/code><\/td><td>Tell whether this stream is ready to be read.<\/td><\/tr><tr><td><code>public void reset()<br>throws IOException<\/code><\/td><td>Reset the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the&nbsp;<code>reset()<\/code>&nbsp;operation, and some support&nbsp;<code>reset()<\/code>&nbsp;without supporting&nbsp;<code>mark()<\/code>.<\/td><\/tr><tr><td><code>public long skip(long n) throws IOException<\/code><\/td><td>Skip characters. This method will block until some characters are available, an I\/O error occurs, or the end of the stream is reached.<\/td><\/tr><tr><td><code>protected Object lock<\/code><\/td><td>The object used to synchronize operations on this stream. For efficiency, a character-stream object may use an object other than itself to protect critical sections. A subclass should therefore use the object in this field rather than this or a synchronized method.<\/td><\/tr><tr><td><code>protected Reader(Object lock)<\/code><\/td><td>Create a new character-stream reader whose critical sections will synchronize on the given object.<\/td><\/tr><tr><td><code>protected Reader()<\/code><\/td><td>Create a new character-stream reader whose critical sections will synchronize on the reader itself.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"The_Writer_Class\"><\/span>The Writer Class<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\"><code><strong>Writer<\/strong><\/code>&nbsp;is the base class (superclass) of all output character streams. It provides the following methods:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Method<\/th><th>Description<\/th><\/tr><tr><td><code>public abstract void close()<br>throws IOException<\/code><\/td><td>Close the stream, flushing it first. Once a stream has been closed, further&nbsp;<code>write()<\/code>&nbsp;or&nbsp;<code>flush()<\/code>&nbsp;invocations will cause an&nbsp;<code>IOException<\/code>&nbsp;to be thrown. Closing a previously-closed stream, however, has no effect.<\/td><\/tr><tr><td><code>public abstract void flush()<br>throws IOException<\/code><\/td><td>Flush the stream. If the stream has saved any characters from the various&nbsp;<code>write()<\/code>&nbsp;methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one&nbsp;<code>flush()<\/code>&nbsp;invocation will flush all the buffers in a chain of&nbsp;<code>Writer<\/code>s and&nbsp;<code>OutputStream<\/code>s.<\/td><\/tr><tr><td><code>public void write(String str) throws IOException<\/code><\/td><td>Write a string.<\/td><\/tr><tr><td><code>public void write(String str, int off, int len)<br>throws IOException<\/code><\/td><td>Write a portion of a string.<\/td><\/tr><tr><td><code>public void write(char[] cbuf)<br>throws IOException<\/code><\/td><td>Write an array of characters.<\/td><\/tr><tr><td><code>public abstract void write(char[] cbuf, int off, int len)<br>throws IOException<\/code><\/td><td>Write a portion of an array of characters.<\/td><\/tr><tr><td><code>public void write(int c)<br>throws IOException<\/code><\/td><td>Write a single character. The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.<br>Subclasses that intend to support efficient single-character output should override this method.<\/td><\/tr><tr><td><code>protected Object lock<\/code><\/td><td>The object used to synchronize operations on this stream. For efficiency, a character-stream object may use an object other than itself to protect critical sections. A subclass should therefore use the object in this field rather than this or a synchronized method.<\/td><\/tr><tr><td><code>protected Writer(Object lock)<\/code><\/td><td>Create a new character-stream writer whose critical sections will synchronize on the given object.<\/td><\/tr><tr><td><code>protected Writer()<\/code><\/td><td>Create a new character-stream writer whose critical sections will synchronize on the writer itself.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Data_SourceSink_Character_Streams\"><\/span>Data Source\/Sink Character Streams<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We can classify Data Source\/Sink character streams as follows:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th><strong>Data Source\/Sink<\/strong><\/th><th><strong>Readers<\/strong><\/th><th><strong>Writers<\/strong><\/th><\/tr><tr><td><strong>Memory<\/strong><\/td><td>CharArrayReader<br>StringReader<\/td><td>CharArrayWriter<br>StringWriter<\/td><\/tr><tr><td><strong>Pipe<\/strong><\/td><td>PipedReader<\/td><td>PipedWriter<\/td><\/tr><tr><td><strong>File<\/strong><\/td><td>FileReader<\/td><td>FileWriter<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Reading_from_and_Writing_to_a_File\"><\/span>Reading from and Writing to a File<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example of writing characters to a file, and reading them back:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\npublic class FileReadWrite\n{\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            \/\/ Write the file out\n            FileWriter writer = new FileWriter(&quot;groceries.lst&quot;);\n            for (int drink = 0; drink &lt; m_drinks.length; drink++)\n            {\n                writer.write(m_drinks&#x5B;drink] + &quot;\\n&quot;);\n            }\n            writer.close();\n            \n            \/\/ Read the file back in. and print its contents out\n            FileReader reader = new FileReader(&quot;groceries.lst&quot;);\n            String line = &quot;&quot;;\n            while (true)\n            {\n                int c = reader.read();\n                if (c == -1)\n                    break;\t\t\/\/ End of stream\n                if (c == &#039;\\n&#039;)\n                {\n                    System.out.println(line);\n                    line = &quot;&quot;;\t\t\/\/ Start fresh for next line\n                }\n                else\n                    line += (char)c;    \/\/ Must typecast\n            }\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n    \n    \/\/\/\/ Private data \/\/\/\/\n    private static final String&#x5B;] m_drinks =\n    {\n        &quot;Milk&quot;, &quot;Orange Juice&quot;, &quot;Beer&quot;, &quot;Wine&quot;\n    };\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The above code produces a file containing:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Milk \nOrange Juice \nBeer \nWine<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">and then outputs onto standard out:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Milk\nOrange Juice\nBeer\nWine<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Reading_from_and_Writing_to_a_String\"><\/span>Reading from and Writing to a String<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Notice how easy it is to change this to write to, and then read back from, a string buffer, by changing <code><strong>FileReader<\/strong><\/code> and <code><strong>FileWriter<\/strong><\/code> to <code><strong>StringReader<\/strong><\/code> and <code><strong>StringWriter<\/strong><\/code>, as in the following example?<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.StringReader;\nimport java.io.StringWriter;\nimport java.io.IOException;\n\npublic class StringReadWrite\n{\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            \/\/ Write out to the String buffer\n            StringWriter writer = new StringWriter();\n            for (int drink = 0; drink &lt; m_drinks.length; drink++)\n            {\n                writer.write(m_drinks&#x5B;drink] + &quot;\\n&quot;);\n            }\n            writer.close();\n            \n            \/\/ Read the file back in. and print its contents out\n            StringReader reader = new StringReader(writer.toString());\n            String line = &quot;&quot;;\n            while (true)\n            {\n                int c = reader.read();\n                if (c == -1)\n                    break;\t\t\/\/ End of stream\n                if (c == &#039;\\n&#039;)\n                {\n                    System.out.println(line);\n                    line = &quot;&quot;;\t\t\/\/ Start fresh for next line\n                }\n                else\n                    line += (char)c;    \/\/ Must typecast\n            }\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n    \n    \/\/\/\/ Private data \/\/\/\/\n    private static final String&#x5B;] m_drinks =\n    {\n        &quot;Milk&quot;, &quot;Orange Juice&quot;, &quot;Beer&quot;, &quot;Wine&quot;\n    };\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Essentially, the only things that changed were the specific <code><strong>Reader<\/strong><\/code> and <code><strong>Writer<\/strong><\/code> subclasses.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Processing_Character_Streams\"><\/span>Processing Character Streams<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The bare Data Source\/Sink streams are all very well and good, but they aren&#8217;t sufficient by themselves. There&#8217;s a set of&nbsp;<em>processing<\/em>&nbsp;character streams that add a lot of value to the family of streams.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s a table of <strong>Processing Character<\/strong> streams:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th><strong>Process<\/strong><\/th><th><strong>Readers<\/strong><\/th><th><strong>Writers<\/strong><\/th><\/tr><tr><td><strong>Buffering<\/strong><\/td><td><code>BufferedReader<\/code><\/td><td><code>BufferedWriter<\/code><\/td><\/tr><tr><td><strong>Filtering<\/strong><\/td><td><code>FilterReader<\/code><\/td><td><code>FilterWriter<\/code><\/td><\/tr><tr><td><strong>Conversion<\/strong><\/td><td><code>InputStreamReader<\/code><\/td><td><code>OutputStreamWriter<\/code><\/td><\/tr><tr><td><strong>Counting<\/strong><\/td><td><code>LineNumberReader<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><strong>Peeking Ahead<\/strong><\/td><td><code>PushbackReader<\/code><\/td><td>&nbsp;<\/td><\/tr><tr><td><strong>Printing<\/strong><\/td><td>&nbsp;<\/td><td><code>PrintWriter<\/code><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"BufferedReader_and_BufferedWriter\"><\/span>BufferedReader and BufferedWriter<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">These streams buffer data while reading or writing, which reduces the number of accesses required on the original data source\/sink. Buffered streams are in general more efficient &#8212; often&nbsp;<em>much<\/em>&nbsp;more efficient &#8212; than non-buffered streams, especially when reading from, or writing to, files.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"FilterReader_and_FilterWriter\"><\/span>FilterReader and FilterWriter<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">These are abstract classes that form a hierarchy of classes which perform a variety of filtering operations on data that is sent through them.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"InputStreamReader_and_OutputStreamWriter\"><\/span>InputStreamReader and OutputStreamWriter<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">These classes form a bridge between the byte streams and the character streams:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>An&nbsp;<code><strong>InputStreamReader<\/strong><\/code>&nbsp;reads bytes from an&nbsp;<code><strong>InputStream<\/strong><\/code>&nbsp;(or subclass thereof) and converts them to characters, using an appropriate character encoding. (This is particularly useful when reading from&nbsp;<code><strong>System.in<\/strong><\/code>, which is an&nbsp;<code><strong>InputStream<\/strong><\/code>.)<\/li><li>An&nbsp;<code><strong>OutputStreamWriter<\/strong><\/code>&nbsp;converts characters to bytes, using an appropriate character encoding, and writes the bytes to an <code><strong>OutputStream<\/strong><\/code> (or subclass thereof). (This is particularly useful when writing to&nbsp;<code><strong>System.out<\/strong><\/code>, or&nbsp;<code><strong>System.err<\/strong><\/code>, which are&nbsp;<code><strong>PrintStream<\/strong><\/code>s.)<\/li><\/ul>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"LineNumberReader\"><\/span>LineNumberReader<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">This class (a subclass of&nbsp;<code><strong>BufferedReader<\/strong><\/code>) is useful for keeping track of line numbers while reading.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PushbackReader\"><\/span>PushbackReader<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">This class (a subclass of&nbsp;<code><strong>FilterReader<\/strong><\/code>) allows you to &#8220;unread&#8221; character(s) that have been read from a stream. This is very useful in some applications (such as language parsers and similar tools) which find it useful to &#8220;peek ahead&#8221; in order to determine what to do next.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PrintWriter\"><\/span>PrintWriter<span class=\"ez-toc-section-end\"><\/span><\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">This class contains a number of convenient printing methods, such as&nbsp;<code><strong>print<\/strong><\/code>&nbsp;and&nbsp;<code><strong>println<\/strong><\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Wrapping_Streams_within_Streams\"><\/span>Wrapping Streams within Streams<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In order to use any one of the the above set of processing streams, you must wrap streams within other streams.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"464\" height=\"67\" src=\"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-content\/uploads\/2021\/01\/WrappedStreams.gif\" alt=\"\" class=\"wp-image-104\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:17px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You can wrap as many streams within streams as you wish, to accomplish your task. Here are some examples:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"An_Example\"><\/span>An Example<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example of how much difference using a\u00a0<code><strong>BufferedReader<\/strong><\/code>\u00a0can make. First, let&#8217;s take a simple, non-buffered approach to reading a file:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\npublic class FileRead\n{\n    \/**\n     *  This main method expects a single argument: a filename.\n     *  It will attempt to read the file, and print its contents.\n     *\/\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            long start = System.currentTimeMillis();\n            \/\/ Read a file in. and print its contents out\n            FileReader reader = new FileReader(args&#x5B;0]);\n            String line = &quot;&quot;;\n            while (true)\n            {\n                int c = reader.read();\n                if (c == -1)\n                    break;\t\t\/\/ End of stream\n                if (c == &#039;\\n&#039;)\n                {\n                    System.out.println(line);\n                    line = &quot;&quot;;          \/\/ Start fresh for next line\n                }\n                else\n                    line += (char)c;    \/\/ Must typecast\n            }\n            long end = System.currentTimeMillis();\n            System.out.println(&quot;Elapsed time = &quot; + \n\t\t\t  (end - start) + &quot; milliseconds&quot;);\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">When asked to read a file containing 10,000 lines, it produced (on my machine):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Elapsed time = 49381 milliseconds<\/strong><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or more than 49 seconds!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s see how much improvement we might get if we rewrite this to use a&nbsp;<code><strong>BufferedReader<\/strong><\/code>:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_a_BufferedReader\"><\/span>Using a BufferedReader<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\npublic class BufferedFileRead\n{\n    \/**\n     *  This main method expects a single argument: a filename.\n     *  It will attempt to read the file, and print its contents.\n     *\/\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            long start = System.currentTimeMillis();\n            \/\/ Read a file in. and print its contents out\n            BufferedReader reader = new BufferedReader(\n\t\t\t\tnew FileReader(args&#x5B;0]) );\n            String line = &quot;&quot;;\n            while (true)\n            {\n                int c = reader.read();\n                if (c == -1)\n                    break;\t\t\/\/ End of stream\n                if (c == &#039;\\n&#039;)\n                {\n                    System.out.println(line);\n                    line = &quot;&quot;;          \/\/ Start fresh for next line\n                }\n                else\n                    line += (char)c;    \/\/ Must typecast\n            }\n            long end = System.currentTimeMillis();\n            System.out.println(&quot;Elapsed time = &quot; + \n\t\t\t  (end - start) + &quot; milliseconds&quot;);\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">When I ran this on the same file, in the same environment, the above program output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Elapsed time = 24765 milliseconds<\/strong><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">or an improvement of&nbsp;<em><strong>about a factor of two<\/strong>&nbsp;<\/em>over the previous version!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, let&#8217;s see what kind of an improvement we can make if we use the entry points provided by the&nbsp;<code><strong>BufferedReader<\/strong><\/code>&nbsp;class:<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_BufferedReader_Entry_Points\"><\/span>Using BufferedReader Entry Points<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.BufferedReader;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\n\npublic class BufferedFileRead\n{\n    \/**\n     *  This main method expects a single argument: a filename.\n     *  It will attempt to read the file, and print its contents.\n     *\/\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            long start = System.currentTimeMillis();\n            \/\/ Read a file in. and print its contents out\n            BufferedReader reader = new BufferedReader(\n\t\t\t\t\tnew FileReader(args&#x5B;0]) );\n            String line = &quot;&quot;;\n            while (true)\n            {\n                line = reader.readLine();\n                if (line == null)\n                    break;\t\t\/\/ End of stream\n                System.out.println(line);\n            }\n            long end = System.currentTimeMillis();\n            System.out.println(&quot;Elapsed time = &quot; + \n\t\t\t  (end - start) + &quot; milliseconds&quot;);\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Not only does this look clearer, and is easier to write, but it also gives us the following result:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Elapsed time = 12458 milliseconds<\/strong><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which is now about&nbsp;<em><strong>4 times<\/strong><\/em>&nbsp;the speed of the original program.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Buffering_the_Output_too\"><\/span>Buffering the Output, too<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">What about buffering the output as well? Let&#8217;s try doing that:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; title: ; quick-code: false; notranslate\" title=\"\">\npackage inputOutput;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.FileReader;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\n\npublic class DoubleBufferedFileRead\n{\n    \/**\n     *  This main method expects a single argument: a filename.\n     *  It will attempt to read the file, and print its contents.\n     *\/\n    public static void main(String&#x5B;] args)\n    {\n        try\n        {\n            long start = System.currentTimeMillis();\n            \/\/ Read a file in. and print its contents out\n            BufferedReader reader = new BufferedReader(\n\t\t\t\t\tnew FileReader(args&#x5B;0]) );\n            PrintWriter writer = new PrintWriter( \n                                        new BufferedWriter(\n                                            new OutputStreamWriter(\n\t\t\t\t\tSystem.out)));\n            String line = &quot;&quot;;\n            while (true)\n            {\n                line = reader.readLine();\n                if (line == null)\n                    break;\t\t\/\/ End of stream\n                writer.println(line);\n            }\n            long end = System.currentTimeMillis();\n            System.out.println(&quot;Elapsed time = &quot; + \n\t\t\t  (end - start) + &quot; milliseconds&quot;);\n        }\n        catch (IOException e)\n        {\n            e.printStackTrace();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">This resulted in:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Elapsed time = 12338 milliseconds<\/strong><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which is only slightly better than the previous version (effectively, it&#8217;s the same). This probably means that buffering the console output isn&#8217;t going to make much difference. However, buffering output to a file&nbsp;<em><strong><u>is<\/u><\/strong><\/em>&nbsp;very likely to make a substantial difference in performance.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Streams &amp; Stream Classification What is a Stream? A stream is a very useful abstraction that exists in a number of environments. A stream conceptually has: A source A &#8220;sink&#8221; (a destination) A flow of data from the source to the destination For example: The UNIX operating system has the concept of streams of data [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":67,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","ocean_front_end_style_editor":"no","ocean_post_layout":"left-sidebar","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"ocs-course-topics-sidebar","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","footnotes":""},"class_list":["post-85","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/pages\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":11,"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/pages\/85\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/pages\/85\/revisions\/107"}],"up":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/pages\/67"}],"wp:attachment":[{"href":"https:\/\/bhiggs.x10hosting.com\/HighOctaneJava\/wp-json\/wp\/v2\/media?parent=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}