package zh.codegym.task.task09.task0928;
import java.io.*;
/*
代码将无法编译…
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sourceFileName = reader.readLine();
String destinationFileName = reader.readLine();
InputStream fileInputStream = getInputStream(destinationFileName);
OutputStream fileOutputStream = getOutputStream(destinationFileName);
int count = 0;
while (fileInputStream.available()-count > 0) ;
{
int data = fileInputStream.read();
fileOutputStream.write(data);
count++;
}
System.out.println("已复制的字节数:" + count);
fileInputStream.close();
fileOutputStream.close();
}
public static InputStream getInputStream(String fileName) throws IOException {
return new FileInputStream(fileName);
}
public static OutputStream getOutputStream(String fileName) throws IOException {
return new FileOutputStream(fileName);
}
}
package zh.codegym.task.task09.task0928;
import java.io.*;
/*
代码将无法编译…
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String sourceFileName = reader.readLine();
String destinationFileName = reader.readLine();
InputStream fileInputStream = getInputStream(destinationFileName);
OutputStream fileOutputStream = getOutputStream(destinationFileName);
int count = 0;
while (fileInputStream.available()-count > 0) ;
{
int data = fileInputStream.read();
fileOutputStream.write(data);
count++;
System.out.println(count);
}
System.out.println("已复制的字节数:" + count);
fileInputStream.close();
fileOutputStream.close();
}
public static InputStream getInputStream(String fileName) throws IOException {
return new FileInputStream(fileName);
}
public static OutputStream getOutputStream(String fileName) throws IOException {
return new FileOutputStream(fileName);
}
}