DevShivmohan / Learning-everything

Learning for developer only
0 stars 1 forks source link

[COPY] file data #13

Open DevShivmohan opened 1 year ago

DevShivmohan commented 1 year ago

Copy large file

/**
     *
     * @param sourceFileName source file name which will copy
     * @return return no. of bytes that copied
     * @throws IOException
     */
    public long copy(String sourceFileName) throws IOException {
        Path destinationPath= Paths.get("C:\\Users\\Dell\\Downloads\\log\\copy"+sourceFileName);
        InputStream sourceInputStream=new FileInputStream("C:\\Users\\Dell\\Downloads\\log\\"+sourceFileName);
        return Files.copy(sourceInputStream,destinationPath, StandardCopyOption.REPLACE_EXISTING);
    }