lpr-b: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/codicelettore.txt · Ultima modifica: 04/02/2008 alle 14:19 (17 anni fa) da Marco Danelutto