package com.mindprod.example;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import static java.lang.System.*;
/**
* Program to help test exec. It just echoes in System.in input on out.
* <p/>
* I don't think it has any practical application.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2009-04-07 initial version
* @since 2009-04-07
*/
public class Boomerang
{
/**
* e.g. \n \r\n or \r, whatever system uses to separate lines in a text file. Only used inside multiline fields. The
* file itself should use Windows format \r \n, though \n by itself will also work.
*/
private static final String lineSeparator = System.getProperty( "line.separator" );
/**
* echo System.in to out. On EOF shut down.
*
* @param args not used
*
* @throws java.io.IOException if trouble setting up reader/writer
*/
public static void main( String[] args ) throws IOException
{
final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ),
50
);
final OutputStreamWriter osw = new OutputStreamWriter( out );
String line;
while ( ( line = br.readLine() ) != null )
{
osw.write( line );
osw.write( lineSeparator );
}
br.close();
osw.close();
}
}