Reputation: 4193
My program has to copy file from one folder to another folder. I have used InputStream and OutputStream to do he same. The file size is about 5GB. what are all the possible exception may occur during this process and how?. As i need mention the same in unit testcase document...Please help.
Upvotes: 0
Views: 655
Reputation: 29539
As a general rule, checked exceptions don't pop out of thin air. They are explicitly declared to be thrown by the methods you use (check the Java API). A good IDE (e.g. NetBeans) would even automatically prompt you to catch or declare these exceptions whenever you encounter them. Besides, you wouldn't even be able to compile your code if you didn't handle these exceptions. You have been documenting all these exceptions with Javadoc right? =)
Upvotes: 0
Reputation: 14225
Also consider using NIO for file copying, as it is likely that you'll get better performance which should be noticable with such a large file:
Take a look at this post from JavaLobby, which shows a static file copy method using java.io.FileChannel
s to do the grunt work.
Upvotes: 1
Reputation: 44053
Look at the java docs for the methods you are using. Any Sun Java docs will mention exceptions that can be thrown by methods.
I am guessing FileNotFoundException, NullPointerException, IOException.
Upvotes: 3