{"id":1763,"date":"2014-12-27T20:23:58","date_gmt":"2014-12-27T19:23:58","guid":{"rendered":"http:\/\/www.jensd.de\/wordpress\/?p=1763"},"modified":"2014-12-27T20:23:58","modified_gmt":"2014-12-27T19:23:58","slug":"shichimifx-1-0-3-released","status":"publish","type":"post","link":"https:\/\/www.jensd.de\/wordpress\/?p=1763","title":{"rendered":"ShichimiFX 1.0.3 released"},"content":{"rendered":"<p>I have released ShichimiFX 1.0.3.<\/p>\n<p>Get the code from my <a title=\"Bitbucket Repo\" href=\"https:\/\/bitbucket.org\/Jerady\/shichimifx\" target=\"_blank\">ShichimiFX Bitbucket Repo<\/a><\/p>\n<p><strong>Maven<\/strong><br \/>\n[xml]<br \/>\n<dependency><br \/>\n  <groupId>de.jensd<\/groupId><br \/>\n  <artifactId>shichimifx<\/artifactId><br \/>\n  <version>1.0.3<\/version><br \/>\n<\/dependency><br \/>\n[\/xml]<\/p>\n<p>This release mostly focuses on the ConsoleStream. I have fixed some performance issues. Also optionally now an alternate stream can be given, e.g. to pass through System.out.<br \/>\nThis is used for displaying the logging stream in my <a href=\"http:\/\/www.jensd.de\/wordpress\/?p=1755\" title=\"MQTT.fx 0.0.12 released\">lastest release of MQTT.fx<\/a>.<\/p>\n<p><a href=\"http:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1.jpg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"1753\" data-permalink=\"https:\/\/www.jensd.de\/wordpress\/?attachment_id=1753\" data-orig-file=\"https:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1.jpg\" data-orig-size=\"1024,762\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}\" data-image-title=\"mqttfx-log-tab\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1-300x223.jpg\" data-large-file=\"https:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1-1024x762.jpg\" tabindex=\"0\" role=\"button\" src=\"http:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1-1024x762.jpg\" alt=\"mqttfx-log-tab\" width=\"688\" height=\"512\" class=\"aligncenter size-large wp-image-1753\" srcset=\"https:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1.jpg 1024w, https:\/\/www.jensd.de\/wordpress\/wp-content\/uploads\/2014\/12\/mqttfx-log-tab1-300x223.jpg 300w\" sizes=\"(max-width: 688px) 100vw, 688px\" \/><\/a><\/p>\n<p>[java]<br \/>\npublic class ConsoleDude {<\/p>\n<p>    public final static PrintStream STD_OUT = System.out;<br \/>\n    public final static PrintStream STD_ERR = System.err;<br \/>\n    private static BooleanProperty stdStreamsHooked = new SimpleBooleanProperty();<\/p>\n<p>    public static void hookStdStreams(TextInputControl outputArea) {<br \/>\n        PrintStream psOut = new PrintStream(new ConsoleStream(outputArea, System.out), true);<br \/>\n        System.setOut(psOut);<br \/>\n        PrintStream psErr = new PrintStream(new ConsoleStream(outputArea, System.err), true);<br \/>\n        System.setOut(psErr);<br \/>\n        stdStreamsHookedProperty().set(true);<br \/>\n    }<\/p>\n<p>    public static void restoreStdStreams() {<br \/>\n        System.setOut(STD_OUT);<br \/>\n        System.setErr(STD_ERR);<br \/>\n        stdStreamsHookedProperty().set(false);<br \/>\n    }<\/p>\n<p>    public static BooleanProperty stdStreamsHookedProperty() {<br \/>\n        if (stdStreamsHooked == null) {<br \/>\n            stdStreamsHooked = new SimpleBooleanProperty();<br \/>\n        }<br \/>\n        return stdStreamsHooked;<br \/>\n    }<\/p>\n<p>    public boolean isHooked() {<br \/>\n        return stdStreamsHookedProperty().get();<br \/>\n    }<\/p>\n<p>    public static ConsoleStreamHandler createConsoleStreamHandler(TextInputControl outputArea) {<br \/>\n        return createConsoleStreamHandler(outputArea, new SimpleFormatter());<br \/>\n    }<\/p>\n<p>    public static ConsoleStreamHandler createConsoleStreamHandler(TextInputControl outputArea, Formatter formatter) {<br \/>\n        return new ConsoleStreamHandler(new ConsoleStream(outputArea), formatter);<br \/>\n    }<\/p>\n<p>}<br \/>\n[\/java]<\/p>\n<p>[java]<br \/>\npublic class ConsoleStream extends ByteArrayOutputStream {<\/p>\n<p>    private final TextInputControl textOutputComponent;<br \/>\n    private final StringBuilder buffer;<br \/>\n    private final String EOL = System.getProperty(&#8220;line.separator&#8221;);<br \/>\n    private final PrintStream printStream;<\/p>\n<p>    public ConsoleStream(TextInputControl ta) {<br \/>\n        this(ta, null);<br \/>\n    }<\/p>\n<p>    public ConsoleStream(TextInputControl ta, PrintStream printStream) {<br \/>\n        this.textOutputComponent = ta;<br \/>\n        this.printStream = printStream;<br \/>\n        buffer = new StringBuilder(80);<br \/>\n    }<\/p>\n<p>    @Override<br \/>\n    public void flush() throws IOException {<br \/>\n        String text = toString();<br \/>\n        if (text.length() == 0) {<br \/>\n            return;<br \/>\n        }<br \/>\n        append(text);<br \/>\n        reset();<br \/>\n    }<\/p>\n<p>    private void append(String text) {<br \/>\n        if (textOutputComponent.getLength() == 0) {<br \/>\n            buffer.setLength(0);<br \/>\n        }<br \/>\n        if (EOL.equals(text)) {<br \/>\n            buffer.append(text);<br \/>\n        } else {<br \/>\n            buffer.append(text);<br \/>\n            clearBuffer();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    private void clearBuffer() {<br \/>\n        String line = buffer.toString();<br \/>\n        Platform.runLater(() -> {<br \/>\n            textOutputComponent.appendText(line);<br \/>\n        });<br \/>\n        if (printStream != null) {<br \/>\n            printStream.print(line);<br \/>\n        }<br \/>\n        buffer.setLength(0);<br \/>\n    }<\/p>\n<p>}<br \/>\n[\/java]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have released ShichimiFX 1.0.3. Get the code from my ShichimiFX Bitbucket Repo Maven [xml] de.jensd shichimifx 1.0.3 [\/xml] This release mostly focuses on the ConsoleStream. I have fixed some performance issues. Also optionally now an alternate stream can be given, e.g. to pass through System.out. This is used for displaying the logging stream in&hellip; <span class=\"clear\"><\/span><a href=\"https:\/\/www.jensd.de\/wordpress\/?p=1763\" class=\"more-link read-more\" rel=\"bookmark\">Continue Reading <span class=\"screen-reader-text\">ShichimiFX 1.0.3 released<\/span><i class=\"fa fa-arrow-right\"><\/i><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"footnotes":"","_jetpack_memberships_contains_paid_content":false,"jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[12,52,9,4,49],"tags":[77,108,80,76,63,105],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p38FCL-sr","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1763"}],"collection":[{"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1763"}],"version-history":[{"count":7,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1763\/revisions"}],"predecessor-version":[{"id":1787,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1763\/revisions\/1787"}],"wp:attachment":[{"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jensd.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}