I tried removing the while loop, but now it doesn't print anything to the file
Code:
public class scrapeSite
{
public static FileOutputStream Output;
public static PrintStream file;
public static String line;
public static void main( String[] args )
{
try
{
BufferedReader br;
BufferedWriter bw;
Socket s = new Socket( "www.yahoo.com", 80 );
br = new BufferedReader( new InputStreamReader( s.getInputStream() ));
bw = new BufferedWriter( new OutputStreamWriter( s.getOutputStream() ));
bw.write( "GET / HTTP/1.0\n\n" );
bw.flush();
Output = new FileOutputStream("myfile.txt");
file = new PrintStream(Output);
file.println (line);
}
catch( IOException e ) // catch any errors
{
System.out.println( "There was an IOException error!" );
}
}
}
I've tried every combination...moving the file/Output lines all over.
What am I not doing right (besides everything)?
~YC