@@ -0,0 +1,1702 @@
+package com.readlearncode.streaming.extra;%0A%0Aimport javax.json.Json;%0Aimport javax.json.stream.JsonParser;%0Aimport java.io.*;%0A%0Aimport static javax.json.stream.JsonParser.Event.KEY_NAME;%0Aimport static javax.json.stream.JsonParser.Event.VALUE_NUMBER;%0Aimport static javax.json.stream.JsonParser.Event.VALUE_STRING;%0A%0A/**%0A * Source code github.com/readlearncode%0A *%0A * @author Alex Theedom www.readlearncode.com%0A * @version 1.0%0A */%0Apublic class StreamingSample4 %7B%0A%0A    private static PipedInputStream inputStream;%0A    private static PipedOutputStream outputStream;%0A%0A%0A    public static void main(String... args) throws IOException, InterruptedException %7B%0A%0A        outputStream = new PipedOutputStream();%0A        inputStream = new PipedInputStream(outputStream);%0A%0A        Thread thread1 = new Thread(() -%3E %7B%0A            try %7B%0A                outputStream.write(%22%7B%22.getBytes());%0A                while(true) %7B%0A                    outputStream.write(%22%5C%22colour%5C%22:%5C%22red%5C%22,%22.getBytes());%0A                %7D%0A%0A            %7D catch (IOException e) %7B%0A                e.printStackTrace();%0A            %7D%0A%0A        %7D);%0A%0A%0A%0A        Thread thread2 = new Thread(() -%3E %7B%0A%0A                JsonParser parser = Json.createParser(inputStream);%0A%0A                while (parser.hasNext()) %7B%0A                    JsonParser.Event event = parser.next();%0A                    System.out.println(event.toString());%0A                    if (event == KEY_NAME %7C%7C event == VALUE_STRING %7C%7C event == VALUE_NUMBER) %7B%0A                        System.out.println(parser.getString());%0A                    %7D%0A                %7D%0A            parser.close();%0A%0A        %7D);%0A%0A        thread1.start();%0A%0A        Thread.sleep(5000);%0A%0A        thread2.start();%0A%0A    %7D%0A%0A%0A%0A%7D

Add StreamingExample4