Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment