File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT / JFace and the fly likes Copying JPEG from one file to another? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "Copying JPEG from one file to another?" Watch "Copying JPEG from one file to another?" New topic
Author

Copying JPEG from one file to another?

Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Hi all,
Can someone kindly point me in the correct direction? I need to copy a JPEG from one file folder to another. It seems so basic, but yet, I can't get it going.
Thanks in advance!!
Brian
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4120

First you click on the 'My Computer' icon up in the corner of your screen, open up the folder the JPEG file is stored in, and then drag the file.... Oh, wait... you mean in Java...



HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Thanks Nate!!!
That did the trick.
I like your joke....it was quite amusing.
Regards,
Brian
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Hi Nate or whomever else.....
I am now able to successfully copy a JPEG file from one filefolder to another....BUT......
The only problem is that it is SLOW!!! I put the code used to copy the file into a thread figuring it shouldn't take away from CPU time, but I still find that the program must wait until the copying is done before the user can do something else.
Any ideas on increasing speed??? Many thanks in adbance.
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

This is faster. I had the same problem. This should fix it. Replace your code with:


------------------
Happy Coding,
Gregg Bolinger


My Blog | DZone Articles
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Thanks Gregg..
That did make a big difference. There's still some delay, but not as much as before. Good tip. I hope to return the favor.
Brian
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
I'm back looking for another answer. I have 225 JPEG's that need to be copied. Using the above code takes about 5 MINUTES or more to do the job. When using My Computer in Windows it takes less than 1 minute.
There has to be an easier way.
I have used
That is quick. The only problem is that the old file obviously
gets removed. How do I 'copy' and not just 'cut and paste' my JPEGS?
Many thanks in advance!
gautham kasinath
Ranch Hand

Joined: Dec 01, 2000
Posts: 583
Hi!
Well have you tried to read the file by a kb??
Read instead of one byte each time the loop executes.. try reading a KB.. 1024 bytes..
that helps in speed coz it helped me on my winnt 4.0 ws
Regds
Gautham Kasinath


"In the country of the blind, the one eyed man is the King"
Gautham Kasinath CV at : http://www.geocities.com/gkasinath
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

Could you show a code sample of that? Sounds like a dandy idea.

------------------
Happy Coding,
Gregg Bolinger
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Hi Gautham,
Thanks for your reply. Does copying more than one byte at a time lose picture quality? Could you send me some code as well with your example so I can try it out?
Many thanks in advance.
snydb@home.com
 
 
subject: Copying JPEG from one file to another?
 
Threads others viewed
save and load JPEG image from disk
Binary data via XML
Make a file from bunch of files and then retrieve
How to create an Image
overlay jpeg with text
IntelliJ Java IDE