DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: java networking

  1. #1
    tejkumar Guest

    java networking


    how can i write a program in java to achive ftp with out using any packages
    that are developed by third parties.


    can we convert a class file in source file if so how.



  2. #2
    Kandasamy Guest

    Re: java networking


    Hi,

    The code works to transfer files in ascii mode.

    ------

    import java.io.*;
    import java.net.*;
    import java.util.*;

    public class jftp {

    private String fileName;
    private File inFile;
    private File outFile;
    private String line_1;


    public jftp(String source, String dest ) {
    inFile=new File(source);
    outFile = new File(dest);
    }

    public void ftpNow(){

    BufferedReader binReader =null;



    try {
    binReader = new BufferedReader( new FileReader(inFile));
    PrintWriter pw = new PrintWriter( new BufferedWriter
    ( new FileWriter(outFile)));

    while ( (line_1=binReader.readLine()) != null ) {
    pw.println(line_1);
    }
    pw.flush();
    pw.close();
    binReader.close();
    } catch(IOException ioe) {
    System.out.println("IOException : " + ioe.getMessage());
    }
    finally{
    System.out.println("File Copied Successfully");
    }


    }

    }

    ********* End *********









    "tejkumar" <tejmail@rediffmail.com> wrote:
    >
    >how can i write a program in java to achive ftp with out using any packages
    >that are developed by third parties.
    >
    >
    >can we convert a class file in source file if so how.
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links