forked from wesleyegberto/java-new-features
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPipeStreamTest.java
More file actions
21 lines (16 loc) · 560 Bytes
/
PipeStreamTest.java
File metadata and controls
21 lines (16 loc) · 560 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.github.wesleyegberto.api.io;
import java.io.*;
public class PipeStreamTest {
public static void main(String[] args) throws Exception {
var writer = new StringWriter();
var inputPipe = new PipedInputStream();
var inputBuffed = new BufferedInputStream(inputPipe);
var outputPipe = new PipedOutputStream(inputPipe);
var outputBuffered = new BufferedOutputStream(outputPipe);
var w = new PrintWriter(outputBuffered);
w.write("Hello Bug");
w.flush();
w.close();
System.out.println(new String(inputBuffed.readAllBytes()));
}
}