The Artima Developer Community
Sponsored Link

Java Answers Forum
Writing files in Java additional question

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Bruce Jacobs

Posts: 4
Nickname: comet304
Registered: Apr, 2003

Writing files in Java additional question Posted: Apr 15, 2003 8:53 AM
Reply to this message Reply
Advertisement
That worked thanks alot. Another question, I need to carry over the last modified date from the from file and update the last modified date in the to file. How can I do that?

I tried doing this but it did not work. nfd is the input file, opf is the output. I need the last modify date on the from file to carry over when it is written to the new file.

if (returnFlag.equals("Y"))
{
File opf = new File(subDirName + "\\" + fCurrent.getName());
opf.setLastModified(nfd.lastModified());
FileOutputStream fos = new FileOutputStream(opf);
//File opf = new File(subDirName + "\\" + fCurrent.getName());

FileWriter fw = new FileWriter(opf);
while ((bytes_read = fis.read(buffer)) != -1)
fos.write(buffer, 0, bytes_read);
fis.close();
fos.close();
count++;

Topic: CLIENT SERVER PROBLEM Previous Topic   Next Topic Topic: PLEASE HELP ME:JAVA VIRTUAL MACHINE

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use