Greetings!!

In my builder object I am trying to dynamically create  a file on the server. 
However, I keep on getting  a I/O error: No such file or directory

The following is my code snippet:
.
.
.
.

if (httpConn.getResponseCode() == httpConn.HTTP_OK) {
                                                        
   //Get a character input stream for the URL
BufferedInputStream in = new BufferedInputStream(httpConn.getInputStream());           
                                                                                       
                                                                     
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                                                        
   File file = new File (path);

   //creates a file if and only if a file with that name does not exist
   file.createNewFile();

   //Creates the stream for the output file
PrintWriter writer = new PrintWriter(new BufferedWriter( new 
FileWriter(file))); 
                                                      
String line;
   while ((line = reader.readLine()) != null) {
      //writes the content to a file
      writer.println(line);
    }
    reader.close();
    writer.close();
}

.
Is there a better way of writing this?

Curtney

Reply via email to