New Member FAQ | Forums | Earn Revenue | Distance Education | Help Topics | Admissions 2013
Awards & Gifts
 
Login Login    Register      

ArticlesPractice TestsAsk ExpertsQuestion PapersJobsUniversitiesCollegesCoursesSchools

Active Members
TodayLast 7 Daysmore...

Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Articles/Knowledge Sharing » Computer & Technology

Java Program-Copy file program


Posted Date:     Category: Computer & Technology    
Author: Member Level: Diamond    Points: 2



 

import java.io.*;

public class copyfile
{
public static void main(String args[])
{
try
{
FileInputStream fin;
FileOutputStream fout;
int i;
String source=args[0];
String target=args[1];
fin=new FileInputStream(source);
fout=new FileOutputStream(target);
do
{
i=fin.read();
if(i!=-1)
{
fout.write(i);
}
}
while(i!=-1);

fin.close();
fout.close();
}

catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("format is : java file copy source target");
}
catch(FileNotFoundException e)
{
System.out.println("can not open file");
}
catch(IOException e)
{
System.out.println("can not read from file");
}
}
}





Did you like this resource? Share it with your friends and show your love!





Responses to "Java Program-Copy file program"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Java Program-Construtor overridding
    Previous Resource: Java Program-Sort contents file
    Return to Resources
    Post New Resource
    Category: Computer & Technology


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Java Program  .  

    Subscribe to Email
  • Get Jobs by Email
  • Forum posts by Email
  • Articles by Email
  • Online MembersVineeta Sinha
    Himanshu Rawat
    jatin
    Ritu Agarwal
    Ramprasad
    ARJUN
    gaurav aneja
    pawan
    udayasaran
    Lakshmi Narayan
    J KALIDAS
    More...


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    AdSense Revenue Sharing sites   Advertise   Talk to Tony John
    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.