Java UTF8 backup(String inputFile, String backupFile)

Here you can find the source of backup(String inputFile, String backupFile)

Description

backup

License

Open Source License

Declaration

public static boolean backup(String inputFile, String backupFile) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

public class Main {
    public static boolean backup(String inputFile, String backupFile) {
        return backup(new File(inputFile), new File(backupFile));
    }//  w  w w . j av  a  2 s. co m

    public static boolean backup(File inputFile, String backupFile) {
        return backup(inputFile, new File(backupFile));
    }

    public static boolean backup(String inputFile, File backupFile) {
        return backup(new File(inputFile), backupFile);
    }

    public static boolean backup(File inputFile, File backupFile) {
        Path input = inputFile.toPath(), backup = backupFile.toPath();

        try {
            Files.move(input, backup, StandardCopyOption.REPLACE_EXISTING);
        } catch (Exception err) {
            System.err.println(err.getMessage());
            err.printStackTrace();
            return false;
        }

        return true;
    }
}

Related

  1. asUTF8(InputStream in)
  2. asUTF8bytes(String s)
  3. asUtf8ByteStream(final String string)
  4. asUTF8String(byte[] bytes)
  5. asUTFString(byte[] content)
  6. codeListToString(List utf8CodeList)
  7. codesToString(int[] utf8Codes)
  8. codeToString(int utf8Code)
  9. compareWithGold(String goldfile, String outputfile)