radko93 icon

bajtowe

radko93 | PRO | 02/05/13 07:19:38 PM UTC | 0 ⭐ | 248 👁️ | Never ⏰ | []
Java |

780 B

|

None

|

0 👍

/

0 👎

import java.util.*;
import java.io.*;
 
public class kbajtowe {
    int licznik = 0;
    Scanner sc = new Scanner(System.in);
 
    String f1 = sc.nextLine();
    String f2 = sc.nextLine();
 
    public void kopiuj(String f1, String f2) {
        try {
 
            BufferedInputStream br1 = new BufferedInputStream(
                    new FileInputStream(f1));
            BufferedOutputStream br2 = new BufferedOutputStream(
                    new FileOutputStream(f2));
 
            while (br1.read() != -1) {
                br2.write(br1.read());
                licznik++;
            }
            System.out.printf("%s%7d", "Liczba bajtow:", licznik);
            br1.close();
            br2.close();
        }
 
        catch (IOException e) {
            System.out.println(e);
        }
    }
 
    public static void main(String[] args) {
        System.out.println("Wprowadz nazwy plikow");
        kbajtowe test = new kbajtowe();
        test.kopiuj(test.f1, test.f2);
 
    }
 
}

Comments