1.4 bug? or bad code?  please I need help

FTPClient.getFile(inputStream out,String filename) works fine if inputStream is directed to an output file. I added a Thread to read inputStream using piped i/o and works fine but the thread never ends. Seems like readLine() does not return null. Please I need help.
note: FTP package located finj.sourceforge.net
import java.io.*;
import org.finj.FTPClient;
public class FTPSimpleDemo extends Object {
public FTPSimpleDemo ( String server,
String user,
char[] password ) throws Exception {
PipedOutputStream pipeOut = null;
PipedInputStream pipeIn = null;
Thread reader = null;
FTPClient client =
new FTPClient(server,user,password);
//download file
try {
pipeOut = new PipedOutputStream();
pipeIn = new PipedInputStream(pipeOut);
reader = new PipeIn(pipeIn);
reader.start();
client.getFile(pipeOut, "J_Event.txt");
while(reader.isAlive() ||
!reader.isInterrupted));
pipeOut.close();
pipeIn.close();
client.close();
}catch(IOException e){e.getMessage();}
finally {reader=null;}
public static void main ( String[] args ) throws Exception {
new FTPSimpleDemo(args[0], args[1],
args[2].toCharArray());}
class PipeIn extends Thread {
private InputStream in;
private String str;
public PipeIn(InputStream in) {this.in = in;}
public void run() {
try {
BufferedReader br = new BufferedReader(
new InputStreamReader(in));
while ((str=br.readLine()) != null)
System.out.println(str);
br.close();
}catch (IOException e) {
System.err.println(e.getMessage());}
}

Heres a tip: forget that open source library unless you need to customize it or something. Use the ftp library that comes wih the JDK. It is in an unsupported package (sun.net.ftp) check it out it couldn't be simpler:
//you need this import statement
import sun.net.ftp.*;
//here is example code
String server = "ftp.fileplanet.com";
String user = "me";
String passwd = "1234";
FtpClient client = new FtpClient();
client.openServer(server);
client.login(user, passwd);
client.binary();
client.cd("games");
//DO NOT CLOSE THIS INPUTSTREAM UNTIL YOU WANT TO CLOSE YOUR CONNECTION
TelnetInputStream in = client.get("pacman.exe");
//now do whatever u want with this inputstream
byte[] bytes = new byte[4096];
int x = 0;
while((x = in.read(bytes)) != -1)
  out.write(bytes, 0, x);
  _totalBytes += x;
out.flush();
out.close();Also another tip for you to write code in the forum put your code between the [ code ] [ code ] tags

Similar Messages

  • When i type in my correct password on the login screen and press enter it just goes to a blue screen for a few seconds then goes back to the same login screen again, please i need help?

    When i type in my correct password on the login screen and press enter it just goes to a blue screen for a few seconds then goes back to the same login screen again, please i need help?

    You can take some of the steps here, #4, #5 or even trying a #18
    Step by Step to fix your Mac
    but I suspect your going to first have to create a data recovery drive
    Create a data recovery, undelete boot drive
    to get your data off the machine,
    then do a #20 to eliminate the bad sectors as that's why your getting the "pinwheel" it's getting a delay reading from the drive, right when your trying to log in too, what a bad spot for it to happen.
    Step by Step to fix your Mac

  • Jtextfield inside jtable..please i need help

    Hello, im trying to put textfield in a cell of Jtable but appears the following text inside of JTextField that i've inserted...
    javax.swing.JTextField[,0,0,0x0,invalid,disabled,layout=javax.swing.plaf.basic.Basic
    TextUI$UpdateHandler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.Border
    UIResource$CompoundBorderUIResource@196c1b0,flags=296,maximumSize=,minimumSize
    =,preferredSize=,caretColor=sun.swing.PrintColorUIResource[r=51,g=51,b=51],disabled
    TextColor=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],editable=true,margin=
    javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],selectedTextColor=
    sun.swing.PrintColorUIResource[r=51,g=51,b=51],selectionColor=javax.swing.plaf.Color
    UIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,horizontal
    Alignment=LEADING]
    Thus i've implemented a class FBaseTableCellEditor extends DefaultCellEditor that allow me to have JTextfield like cell of JTable.
    this is the source code :
    public class FBaseTableCellEditor extends DefaultCellEditor {
    public FBaseTableCellEditor() {
    super(new javax.swing.JTextField());
    this.editorComponent = new javax.swing.JTextField();
    //this.setClickCountToStart(1);
    ths is the source code to insert a new row in the JTable:
    private void AddRowsinTable(){
    int row = JTable.getRowCount() - 1;
    JTextField[] newrow = CreateRow();
    this.DefaultTableModel.addRow(newrow);
    private JTextField[] CreateRow()
    JTextField[] newrow = {this.JTextField0, this.JTextField1, this.JTextField2, this.JTextField3, this.JTextField4, this.JTextField5, this.JTextField6};
    return newrow;
    PLEASE I NEED HELP...
    Message was edited by:
    negrera

    tripple posting: http://forum.java.sun.com/thread.jspa?threadID=5120228

  • Please, I need help- video messages

    Please, I need help. I can not play video messages which send me friends. When I click the message error occur ,and tell me: "Oops, something went wrong. Please try again, or get in touch if you need help." I do not know what I should do. I tried many times to play video message. I updated skype, but nothing has changed. Does anyone know how to help me?
    PS. I am sorry for my bad English. I am still learning English.

    See your other post asking the same question:
    help.... ¡¡¡¡

  • If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    If i reset my ipad can i install paye games for free if i sign back into my apple ID. Please i need help because i need to update my games but i need to put in this billing thing and i want to get rid of it so then i cant buy games with my credit card

    Hello,
    As frustrating as it seems, your best to post any frustrations about the iPhone in the  iPhone discussion here:
    https://discussions.apple.com/community/iphone/using_iphone
    As this discussion is for iBook laptops.
    Best of Luck.

  • How can I delete my old iCloud account cause I forgot my password and my email has been block. Please I need help urgently

    How can I delete my old iCloud account cause I forgot my password and my email has been block. Please I need help urgently

    Contact the Apple account security team for assistance resetting your password: Apple ID: Contacting Apple for help with Apple ID account security.

  • My daughter has spitefully changed my password and has refused to tell me. I have so much medical information that I can not lose. Is there anyway to get around this problem. Please I need Help fast.

    My daughter has spitefully changed my password and has refused to tell me. I have so much medical information that I can not lose. Is there anyway to get around this problem. Please I need Help fast.

    Connect the iPod to your syncing computer and restore it via iTunes.  However, if iTunes asks for the unknown passcode you need to place the iPod in recovery mode and then restore the iPod from backup.  For recovey mode see:
    iPhone and iPod touch: Unable to update or restore
    "If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone and iPod touch software."
    Above is from:
    http://support.apple.com/kb/ht1212

  • Please i need help to how to recover my camera roll photos i deleted them yersterday by accident im need with the ipod and i took the pictures with ipod but i want to know how to recover my photos in a easy fast FREE way as soon as porssible pleasse???

    please i need  help to how to recorver my cameral roll photos from my ipod in a easy FREE way as soon as possible

    Restore from backup if they are in a backup. Otherweise I know of no free way. These are paid and no one has said that they worked.
    iPhone Recovery Stick - recover deleted text messages & more
    Recover files from iPod Touch | Restore data iPod | iPod touch undelete, unformat

  • Please i need help very urgent !!! after deleting my exchange account because the company changed the password , I lost 150 200 contacts and i need to get them back very soon ! please help

    Please i need help very urgent !!! after deleting my exchange account because the company changed the password , I lost 150 200 contacts and i need to get them back very soon !  i never backed up on itunes ..please help

    No. The contacts are "owned" by the Exchange server.
    The Exchange server is owned by the company.
    Everything on the Exchange server is owned by the company.
    If you quit or were terminated, and your access to the system has been revoked, then there is nothing you and do at this point. Once you deleted the account from your phone, all of the associated data was deleted.
    NEVER store personal information on company systems.

  • Please I need help in upgrading applications

    Please I need help in upgrading my pdf-notes for ipad. it seemed like somebody hijacked my Apple ID, I had since solve the problem with Apple, I still have my original email address but I was unable to upgrade all applications I bought before my username was hijacked and pdf-notes is one of the applications. kindly advice me on what to do to upgrade.
    Thanks. Jimmy

    Okay Demo.  My theory is that accessing iCloud if apps were backed up to it can be redownload end then updated. I am thinking that with the new apple ID the iCloud account may only recognize the high jacked ID. I don't know if I made it clearer but I can do some digging. I don't like to see people using Apple devices having a tuff time. Not cool.

  • HT5654 please I need help, I have not been able to upgrade my iOS from 6.1.2 to 6.1.3?

    please I need help, I have not been able to upgrade my iOS from 6.1.2 to 6.1.3?

    Hello mpacology
    The article below will provide assistance with upgrade your iPhone operating system. You can do this through iTunes or through the Software Update section in Settings >General > Software Update
    iOS: How to update your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT4623
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Please a need help, I need my serial njumber, they said is in the coner but not is 0 there.

    I need help, I don't have serial number, so I have a lots of truable to get any the adobe

    please I need help, I tray to call up so many times
    Date: Sun, 27 Apr 2014 02:00:21 -0700
    From: [email protected]
    To: [email protected]
    Subject: please a need help, I need my serial njumber, they said is in the coner but not is 0 there.
        Re: please a need help, I need my serial njumber, they said is in the coner but not is 0 there.
        created by Rajshree in Adobe Creative Cloud - View the full discussion
    Please refer to http://helpx.adobe.com/x-productkb/global/find-serial-number.html
    If you have Creative Cloud then it does not need not serial, you have to just log in to www.creative.adobe.com & download & install from there.
    Regards
    Rajshree
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6334115#6334115
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6334115#6334115
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6334115#6334115. In the Actions box on the right, click the Stop Email Notifications link.
               Start a new discussion in Adobe Creative Cloud at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • I bought my macpro in NY but now I live in France. I want to order an album via IPHOTO and it cannot be delivered other than in US??? please I need help

    I bought my macpro in NY but now I live in France. I want to order an album via IPHOTO and it cannot be delivered other than in US??? please I need help

    I assume you mean 'Order an album via iTunes', not iPhoto.
    If you live in France, I believe your account with Apple will need to show a French residential address and be supported by a credit card issued by a bank in France.
    That means you will need to open a new account if these details are not part of your current account.
    Incidentally, some albums in iTunes USA are not available in all countries due to licensing agreements etc.

  • Please, I need help. I´ve just downloaded your adobe creative cloud and now I CAN´T SEE THE DESKK ON MY PC!!!!!

    Please, I need help. I´ve just downloaded your adobe creative cloud and now I CAN´T SEE THE DESKK ON MY PC!!!!!

    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • I just updated my mac book pro mid 2009. Now i can't play videos in youtube. when i play videos it freezes. Please i need help!!

    i just updated my mac book pro mid 2009 to OS X 10.8.4 and my safari to 6.0.5 . Now i can't play videos in youtube. when i play videos it freezes. Please i need help!!

    gabevdd wrote:
    i just updated my mac book pro mid 2009 to OS X 10.8.4 and my safari to 6.0.5 . Now i can't play videos in youtube. when i play videos it freezes. Please i need help!!
    Did you also update Adobe Flash Player to be compatible w/your new OS? 

Maybe you are looking for

  • Adobe Story Desktop App - unable to get past login

    This problem is not present on all my home computers or laptops which leads me to believe this will be an issue with my computer. On my 2012 iMac I was recently able to launch, login and work inside Adobe Story Desktop. Last night I went to launch th

  • Replacing bullets with images

    Are there plans to add the option of replacing the bullets in a bulleted list with images, as you can do in Word? Our current workaround is to insert the image as a background image through the CSS with appropriate spacing, but this isn't very accura

  • Using SQLJ in JSP files ... ?

    Hi, has anyone used oracle 8.1.5 SQLJ with JSP pages? In partucilar, with Apache Tomcat 3.0? Help much appreciated, direct mails ([email protected]) preferred! Cheers, all - keep up the good work! null

  • Is there any way to install Win7 64bit onto a partition

    Is there any way to install Win7 64bit onto a partition from a Win7 CD? I have tried bootcamp several times and it won't work. I am running a late 2011 MBP 500gb hd, 2.7ghz i7

  • Unable to update apps after Mavericks install (Unable to update w/this Apple ID)

    After updating Mavericks I cannot update the Apps. It says, "Update Unavailable with this Apple ID.  This update is not available for this Apple ID either b/c it was bought by a different user or the item was refunded or cancelled". Neither of those