Strumenti Utente

Strumenti Sito


lpr-b-2007-2008:codicelettore
import client.*;
import java.io.*;
public class CopyOut {
 
        public static void main(String[] args) {
                try {
                        System.out.println("Opening remote file ...");
                        RemoteInputStream ris = new RemoteInputStream(args[0]);
                        System.out.println("Opening local file ...");
                        FileOutputStream  los  = new FileOutputStream(args[0]);
                        final int MAXBUF = 1024; 
                        byte [] buffer = new byte[MAXBUF];
                        System.out.print("Copying ."); System.out.flush();
                        int letti = ris.read(buffer, 0, MAXBUF);
                        while(letti > 0) {
                                System.out.print(".");System.out.flush();
                                los.write(buffer, 0, letti);
                                letti = ris.read(buffer, 0, MAXBUF);
                        }
                        System.out.println("\nClosing remote file");
                        ris.close();
                        System.out.println("Closing local file");
                        los.close();
                } catch (Exception e) {
                        e.printStackTrace();
                        return;
                }
        }
 
}
lpr-b-2007-2008/codicelettore.txt · Ultima modifica: 19/09/2008 alle 14:08 (16 anni fa) da 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki