jbackup/src/main/java/org/jbundle/jbackup/destination/FtpDestination.java
public long addNextFile(SourceFile source)
	{
		String strPath = source.getFilePath();
		String strFilename = source.getFileName();
		long lStreamLength = source.getStreamLength();

        if (m_client != null)
		{ // Success
			try {
				int reply = this.changeDirectory(strPath);
				if(!FTPReply.isPositiveCompletion(reply))
				{
					System.out.println("Error on change dir: " + reply);
				}
				else
				{
					File fileIn = source.makeInFile(false);
					FileInputStream inStream = new FileInputStream(fileIn);
					if (DEBUG)
						System.out.println("Sending File: " + strFilename);
					if (m_client.storeFile(strFilename, inStream))   // Upload this file
					{	// Success
						
					}
					else
					{	// Error
						
					}
					inStream.close();
				}
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return lStreamLength;
	}
public long addNextFile(SourceFile source)
	{
		String strPath = source.getFilePath();
		String strFilename = source.getFileName();
		long lStreamLength = source.getStreamLength();

        if (m_client != null)
		{ // Success
			try {
				int reply = this.changeDirectory(strPath);
				if(!FTPReply.isPositiveCompletion(reply))
				{
					System.out.println("Error on change dir: " + reply);
				}
				else
				{
					File fileIn = source.makeInFile(false);
					FileInputStream inStream = new FileInputStream(fileIn);
					if (DEBUG)
						System.out.println("Sending File: " + strFilename);
					if (m_client.storeFile(strFilename, inStream))   // Upload this file
					{	// Success
						
					}
					else
					{	// Error
						
					}
					inStream.close();
				}
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return lStreamLength;
	}
public long addNextFile ( SourceFile source ) { String strPath = source . getFilePath ( ) ; String strFilename = source . getFileName ( ) ; long lStreamLength = source . getStreamLength ( ) ; if ( m_client != null ) { // Success try { int reply = this . changeDirectory ( strPath ) ; if ( ! FTPReply . isPositiveCompletion ( reply ) ) { System . out . println ( "Error on change dir: " + reply ) ; } else { File fileIn = source . makeInFile ( false ) ; FileInputStream inStream = new FileInputStream ( fileIn ) ; if ( DEBUG ) System . out . println ( "Sending File: " + strFilename ) ; if ( m_client . storeFile ( strFilename , inStream ) ) // Upload this file { // Success } else { // Error } inStream . close ( ) ; } } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } return lStreamLength ; }
/*
Add this file to the destination.
Note: Only supply the file or the stream, not both. Supply the object that is easier, given
the source. This dual option is given to allow destinations that require File objects from
(such as FTP or HTTP) Having to write the inStream to a physical file before processing it.
@param file Source file.
@param inStream Source stream.
@param strpath Full path of the source file (including the filename).
@param strFilename Filename.
@param lStreamLength Length of the stream (-1 if unknown).
/ * Add this file to the destination . Note : Only supply the file or the stream not both . Supply the object that is easier given the source . This dual option is given to allow destinations that require File objects from ( such as FTP or HTTP ) Having to write the inStream to a physical file before processing it .