// // read from file, echo to standard output // replace new lines with spaces // // uses raw FileInputStream // import java.io.FileInputStream; import java.io.InputStream; import java.io.IOException; public class RemoveReturns { public static void main( String [] args ) throws IOException { InputStream source = new FileInputStream( args[0] ); int nextCharacter; while ( true ) { nextCharacter = source.read(); if ( nextCharacter == -1 ) break; if ( nextCharacter == '\n' ) System.out.print( ' ' ); else System.out.print( (char) nextCharacter ); } } }