亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fileutils.java

?? < JavaME核心技術最佳實踐>>的全部源代碼
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
     * @param srcDir  an existing directory to copy, must not be null
     * @param destDir  the new directory, must not be null
     * @param preserveFileDate  true if the file date of the copy
     *  should be the same as the original
     *
     * @throws NullPointerException if source or destination is null
     * @throws IOException if source or destination is invalid
     * @throws IOException if an IO error occurs during copying
     * @since Commons IO 1.1
     */
    public static void copyDirectory(File srcDir, File destDir,
            boolean preserveFileDate) throws IOException {
        if (srcDir == null) {
            throw new NullPointerException("Source must not be null");
        }
        if (destDir == null) {
            throw new NullPointerException("Destination must not be null");
        }
        if (srcDir.exists() == false) {
            throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
        }
        if (srcDir.isDirectory() == false) {
            throw new IOException("Source '" + srcDir + "' exists but is not a directory");
        }
        if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) {
            throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same");
        }
        doCopyDirectory(srcDir, destDir, preserveFileDate);
    }

    /**
     * Internal copy directory method.
     * 
     * @param srcDir  the validated source directory, not null
     * @param destDir  the validated destination directory, not null
     * @param preserveFileDate  whether to preserve the file date
     * @throws IOException if an error occurs
     * @since Commons IO 1.1
     */
    private static void doCopyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
        if (destDir.exists()) {
            if (destDir.isDirectory() == false) {
                throw new IOException("Destination '" + destDir + "' exists but is not a directory");
            }
        } else {
            if (destDir.mkdirs() == false) {
                throw new IOException("Destination '" + destDir + "' directory cannot be created");
            }
            if (preserveFileDate) {
                destDir.setLastModified(srcDir.lastModified());
            }
        }
        if (destDir.canWrite() == false) {
            throw new IOException("Destination '" + destDir + "' cannot be written to");
        }
        // recurse
        File[] files = srcDir.listFiles();
        if (files == null) {  // null if security restricted
            throw new IOException("Failed to list contents of " + srcDir);
        }
        for (int i = 0; i < files.length; i++) {
            File copiedFile = new File(destDir, files[i].getName());
            if (files[i].isDirectory()) {
                doCopyDirectory(files[i], copiedFile, preserveFileDate);
            } else {
                doCopyFile(files[i], copiedFile, preserveFileDate);
            }
        }
    }

    //-----------------------------------------------------------------------
    /**
     * Copies bytes from the URL <code>source</code> to a file
     * <code>destination</code>. The directories up to <code>destination</code>
     * will be created if they don't already exist. <code>destination</code>
     * will be overwritten if it already exists.
     *
     * @param source A <code>URL</code> to copy bytes from.
     * @param destination A non-directory <code>File</code> to write bytes to
     * (possibly overwriting).
     *
     * @throws IOException if
     * <ul>
     *  <li><code>source</code> URL cannot be opened</li>
     *  <li><code>destination</code> cannot be written to</li>
     *  <li>an IO error occurs during copying</li>
     * </ul>
     */
    public static void copyURLToFile(URL source, File destination) throws IOException {
        //does destination directory exist ?
        if (destination.getParentFile() != null
            && !destination.getParentFile().exists()) {
            destination.getParentFile().mkdirs();
        }

        //make sure we can write to destination
        if (destination.exists() && !destination.canWrite()) {
            String message =
                "Unable to open file " + destination + " for writing.";
            throw new IOException(message);
        }

        InputStream input = source.openStream();
        try {
            FileOutputStream output = new FileOutputStream(destination);
            try {
                IOUtils.copy(input, output);
            } finally {
                IOUtils.closeQuietly(output);
            }
        } finally {
            IOUtils.closeQuietly(input);
        }
    }

    //-----------------------------------------------------------------------
    /**
     * Recursively delete a directory.
     *
     * @param directory  directory to delete
     * @throws IOException in case deletion is unsuccessful
     */
    public static void deleteDirectory(File directory)
        throws IOException {
        if (!directory.exists()) {
            return;
        }

        cleanDirectory(directory);
        if (!directory.delete()) {
            String message =
                "Unable to delete directory " + directory + ".";
            throw new IOException(message);
        }
    }

    /**
     * Clean a directory without deleting it.
     *
     * @param directory directory to clean
     * @throws IOException in case cleaning is unsuccessful
     */
    public static void cleanDirectory(File directory) throws IOException {
        if (!directory.exists()) {
            String message = directory + " does not exist";
            throw new IllegalArgumentException(message);
        }

        if (!directory.isDirectory()) {
            String message = directory + " is not a directory";
            throw new IllegalArgumentException(message);
        }

        File[] files = directory.listFiles();
        if (files == null) {  // null if security restricted
            throw new IOException("Failed to list contents of " + directory);
        }

        IOException exception = null;
        for (int i = 0; i < files.length; i++) {
            File file = files[i];
            try {
                forceDelete(file);
            } catch (IOException ioe) {
                exception = ioe;
            }
        }

        if (null != exception) {
            throw exception;
        }
    }

    //-----------------------------------------------------------------------
    /**
     * Waits for NFS to propagate a file creation, imposing a timeout.
     * <p>
     * This method repeatedly tests {@link File#exists()} until it returns
     * true up to the maximum time specified in seconds.
     *
     * @param file  the file to check, not null
     * @param seconds  the maximum time in seconds to wait
     * @return true if file exists
     * @throws NullPointerException if the file is null
     */
    public static boolean waitFor(File file, int seconds) {
        int timeout = 0;
        int tick = 0;
        while (!file.exists()) {
            if (tick++ >= 10) {
                tick = 0;
                if (timeout++ > seconds) {
                    return false;
                }
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException ignore) {
                ;
            } catch (Exception ex) {
                break;
            }
        }
        return true;
    }

    //-----------------------------------------------------------------------
    /**
     * Reads the contents of a file into a String.
     * The file is always closed.
     * <p>
     * There is no readFileToString method without encoding parameter because
     * the default encoding can differ between platforms and will have
     * inconsistent results.
     *
     * @param file  the file to read
     * @param encoding  the encoding to use, null means platform default
     * @return the file contents or null if read failed
     * @throws IOException in case of an I/O error
     * @throws UnsupportedEncodingException if the encoding is not supported by the VM
     */
    public static String readFileToString(
            File file, String encoding) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            return IOUtils.toString(in, encoding);
        } finally {
            IOUtils.closeQuietly(in);
        }
    }

    /**
     * Reads the contents of a file into a byte array.
     * The file is always closed.
     *
     * @param file  the file to read
     * @return the file contents or null if read failed
     * @throws IOException in case of an I/O error
     * @since Commons IO 1.1
     */
    public static byte[] readFileToByteArray(File file) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            return IOUtils.toByteArray(in);
        } finally {
            IOUtils.closeQuietly(in);
        }
    }

    /**
     * Reads the contents of a file line by line to a List of Strings.
     * The file is always closed.
     * <p>
     * There is no readLines method without encoding parameter because
     * the default encoding can differ between platforms and will have
     * inconsistent results.
     *
     * @param file  the file to read
     * @param encoding  the encoding to use, null means platform default
     * @return the list of Strings representing each line in the file
     * @throws IOException in case of an I/O error
     * @throws UnsupportedEncodingException if the encoding is not supported by the VM
     * @since Commons IO 1.1
     */
    public static List readLines(File file, String encoding) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            return IOUtils.readLines(in, encoding);
        } finally {
            IOUtils.closeQuietly(in);
        }
    }

    /**
     * Return an Iterator for the lines in a <code>File</code>.
     * <p>
     * This method opens an <code>InputStream</code> for the file.
     * When you have finished with the iterator you should close the stream
     * to free internal resources. This can be done by calling the
     * {@link LineIterator#close()} or
     * {@link LineIterator#closeQuietly(LineIterator)} method.
     * <p>
     * The recommended usage pattern is:
     * <pre>
     * LineIterator it = FileUtils.lineIterator(file, "UTF-8");
     * try {
     *   while (it.hasNext()) {
     *     String line = it.nextLine();
     *     /// do something with line
     *   }
     * } finally {
     *   LineIterator.closeQuietly(iterator);
     * }
     * </pre>
     * <p>
     * If an exception occurs during the creation of the iterator, the
     * underlying stream is closed.
     * <p>
     * There is no lineIterator method without encoding parameter because
     * the default encoding can differ between platforms and will have
     * inconsistent results.
     *
     * @param file  the file to read
     * @param encoding  the encoding to use, null means platform default
     * @return an Iterator of the lines in the file, never null
     * @throws IOException in case of an I/O error (file closed)
     * @since Commons IO 1.2
     */
    public static LineIterator lineIterator(File file, String encoding) throws IOException {
        InputStream in = null;
        try {
            in = new FileInputStream(file);
            return IOUtils.lineIterator(in, encoding);
        } catch (IOException ex) {
            IOUtils.closeQuietly(in);
            throw ex;
        } catch (RuntimeException ex) {
            IOUtils.closeQuietly(in);
            throw ex;
        }
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线播放一区二区三区| 亚洲色图视频网| 91精品国产综合久久久久久漫画 | 午夜一区二区三区在线观看| 亚洲欧洲精品天堂一级| 亚洲丝袜精品丝袜在线| 免费观看成人鲁鲁鲁鲁鲁视频| 偷偷要91色婷婷| 日韩av网站免费在线| 免费久久精品视频| 国产麻豆精品久久一二三| 狠狠色综合日日| 国产精一区二区三区| 成人一区二区三区中文字幕| 成人一区二区三区中文字幕| 色综合天天综合网国产成人综合天| 91蝌蚪国产九色| 91激情五月电影| 欧美一区日韩一区| 欧美精品一区二| 国产精品久久久久久久久动漫| 亚洲免费看黄网站| 青青草精品视频| 国产福利不卡视频| 在线观看亚洲专区| 精品美女一区二区| 国产精品二三区| 首页国产欧美久久| 国产福利一区在线| 色天天综合久久久久综合片| 7777精品伊人久久久大香线蕉超级流畅 | 91精品国产手机| 久久你懂得1024| 亚洲欧美日韩在线不卡| 青青草原综合久久大伊人精品优势| 国产盗摄精品一区二区三区在线 | 日韩一区二区三区三四区视频在线观看 | 色av成人天堂桃色av| 欧美一区二区三区四区五区| 中文在线资源观看网站视频免费不卡| 亚洲欧美日韩一区二区| 美女国产一区二区三区| www.亚洲免费av| 91精品国产手机| 国产精品国产馆在线真实露脸 | 不卡视频一二三| 666欧美在线视频| 国产精品久久毛片av大全日韩| 成人综合婷婷国产精品久久| 欧美午夜在线观看| 国产三级一区二区三区| 亚洲国产一区二区三区| 国产精品一二二区| 欧美精品 国产精品| 中文字幕中文乱码欧美一区二区 | 国产一区二区看久久| 欧美在线不卡一区| 国产婷婷一区二区| 手机精品视频在线观看| 91小视频免费看| 2021久久国产精品不只是精品| 亚洲一区欧美一区| 国产成人免费在线观看| 日韩欧美一区二区不卡| 一区二区三区欧美日| 国产mv日韩mv欧美| 欧美成人一区二区三区在线观看| 亚洲黄色尤物视频| aaa国产一区| 国产拍欧美日韩视频二区| 男人的j进女人的j一区| 欧洲一区在线电影| 国产精品久久久99| 国产成人亚洲综合a∨婷婷 | 欧美国产丝袜视频| 日本成人在线电影网| 欧美丝袜自拍制服另类| 亚洲视频电影在线| 岛国精品在线播放| 亚洲精品一区二区精华| 麻豆视频一区二区| 欧美一区二区三区爱爱| 亚洲国产欧美一区二区三区丁香婷| 成人黄色电影在线 | 久久99这里只有精品| 4438成人网| 三级不卡在线观看| 欧美体内she精高潮| 亚洲欧美激情视频在线观看一区二区三区| 国产激情一区二区三区四区 | 精品国产乱码久久久久久久久 | 久久精品国产精品亚洲综合| 欧美精品亚洲二区| 丝袜亚洲另类欧美综合| 欧美图片一区二区三区| 亚洲国产一二三| 欧美日韩中文另类| 99久久夜色精品国产网站| 亚洲国产精品99久久久久久久久| 国产在线乱码一区二区三区| 欧美成人vr18sexvr| 麻豆精品久久久| 精品区一区二区| 国产精品一区二区不卡| 亚洲精品一区二区三区蜜桃下载| 国模少妇一区二区三区| 久久美女艺术照精彩视频福利播放| 国产在线精品不卡| 亚洲国产精品ⅴa在线观看| 波多野结衣中文字幕一区 | 国产成人高清视频| 国产亚洲美州欧州综合国| 成熟亚洲日本毛茸茸凸凹| 国产精品高潮呻吟久久| 色吧成人激情小说| 日韩一区精品视频| 久久亚洲精华国产精华液| 国产高清无密码一区二区三区| 国产精品不卡一区二区三区| 日本高清无吗v一区| 婷婷久久综合九色综合绿巨人| 欧美一区二区视频观看视频| 激情综合色综合久久| 国产色91在线| 在线观看一区不卡| 天堂蜜桃一区二区三区| 精品成人在线观看| 成人av午夜电影| 亚洲国产一区在线观看| 日韩视频不卡中文| 懂色av一区二区在线播放| 亚洲欧洲日韩av| 欧美乱妇一区二区三区不卡视频| 久久99热这里只有精品| 一区在线播放视频| 91精品国产91久久综合桃花| 国内偷窥港台综合视频在线播放| 国产精品女主播av| 在线成人免费视频| 国产乱人伦偷精品视频免下载| 亚洲欧美日韩中文字幕一区二区三区 | 色一区在线观看| 免费成人在线播放| 中文字幕一区二区三区乱码在线| 欧美日韩国产高清一区二区| 国产在线一区二区综合免费视频| 亚洲婷婷综合色高清在线| 欧美一区二区三区四区久久| 成人免费福利片| 日本美女视频一区二区| 亚洲色图19p| 精品国产在天天线2019| 91啪亚洲精品| 激情久久五月天| 亚洲美女精品一区| 精品国产伦一区二区三区观看方式 | 97精品视频在线观看自产线路二| 日本成人在线网站| 亚洲女同ⅹxx女同tv| 26uuu久久综合| 欧美日韩精品久久久| 精品久久久久久久一区二区蜜臀| 99在线精品视频| 精品一区二区免费看| 一区二区三区欧美亚洲| 中文字幕精品一区二区三区精品| 欧美精品123区| 色综合一个色综合| 懂色一区二区三区免费观看| 免费观看一级欧美片| 亚洲妇熟xx妇色黄| 国产精品传媒视频| 国产三级精品三级| 日韩午夜在线观看| 欧美美女视频在线观看| 97精品国产97久久久久久久久久久久| 精品一区二区三区在线观看 | 国产不卡视频在线播放| 蜜臀av国产精品久久久久| 亚洲成人综合网站| 亚洲精品成人a在线观看| 国产精品视频你懂的| 精品久久人人做人人爰| 欧美放荡的少妇| 欧美日韩二区三区| 欧美图区在线视频| 色久综合一二码| 91蜜桃视频在线| 成人av网站在线观看免费| 国产成人av网站| 国产成人小视频| 国产成人亚洲综合a∨猫咪| 激情偷乱视频一区二区三区| 麻豆国产欧美一区二区三区| 日韩高清不卡一区| 日本一道高清亚洲日美韩| 亚洲成av人影院| 香蕉成人伊视频在线观看| 亚洲国产视频网站| 性欧美大战久久久久久久久|