| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
I am building a class that handles files. When I call copySelfWithInit("path/to/folder/") and then renameSelf("boo.pdf") the file disappears. However, if I call renameSelf("boo.tif") and then copySelfWithInit("path/to/folder/") it works. Perhaps the copy is not really complete? Thanks in advance for help. I'm a newbie so any comments are welcome. import java.io.*; public class mainMethod { public static void main(String args[]) throws Exception { // this works... Item item = new Item("/Users/kevin/Desktop/BOS70085_2up.pdf"); item.renameSelf("boo.pdf"); item.copySelfWithInit(new File("/Users/kevin/Desktop/Fonts/")); //this causes file to disappear... Item item = new Item("/Users/kevin/Desktop/BOS70085_2up.pdf"); item.copySelfWithInit(new File("/Users/kevin/Desktop/Fonts/")); item.renameSelf("boo.pdf"); } } ------------------------------------------------- import java.io.*; public class Item { private File file; public Item(String itemPath) { file = new File(itemPath); } // end Item(); public void renameSelf(String n) { File t = new File(file.getParent() + "/" + n); file.renameTo(new File(n)); file = t; } // end renameSelf() public void copySelfWithInit( File dest) throws IOException { File newFile = new File(dest.getPath() + "/" + file.getName()); CopyFile cp = new CopyFile(file, newFile); cp.copy(); file = newFile; } // end copySelf() } -- Kevin Muldoon, Owner TrueBlueDot - Fine Art Printing New Haven, CT 06511 www.truebluedot.com "Our pigment meets your imagination" |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.