I am in horry please if some one can help me with my FTP code, thanks

import java.io.*;
import java.net.*;
import java.util.*;
public class Ass_2 {
     public static void main(String[] args){
          String currentPath = new String(); currentPath = "ftp://ftp.scit.wlv.ac.uk/pub";
          try {
               BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
               String str,user,pass ;
               System.out.println("\n\nTYPE HELP for view the list of commands and there Formats!!");
               System.out.println("enter command 'bye' to exit the application");
                    System.out.print("Enter Username: ");
                    user = in.readLine();     
                    System.out.print("Enter Password: ");
                    pass = in.readLine();
                    String tempPath = new String();
                    String toFile = new String();
                    tempPath = currentPath ;
                    readPage(currentPath);
               while (!(str = in.readLine()).equals("bye")){     
                    int     tokencount;
                    StringTokenizer     token = new StringTokenizer(str);
                    tokencount = token.countTokens();
                    String block[] = new String[tokencount];
                    for (int i = 0; i < tokencount; i++)
                         block[i] = token.nextToken();
                         System.out.println(block);
                    if (block[0].equalsIgnoreCase("dir")){
                         System.out.println("DIR");
                         System.out.println(currentPath);
                         readPage(currentPath);
                         System.out.println("\n");
                    }else if(block[0].equalsIgnoreCase("cwd")){
                         System.out.println("Change Directory");
                         currentPath = changeDirectory(currentPath, block[1]);
                         System.out.println("\n");
                    }else if(block[0].equalsIgnoreCase("get")){
                         System.out.println("Wait Copying File : "+block[1]);
                         copyFile(currentPath,block[1]);
                    }else if(block[0].equalsIgnoreCase("cd..")){
                         currentPath = goBack(currentPath);               
                    }else if(block[0].equalsIgnoreCase("help")){
                         System.out.println("\nYour in the Help Section \n");
                    }else {
                         System.out.println("Wrong Command or Format, Type Help!!!");
                         System.out.println("\n");
          catch(Exception e){
               System.out.println(e);
     // Function to read content form the specfied path
     static void readPage(String path){
          String tempPath = new String();
          try {     
               URL     pageref = new URL(path);
               InputStream in = pageref.openStream();
               BufferedReader inline = new BufferedReader(new InputStreamReader(in));//(instr);
               String     line;
               int     linect = 0;
               while((line = inline.readLine())!=null){
                    linect++;
                    System.out.println(line);
               System.out.println("lines read = "+linect);
          catch(Exception e){
               System.out.println(e);
     static String changeDirectory(String path,String dir){
          path = path+"/"+dir;//System.out.println(">>>>>>>>>>> " path" >>> \n");
          readPage(path);     
          return path;
     // Function to go one setp back from the current directory
     static String goBack(String currentPath){
          return currentPath;
     /// Function for basic copy TXT file
     static void copyFile(String path,String file){
          try {
               path = path +"/"+ file;     //System.out.println("Copy Path : " + path);
               String fileName = new String();
                    fileName = file+".txt";
                    System.out.println("Out put file name : " + fileName);
               OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(fileName));
               URL     pageref = new URL(path);
               InputStream in = pageref.openStream();
               BufferedReader inline = new BufferedReader(new InputStreamReader(in));//(instr);
               String     line;
               int     linect = 0;
               while((line = inline.readLine())!=null){
                    System.out.println(line);
                    linect++; //System.out.println(line);
                    out.write(line+"\r\n");
               out.close();               
               System.out.println("File - " file " - copyed Successfully !!");
          catch(Exception e){
               System.out.println(e);

h2. {color:#ff0000}Double post{color}
Replies here:
http://forum.java.sun.com/thread.jspa?threadID=5253627
It's rude to double post.
It's futile (at best) to advertise your time pressure.
It's pointless to use a forum like this but not actually ask a question.

Similar Messages

  • Some one can help me with Properties()

    hi, i try and i try to reasign one group of final static var, and i cant, so i see can i use the Properties() class to reasign one final static var.
    import java.util.Properties;
    Public class Config extends Object{
    static final int EMITIDO;
    static final int PAGADO;
    static final int ENVIADO;
    static final int SOLUCIONADO
    public void Config(){
    Properties defaultProps = new Properties();
    try{
    defaultProps.setProperty("my_new_emitido","2");
    defaultProps.setProperty("my_new_pagado","3");
    defaultProps.setProperty("my_new_enviado","4");
    defaultProps.setProperty("my_new_solucionado","5");
    EMITIDO = (new Integer(defaultProps.setProperty("my_new_emitido"))).intValue();
    PAGADO = (new Integer(defaultProps.setProperty("my_new_pagado"))).intValue();
    ENVIADO = (new Integer(defaultProps.setProperty("my_new_enviado"))).intValue();
    SOLUCIONADO = (new Integer(defaultProps.setProperty("my_new_solucionado"))).intValue();
    the compiler send me a error : cannot assign a value to final variable ABONO
    some can help me please!!!

    tks, yes i now but that was the only way to use them
    in other class with the case statement
    meabe you now other way tks.Use ifs instead of the switch.

  • ISO 8 a lot of facebook Internet problems it's annoying and I don't know what I have to do about it would some one can help me with that please.

    I Have an I pad 2 it was really working so well until I update it to ISO 8 many facebook and Internet problems it's become really slow and annoying I hope Apple will resolve that problem soon
    Thanks and  regards
    Tarek .

    Until Apple resolves such issues, there is not much we can do.
    However, try to restart your iPad. This helps more than most people realize.
    I hope this helps, but I cannot guarantee anything till Apple releases further bug fixes.

  • Some one Can help me with a big problem

    i need to get the IP from the pc how visit my site. so, i try before the next instructions.
    request.getRemoteHost() // this send me the proxy IP no the user IP.
    request.getRemoteUser() // this send me a null value.
    if you have another way to obtain the IP user
    Regards.

    public java.lang.String getRemoteAddr()Returns the Internet Protocol (IP) address of the client that sent the request. For HTTP servlets, same as the value of the CGI variable REMOTE_ADDR.
    Returns:
    a String containing the IP address of the client that sent the request
    getRemoteHost
    public java.lang.String getRemoteHost()Returns the fully qualified name of the client that sent the request. If the engine cannot or chooses not to resolve the hostname (to improve performance), this method returns the dotted-string form of the IP address. For HTTP servlets, same as the value of the CGI variable REMOTE_HOST.
    Returns:
    a String containing the fully qualified name of the client

  • HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no ma

    HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no matter what work I have done, inc cropping they  all go back to ,as they came out of camera. What on earth is happening? I am on PS CS6. I might point out everything was working normally up to  yesterday, when this first started.
    I recently changed computer to 64bit from 32bit, not sure if this causing  the problem or not. Any help would be appreciated.

    Robert,
    Would you be so kind to rephrase your question with concise, precise information and without any "let's say that" hypotheticals?  Sorry, I can't quite follow you.
    Also please give exact versions of Photoshop CS6 (13.what.what), of Bridge and of your OS.
    Thanks.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Please some one can help me to fix the special char issue

    Hello,
    Please some one can help me to resolve the issue.
    I was try to load data from PSA to DSO,where it was got failed.
    error message is saying that "Value 'Blythewood' (hex. '0042006C00790074006800650077006F006F0064') of characteristic ZSHPTOCIT contains invalid characters".
    Please advise me to resolve the issue.

    Hi Aryan,
    Change your info-object ZSHPTOCIT to accept Lower Case Letters(it is in General tab of the Info-object definition screen. Check the Lower Case Letters Box) and then load the data. I dont know why you are using the info-object but you may want to check what "Blythewood" means to business users. If it makes sense to them then its fine or esle ask the R/3 team to correct the data.
    Regards,
    Nikhil

  • I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    I would like to know how i can create a bell graph with out using sub VIs, the data that i created consists in 500 readings with values of 0 to 100, i calculated the mean value and standard diviation. I hope some one can help me

    Here's a quick example I threw together that generates a sort-of-bell-curve shaped data distribution, then performs the binning and plotting.
    -Kevin P.
    Message Edited by Kevin Price on 12-01-2006 02:42 PM
    Attachments:
    Binning example.vi ‏51 KB
    Binning example.png ‏12 KB

  • I HATE Menubar ... some one can help???

    Hello, i'm alone inside this project (
    http://br24.dialhost.com.br/~areaproj)
    and want to use flex... but having troubles with idiot menu.... In
    my case user que can change viewstacks when he click in Item of
    menu and in subitem to. For this a must make menubar show submenus
    when user rollover mouse... Some one know how to do this?
    Thanks.

    create a menubar, link it to a xml list (for the drop downs)
    then on event "rollOver" have it expand the menu.
    <mx:MenuBar id="myMenuBar" useHandCursor="true"
    buttonMode="true" toolTip="The Main Menu" labelField="@label"
    width="322" cornerRadius="10" alpha="1" left="171" top="48"
    styleName="TopMenu" themeColor="#333333" selectionColor="0x7FCEFF"
    rollOverColor="0xFFFFFF" borderColor="#642200"
    itemClick="mainMenu(event)">
    <mx:XMLList>
    <menuitem label="Products" id="products" top="48" >
    <menuitem label="French Bread" data="1"/>
    <menuitem label="Croissants" data="2"/>
    <menuitem label="Muffins" data="3"/>
    <menuitem label="Rustic Bread" data="4"/>
    <menuitem label="Desserts" data="5"/>
    <menuitem label="Pretzels" data="6"/>
    </menuitem>
    <menuitem label="Customers" >
    <menuitem label="Login" data="7"/>
    <menuitem label="Steps to Become Potential Customer"
    data="8"/>
    </menuitem>
    <menuitem label="Company Resources" >
    <menuitem label="History" font-color="#FFFFFF"
    data="9"/>
    <menuitem label="Employment" data="10"/>
    <menuitem label="Employees" data="11"/>
    <menuitem label="Newsletter" data="12"/>
    <menuitem label="About Us" data="13"/>
    </menuitem>
    </mx:XMLList>
    </mx:MenuBar>

  • Good morning any one can help me with his experience???????

    I'm a beginer in java programing and i wanted to see for my future. that means in future of my plans in programming. I'd like to be a good programmer by using Java language. but i want from you to suggest me which steps should I take to do that.
    waiting for your suggestions.................
    bye
    Message was edited by:
    Programers

    ok, step 1. invest massive amounts of time in learning. write code. a lot. if it doesn't work, which it won't, find out why
    step 2. work out at least a vague career plan. do you really want to be a programmer? I mean really? you might be enjoying yourself cutting a bit of code at home, but it's an entirely different game programming commercially. chances are you'll be working on and maintaining other peoples code a lot of the time, and unlike coding at home, you'll have actual real deadlines that actually really matter, and you'll actually really not enjoy missing a deadline very much at all. you won't be just writing code you want to write, more often than not somebody else will give you a set of requirements to implement, and if you're lucky you'll get a say in what they are. of course, you won't be working alone, so you'll have other people waiting for you to finish what you're working on, or you'll be held up waiting for somebody else to finish what they're working on, neither are attractive prospects. and the damn thing has to work, so you'll have hours of endless fun testing it, being told you got it wrong, having to re-do stuff and suchlike. you'll estimate that something will take you, say, 16 hours to write, and then halfway through those 16 hours you'll realize you're miles from the finish because sockets don't quite behave as you first thought they did, or actually, that widget isn't particularly reliable after all. so you've got 8 hours left to do 15 hours work, plus undoing all the wasted effort so far. if you're really unlucky, you'll have just tons of ceremony to follow, especially if you land a "cushy" public sector job, only to be told that, yes, they still use and follow SSADM, so goodbye getting any work done, hello tons of paperwork and rigmarole
    then you find that, oops, I did quite well at coding back at uni, but now it's the real world, and, well, all those OO skills I thought I'd gained are actually pretty much valueless, so it's down to the bookstore to spend a fortune, and lots of late night catch-up sessions, because the world doesn't stand still, and in particular software development doesn't stand still, so it's either a constant struggle to keep up with the tide of new information - you want to be marketable, don't you? - or you find some dead-end job nailing new functionality onto the sides of ancient legacy systems written on an Atari ST 15 years ago, only they were only ever designed to do one thing well, and with every new module shoehorned into it you can actually hear it groan and creak and you just know you're doing a terrible job, professionally speaking, and nothing to be proud of at all but it pays the bills. until you get bored and want to leave, only to find that - yep, you've guessed it - your skills are murderously out of date, knowing Java isn't enough any more, there's J2EE to contend with, and you don't want to learn about EJB cos they're so horrible, but everyone still wants you to have the skill, or they think they do, as well as JSP and Servlets, and oh have you ever deployed this on Linux or HP-UX? and the frameworks. oh! the frameworks! every damn company you look at working for has a totally different set of tools they use, and although it's technically all just SQL they'd prefer if you'd used Oracle, or SQL Server, or DB2. what? what's object-relational-mapping, you cry! so it's back to the bookstore again, more late night sessions. or maybe you choose a professionally run training course, only that turns out to be run by some other guy who didn't really know what he was doing, and decided "yes! training! that's where the money is!" and is basically re-hashing some exercises out of Connolly-Begg or something, and is basically a months salary down the drain. by this time you might be thinking "well, this isn't at all what I thought it would be", but it's too late now, you're a coder and there's no denying it. you think about looking at other areas, but that means either a huge pay cut, or more re-training. and all you wanted to do was write code for a living - it can't be that hard, you enjoy it at home right?
    liking coding for fun and doing it for a living are a world apart. the absolute minimum requirement before even considering it is to have the ability to solve problems without other peoples help. well? what are you waiting for??

  • Please see if you can help me with my Disk Error

    I have read through a lot of issues on getting the disk error message and I cannot find the solution for me, so I will try posting this...
    I have a new IMac 20" Intel 2.0 with 2 GB Ram and 500 GB Hard Drive with OSX 10.5
    I printed the instructions for Boot Camp Assistant
    I have a brand new copy of Windows XP Professional I opened the package it says it includes SP2
    I created the 32 GB partition with Boot Camp Assistant
    I have a USB Keyboard and Mouse with the Mouse connected to the Keyboard USB port not the computer as I read to do in one of the forums..
    I chose the C: Partition 3 <BOOTCAMP> [FAT32} as indicated on Pg. 11 of the Manual
    At that point I go through two progress bars that Windows goes through then, I think, Windows says it's going to reboot:
    I get the black screen with white letters
    Disk Errorr....
    click any screen to try again....
    I can click all the keys and nothing happens unless I turn off the computer and then hold down the Options key. I can return the Mac OS but I cannot get Windows to boot.
    I never get to the next screen to choose the Format.
    I have checked the firmware updates when I try to download them it says I don't need them.
    I really do need to still have access to Windows. The whole reason I switched to mac was because I read I could have both. I tried Vista and hated it. I don't want to hate my Mac. I hope someone can help me figure out what to do? I called Applecare, no help!!!!!

    I too no longer get to the screen where I get to choose the format for the windows partition. The first time I installed it, I did and chose the WRONG option (leave the current file system intact). I used boot camp to remove the windows partition and started again, but now I get as far as setting up windows and then get a STOP system initialisation failed message. I don't get to choose the partition or the format. I would have thought removing the partition and starting again would have overcome my initial mistake, but apparently not. Unless this is a different error, which is possible, as many others here seem to have the same problem.

  • Hi, some one can help me please

    i need to get the IP from the pc how visit my site. so, i try before the next instructions.
    request.getRemoteHost() // this send me the proxy IP no the user IP.
    request.getRemoteUser() // this send me a null value.
    if you have another way to obtain the IP user
    Regards.

    this was in a previous post. I don't know if it works, though.
    if (request.getHeader("HTTP_X_FORWARDED_FOR") == null) {
                   String ipaddress = request.getRemoteAddr();
              } else {
                   String ipaddress = request.getHeader("HTTP_X_FORWARDED_FOR");

  • Hope some one can help me

    We had a storm here and I unplugged all of my computers and modem.  After the storm passed I plugged everything back in.  The main computer connected to the internet without any problems.  When I tried to use my computer I could not get on the internet.  I turned the modem off about 100 times, restarted my computer numerous times and still unable.  When I typed in 192.168.1.1  only the one computer was showing.  My computer and  my wireless laptop were no longer listed.  I tried numerous things, installing a network etc... I used the online tech support, which is totally useless and verizon should just get rid of it.  I mean come on I am talking to you on the internet and you are going to ask me if the modem has power to it.  Anyhow I digress.  Can someone please give me some suggestions or tips to get my other computers back online?

    magnum1973 wrote:
    It is an actiontec gt704wg.  I don't even care about the wireless right now I just want to be able to get the 2nd one that is hooked up via ethernet cable.
      Start with the simplest information.  When the Ethernet Cable is connected, do indicator lights on the Actiontec and on the computer's network interface port light?  Lights indicate signalling exists between the two devices - most basic information.
      If OK, then open a Command Prompt windows (under Start>Programs>Accessories, or click on RUN and enter CMD, or view Windows Help).  In that command Window, enter IPCONFIG  or   IPCONFIG /ALL  to learn what you have.
    Also in Cmd Prompt, enter PING 192.168.1.1  to see what it really connects to.
     In each case, you are not yet fixing anything.  These exercises provide facts so that your replies can be useful.

  • Some one ples help me with my k8t neo

     i have just got a new k8t neo fis2r mb with a 3700 64     all it wants to do is reset      i play a game it resets   i cut a cd it resets  i have use  windows  xp 32 bit and 64  i have used the old drivers  which came with it  and got the new ones         i have tryed all that i can think off to get it to work but it don t work        i have tryed prime 95 but it fails   when i instail windows it takes more than one try     pls help    this is not over clocked
    if i change the agp value it locks up   
    i cant change the memory timeing
    the set up is
    asus 6800ge 256 gddr
    corsair 3200xl twinx  xms 512meg x2         cl2 2 2 5
    ibm 120 gig hd x2 ide
    160 gig ibm sata  x 2  i was hopeing to run two sets of raid but this also locks up the bios
    nec dvdrw
    liteon cdrw
    sound baster audigy 2 zs
    hiper type r  480w

    1st screen   dram clock = 400mhz, sdram cas latency =2
    system perfsrmance               fast                                                       cpu fsb clock  200mhz   
    ldt to agp lokar (up)              16 bit                                                     ddr voltage v 2.75
    ldt to agp width (down)        16 bit                                                     cpu vcore    auto      = 1.472v 
    ldt to agp lokar frequency      800mhz                                                  agp voltage  auto      = 1.50
    memclock mode                   auto            which = ddr 400
    memclock value                    200             which is n/a                           +5 v  =   5.162
    bank interleaving                  auto                                                        +12v =   12.046
     bust length                        8 beat                                                      -12v  =   12.546
    cas latecncy                        auto            which = 2                       batttery =       3.506
    tracd                                  auto            which = 2                               +5vsb     5.018
    tras                                   auto             which = 5
    trp                                    auto             which = 2
    agp mode                           auto

  • Some one can help me to create activity with questionnaire?

    hi experts
    now in E-recruiting, I want to create an questionnaire activity, but in hrp5141, the column-- "QA_TPL_OBJID"--of that activtiy is blank, I do not know the reason? is there something I have to configure?
    thank you

    Hello sun,
    the column "QA_TPL_OBJID" contains the hrobjid of the questionaire hr object (otype VA) you maintain when you create an activity in the bsp. To be able to choose a questionaire from the search help you have to create and release one. Usually you will find the create question and create questionaire links on the administrator startpage.
    Best Regards
    Roman Weise

  • Some one can help me?

    Hi, i have i big problem, i need to hide my classes an code from some people in my company but for deploy my application i need to put them in the server, is posible to protect my code to don't read and write.
    tks.

    Go to sourceforge.org and search for a java obfuscator(?).

Maybe you are looking for