/* * Copyright (C) 2021 eichehome * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package server; import java.io.IOException; import java.io.PipedReader; import java.io.PipedWriter; /** * * @author eichehome */ public class PipeTest { public static void main(String[] args) { /*FifoPipe pipe = new FifoPipe(); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement); Element el = new Element("Test"); pipe.queuElement(el); System.out.println("Angehängt"); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement); System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData()); System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData()); Element el2 = new Element("Test2"); pipe.queuElement(el2); System.out.println("Angehängt2"); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement); System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData()); System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData()); PipeElement pipeElement = pipe.getNextElement(); System.out.println("Oben entnommen"); System.out.println("Entnommen Inhalt: " + pipeElement.getData().gebeData()); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement); System.out.println("Erstes Element Inhalt: " + pipe.firstElement.getData().gebeData()); System.out.println("Letztes Element Inhalt: " + pipe.lastElement.getData().gebeData()); PipeElement pipeElement2 = pipe.getNextElement(); System.out.println("Oben entnommen2"); System.out.println("Entnommen Inhalt: " + pipeElement2.getData().gebeData()); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement); //Wieso wills nicht funktionieren? PipeElement pipeElement3 = pipe.getNextElement(); System.out.println("Oben entnommen3"); //System.out.println(pipeElement3.getData().gebeData()); System.out.println("Erstes Element: " + pipe.firstElement); System.out.println("Letztes Element: " + pipe.lastElement);*/ ArrayHelper test = new ArrayHelper(); test.pushThread("Test1"); test.pushThread("Test2"); test.pushThread("Test3"); System.out.println(test.messages[0]); System.out.println(test.messages[1]); System.out.println(test.messages[2]); System.out.println(test.popThread("Test2")); PipedWriter pipedWriter1 = new PipedWriter(); PipedWriter pipedWriter2 = new PipedWriter(); PipedReader pipedReader = new PipedReader(); try { pipedWriter1.connect(pipedReader); } catch (IOException ex) { System.out.println("1: " + ex); } try { pipedWriter2.connect(pipedReader); } catch (IOException ex) { System.out.println("2: " + ex); } pipedWriter2 = pipedWriter1; pipedWriter2.write("Test"); pipedWriter2.flush(); String test; while ((test = pipedReader.readline())) } }