| Author |
FileChannel class
|
Sue Nair
Greenhorn
Joined: Jan 28, 2008
Posts: 6
|
|
I am trying to finish up a homework assignment and I am having a little bit of trouble. I am using the FileChannel class to copy input from one file to another. My program will compile but I am not for sure what else to do? I think my problem is in creating a file to be copied. I have created a folder sDir and put in a file.Is this all I need to do? I am not for sure how to have my program create the tDir and copy the contents of sDir. Could someone please look at my code and help me? Thanks [ February 24, 2008: Message edited by: Jim Yingst ]
|
 |
Balasubramanian Chandrasekaran
Ranch Hand
Joined: Nov 28, 2007
Posts: 215
|
|
|
Have you tried your code.It looks like the code you have written does what you need.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
I think you have made a logical mistake here, which happens to be solved by a syntactical mistake. You should add a ! before targetDir - you want to create the folder if it doesn't exist, not if it already exists. Now your code still works because of the ; right after the if. Right now, your code is equal to this: So if you add the ! and remove the ; you should be fine:
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Sue Nair
Greenhorn
Joined: Jan 28, 2008
Posts: 6
|
|
|
Thank you! It does work now.
|
 |
 |
|
|
subject: FileChannel class
|
|
|