public void retrieveFile(String path,OutputStream os,int limit) throws IOException, FtpExceptionCanNotHaveDataConnection, FtpExceptionUnknownForcedDataClose, FtpExceptionControlClosedByForcedDataClose {
  Socket socket=__openPassiveDataConnection(FTPCommand.RETR,path);
  if (socket == null)   throw new FtpExceptionCanNotHaveDataConnection("RETR " + ((path == null) ? "" : path));
  InputStream input=socket.getInputStream();
  int len;
  int count=0;
  byte[] buf=new byte[org.apache.commons.net.io.Util.DEFAULT_COPY_BUFFER_SIZE];
  while ((len=input.read(buf,0,buf.length)) != -1) {
    count+=len;
    if (limit >= 0 && count > limit) {
      os.write(buf,0,len - (count - limit));
      break;
    }
    os.write(buf,0,len);
    os.flush();
  }
  socket.close();
  try {
    int reply=getReply();
    if (!_notBadReply(reply))     throw new FtpExceptionUnknownForcedDataClose(getReplyString());
  }
 catch (  FTPConnectionClosedException e) {
    throw new FtpExceptionControlClosedByForcedDataClose(e.getMessage());
  }
}

public void retrieveFile ( String path , OutputStream os , int limit ) throws IOException , FtpExceptionCanNotHaveDataConnection , FtpExceptionUnknownForcedDataClose , FtpExceptionControlClosedByForcedDataClose { Socket socket = __openPassiveDataConnection ( FTPCommand . RETR , path ) ; if ( socket == null ) throw new FtpExceptionCanNotHaveDataConnection ( "RETR " + ( ( path == null ) ? "" : path ) ) ; InputStream input = socket . getInputStream ( ) ; int len ; int count = 0 ; byte [ ] buf = new byte [ org . apache . commons . net . io . Util . DEFAULT_COPY_BUFFER_SIZE ] ; while ( ( len = input . read ( buf , 0 , buf . length ) ) != - 1 ) { count += len ; if ( limit >= 0 && count > limit ) { os . write ( buf , 0 , len - ( count - limit ) ) ; break ; } os . write ( buf , 0 , len ) ; os . flush ( ) ; } socket . close ( ) ; try { int reply = getReply ( ) ; if ( ! _notBadReply ( reply ) ) throw new FtpExceptionUnknownForcedDataClose ( getReplyString ( ) ) ; } catch ( FTPConnectionClosedException e ) { throw new FtpExceptionControlClosedByForcedDataClose ( e . getMessage ( ) ) ; } }
retrieve a file for path
