import java.awt.*; import javax.swing.*; import java.io.*; import WebFlow.RemoteFile.*; public class SendFile implements Runnable { private boolean debug; private String LocalFileName, RemoteFileName; private JTextField tf; private short blksize=8912; private FileInputStream fis; public SendFile(String LocalFileName, String RemoteFileName, JTextField tf, boolean debug) { this.LocalFileName = LocalFileName; this.RemoteFileName = RemoteFileName; this.tf = tf; this.debug = debug; // Connection.movefile.Init(Connection.remote); if(debug) System.out.println("SendFile constructor completed"); } public void run(){ File local = new File(LocalFileName); if(local.exists()) { if(local.canRead()) { try { try { if(debug) System.out.println("can read "+LocalFileName); long file_length = local.length(); long pos = 0; tf.setText(pos+ "bytes uploaded of "+file_length); if(debug) System.out.println("file length = "+file_length); fis = new FileInputStream(local); byte buffer[] =new byte[blksize]; if(debug) System.out.println("fis opened"); Connection.remote.open(RemoteFileName,"rw"); if(debug) System.out.println("remote file opened"); while(true) { if(debug) System.out.println("read next buffer"); int icount = fis.read(buffer); if(debug) System.out.println("buffer read"); if(icount==-1){ if(debug) System.out.println("EOF reached"); throw new EOFException(); } byte arr[]; if(blksize==icount) { arr=buffer; } else { arr=new byte[icount]; for(int i=0;i