- public static void main(String[] args) throws IOException {
- String path = input();
- String ex=path.substring( path.lastIndexOf("."));
- try(
- BufferedInputStream fis = new BufferedInputStream(new FileInputStream(path));
- BufferedOutputStream fos=new BufferedOutputStream(new FileOutputStream("copy."+ex));
- ){
- int x=0;
- while ((x=fis.read())!=-1) {
- fos.write(x);
- }
- }
- first(path,ex);
- }
- private static String input() {
- Scanner sc=new Scanner(System.in);
- String path=sc.nextLine();
- return path;
- }
复制代码 |