The Artima Developer Community
Sponsored Link

Java Answers Forum
Creating File In Java

1 reply on 1 page. Most recent reply: Oct 26, 2004 2:58 AM by Matthias Neumair

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 1 reply on 1 page
Muhammad Zaman

Posts: 3
Nickname: mzamanm
Registered: Oct, 2004

Creating File In Java Posted: Oct 25, 2004 1:30 PM
Reply to this message Reply
Advertisement
Can someone please guide me to create a file in java.And Please Tell me about making a copy of a file in java.i.e,song having mp3 extension.
Thanx


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Creating File In Java Posted: Oct 26, 2004 2:58 AM
Reply to this message Reply
Creating a file is easy:

This is one way to do it.

java.io.File file = new java.io.File ("c:\\filename");
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, false)));
out.close();

Then again , there's allways the createTempFile method.


To copy a file I would use the operating systems commands.
I don't know if there's a better way to do it.

Flat View: This topic has 1 reply on 1 page
Topic: objects in java Previous Topic   Next Topic Topic: EJB_que

Sponsored Links



Google
  Web Artima.com   

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