I get confused with writers, streams, buffered ...
Here's what I'm trying to do.
/// Simulate a paste into the inputStream.
String s = 'This is a line'
BufferedWriter out = new BufferedWriter( new OutputStreamWriter(System.in ));
out.apped( s);
Then later on:
// Now read from the input stream.
BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) );
s = in.readline();
What am I missing?
I understand that the above code doesn't work. I'm trying to figure out how to do the intent of the above code. I am trying to paste into the inputstream. I have an application that is waiting for user input, from inside the program I would like to paste a string, just like the user would paste a string, so that the input stream would read it. I'm not sure how to make this more clear.
Can someone please help? Maybe I haven't been clear. I have an interactive program that is run in UNIX from the command line. No graphics. I want to simulate a pasted string into the inputStream programmatically? The above examples are only the intent of what I want - THEY DON'T WORK. More detail.
The user runs my program. At a prompt, he cuts an item from another terminal window and pastes it into the input stream of my program. This appears to my program like he just typed a bunch of lines from the keyboard.
I want to from inside of my program "paste" to the input stream, so that items appear like they are coming from the user.