@@ -0,0 +1,2172 @@
+package com.angcyo.library.utils;%0A%0Aimport java.io.File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.InputStream;%0A%0Aimport okio.BufferedSink;%0Aimport okio.BufferedSource;%0Aimport okio.Okio;%0Aimport okio.Sink;%0Aimport okio.Source;%0A%0A/**%0A * Copyright (C) 2016,%E6%B7%B1%E5%9C%B3%E5%B8%82%E7%BA%A2%E9%B8%9F%E7%BD%91%E7%BB%9C%E7%A7%91%E6%8A%80%E8%82%A1%E4%BB%BD%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8 All rights reserved.%0A * %E9%A1%B9%E7%9B%AE%E5%90%8D%E7%A7%B0%EF%BC%9A%0A * %E7%B1%BB%E7%9A%84%E6%8F%8F%E8%BF%B0%EF%BC%9AOkio%E6%93%8D%E4%BD%9C%E7%B1%BB https://github.com/square/okio%0A * %E5%88%9B%E5%BB%BA%E4%BA%BA%E5%91%98%EF%BC%9ARobi%0A * %E5%88%9B%E5%BB%BA%E6%97%B6%E9%97%B4%EF%BC%9A2018/01/16 11:11%0A * %E4%BF%AE%E6%94%B9%E4%BA%BA%E5%91%98%EF%BC%9ARobi%0A * %E4%BF%AE%E6%94%B9%E6%97%B6%E9%97%B4%EF%BC%9A2018/01/16 11:11%0A * %E4%BF%AE%E6%94%B9%E5%A4%87%E6%B3%A8%EF%BC%9A%0A * Version: 1.0.0%0A */%0Apublic class RIo %7B%0A%0A    public static long copyFile(String fromFilePath, String toFilePath) throws FileNotFoundException %7B%0A        return copyFile(new File(fromFilePath), toFilePath);%0A    %7D%0A%0A    public static long copyFile(File fromFile, String toFilePath) throws FileNotFoundException %7B%0A        return copyFile(new FileInputStream(fromFile), toFilePath);%0A    %7D%0A%0A    public static long copyFile(InputStream from, String toFilePath) %7B%0A        return copyFile(from, new File(toFilePath));%0A    %7D%0A%0A    public static long copyFile(InputStream from, File toFile) %7B%0A        BufferedSource bufferedSource = null;%0A        BufferedSink bufferedSink = null;%0A        try %7B%0A            Source source = Okio.source(from);%0A            bufferedSource = Okio.buffer(source);%0A%0A            if (!toFile.exists()) %7B%0A                toFile.createNewFile();%0A            %7D%0A            Sink sink = Okio.sink(toFile);%0A            bufferedSink = Okio.buffer(sink);%0A%0A            long all = bufferedSource.readAll(bufferedSink);%0A            bufferedSink.flush();%0A            return all;%0A        %7D catch (FileNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D finally %7B%0A            try %7B%0A                bufferedSink.close();%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A            %7D%0A            try %7B%0A                from.close();%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A            %7D%0A            try %7B%0A                bufferedSource.close();%0A            %7D catch (Exception e) %7B%0A                e.printStackTrace();%0A            %7D%0A        %7D%0A        return -1;%0A    %7D%0A%7D%0A

add rio