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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fileutils.java

?? < JavaME核心技術(shù)最佳實(shí)踐>>的全部源代碼
?? JAVA
?? 第 1 頁(yè) / 共 4 頁(yè)
字號(hào):
/*
 * Copyright 2001-2006 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.io;

import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.FalseFileFilter;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.io.filefilter.SuffixFileFilter;
import org.apache.commons.io.filefilter.TrueFileFilter;

/**
 * General file manipulation utilities.
 * <p>
 * Facilities are provided in the following areas:
 * <ul>
 * <li>writing to a file
 * <li>reading from a file
 * <li>make a directory including parent directories
 * <li>copying files and directories
 * <li>deleting files and directories
 * <li>converting to and from a URL
 * <li>listing files and directories by filter and extension
 * <li>comparing file content
 * <li>file last changed date
 * </ul>
 * <p>
 * Origin of code: Excalibur, Alexandria, Commons-Utils
 *
 * @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</A>
 * @author <a href="mailto:sanders@apache.org">Scott Sanders</a>
 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
 * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph.Reck</a>
 * @author <a href="mailto:peter@apache.org">Peter Donald</a>
 * @author <a href="mailto:jefft@apache.org">Jeff Turner</a>
 * @author Matthew Hawthorne
 * @author <a href="mailto:jeremias@apache.org">Jeremias Maerki</a>
 * @author Stephen Colebourne
 * @author Ian Springer
 * @author Chris Eldredge
 * @author Jim Harrington
 * @author Niall Pemberton
 * @author Sandy McArthur
 * @version $Id: FileUtils.java 384037 2006-03-07 22:26:37Z scolebourne $
 */
public class FileUtils {

    /**
     * Instances should NOT be constructed in standard programming.
     */
    public FileUtils() {
        super();
    }

    /**
     * The number of bytes in a kilobyte.
     */
    public static final long ONE_KB = 1024;

    /**
     * The number of bytes in a megabyte.
     */
    public static final long ONE_MB = ONE_KB * ONE_KB;

    /**
     * The number of bytes in a gigabyte.
     */
    public static final long ONE_GB = ONE_KB * ONE_MB;

    /**
     * An empty array of type <code>File</code>.
     */
    public static final File[] EMPTY_FILE_ARRAY = new File[0];

    //-----------------------------------------------------------------------
    /**
     * Returns a human-readable version of the file size, where the input
     * represents a specific number of bytes.
     *
     * @param size  the number of bytes
     * @return a human-readable display value (includes units)
     */
    public static String byteCountToDisplaySize(long size) {
        String displaySize;

        if (size / ONE_GB > 0) {
            displaySize = String.valueOf(size / ONE_GB) + " GB";
        } else if (size / ONE_MB > 0) {
            displaySize = String.valueOf(size / ONE_MB) + " MB";
        } else if (size / ONE_KB > 0) {
            displaySize = String.valueOf(size / ONE_KB) + " KB";
        } else {
            displaySize = String.valueOf(size) + " bytes";
        }
        return displaySize;
    }

    //-----------------------------------------------------------------------
    /**
     * Implements the same behaviour as the "touch" utility on Unix. It creates
     * a new file with size 0 or, if the file exists already, it is opened and
     * closed without modifying it, but updating the file date and time.
     *
     * @param file  the File to touch
     * @throws IOException If an I/O problem occurs
     */
    public static void touch(File file) throws IOException {
        if (!file.exists()) {
            OutputStream out = new FileOutputStream(file);
            IOUtils.closeQuietly(out);
        }
        file.setLastModified(System.currentTimeMillis());
    }

    //-----------------------------------------------------------------------
    /**
     * Converts a Collection containing java.io.File instanced into array
     * representation. This is to account for the difference between
     * File.listFiles() and FileUtils.listFiles().
     *
     * @param files  a Collection containing java.io.File instances
     * @return an array of java.io.File
     */
    public static File[] convertFileCollectionToFileArray(Collection files) {
         return (File[]) files.toArray(new File[files.size()]);
    }

    //-----------------------------------------------------------------------
    /**
     * Finds files within a given directory (and optionally its
     * subdirectories). All files found are filtered by an IOFileFilter.
     *
     * @param files the collection of files found.
     * @param directory the directory to search in.
     * @param filter the filter to apply to files and directories.
     */
    private static void innerListFiles(Collection files, File directory,
            IOFileFilter filter) {
        File[] found = directory.listFiles((FileFilter) filter);
        if (found != null) {
            for (int i = 0; i < found.length; i++) {
                if (found[i].isDirectory()) {
                    innerListFiles(files, found[i], filter);
                } else {
                    files.add(found[i]);
                }
            }
        }
    }

    /**
     * Finds files within a given directory (and optionally its
     * subdirectories). All files found are filtered by an IOFileFilter.
     * <p>
     * If your search should recurse into subdirectories you can pass in
     * an IOFileFilter for directories. You don't need to bind a
     * DirectoryFileFilter (via logical AND) to this filter. This method does
     * that for you.
     * <p>
     * An example: If you want to search through all directories called
     * "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code>
     * <p>
     * Another common usage of this method is find files in a directory
     * tree but ignoring the directories generated CVS. You can simply pass
     * in <code>FileFilterUtils.makeCVSAware(null)</code>.
     *
     * @param directory  the directory to search in
     * @param fileFilter  filter to apply when finding files.
     * @param dirFilter  optional filter to apply when finding subdirectories.
     * If this parameter is null, subdirectories will not be included in the
     * search. Use TrueFileFilter.INSTANCE to match all directories.
     * @return an collection of java.io.File with the matching files
     * @see org.apache.commons.io.filefilter.FileFilterUtils
     * @see org.apache.commons.io.filefilter.NameFileFilter
     */
    public static Collection listFiles(
            File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        if (!directory.isDirectory()) {
            throw new IllegalArgumentException(
                    "Parameter 'directory' is not a directory");
        }
        if (fileFilter == null) {
            throw new NullPointerException("Parameter 'fileFilter' is null");
        }

        //Setup effective file filter
        IOFileFilter effFileFilter = FileFilterUtils.andFileFilter(fileFilter,
            FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));

        //Setup effective directory filter
        IOFileFilter effDirFilter;
        if (dirFilter == null) {
            effDirFilter = FalseFileFilter.INSTANCE;
        } else {
            effDirFilter = FileFilterUtils.andFileFilter(dirFilter,
                DirectoryFileFilter.INSTANCE);
        }

        //Find files
        Collection files = new java.util.LinkedList();
        innerListFiles(files, directory,
            FileFilterUtils.orFileFilter(effFileFilter, effDirFilter));
        return files;
    }

    /**
     * Allows iteration over the files in given directory (and optionally
     * its subdirectories).
     * <p>
     * All files found are filtered by an IOFileFilter. This method is
     * based on {@link #listFiles(File, IOFileFilter, IOFileFilter)}.
     *
     * @param directory  the directory to search in
     * @param fileFilter  filter to apply when finding files.
     * @param dirFilter  optional filter to apply when finding subdirectories.
     * If this parameter is null, subdirectories will not be included in the
     * search. Use TrueFileFilter.INSTANCE to match all directories.
     * @return an iterator of java.io.File for the matching files
     * @see org.apache.commons.io.filefilter.FileFilterUtils
     * @see org.apache.commons.io.filefilter.NameFileFilter
     * @since Commons IO 1.2
     */
    public static Iterator iterateFiles(
            File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
        return listFiles(directory, fileFilter, dirFilter).iterator();
    }

    //-----------------------------------------------------------------------
    /**
     * Converts an array of file extensions to suffixes for use
     * with IOFileFilters.
     *
     * @param extensions  an array of extensions. Format: {"java", "xml"}
     * @return an array of suffixes. Format: {".java", ".xml"}
     */
    private static String[] toSuffixes(String[] extensions) {
        String[] suffixes = new String[extensions.length];
        for (int i = 0; i < extensions.length; i++) {
            suffixes[i] = "." + extensions[i];
        }
        return suffixes;
    }


    /**
     * Finds files within a given directory (and optionally its subdirectories)
     * which match an array of extensions.
     *
     * @param directory  the directory to search in
     * @param extensions  an array of extensions, ex. {"java","xml"}. If this
     * parameter is null, all files are returned.
     * @param recursive  if true all subdirectories are searched as well
     * @return an collection of java.io.File with the matching files
     */
    public static Collection listFiles(
            File directory, String[] extensions, boolean recursive) {
        IOFileFilter filter;
        if (extensions == null) {
            filter = TrueFileFilter.INSTANCE;
        } else {
            String[] suffixes = toSuffixes(extensions);
            filter = new SuffixFileFilter(suffixes);
        }
        return listFiles(directory, filter,
            (recursive ? TrueFileFilter.INSTANCE : FalseFileFilter.INSTANCE));
    }

    /**
     * Allows iteration over the files in a given directory (and optionally
     * its subdirectories) which match an array of extensions. This method
     * is based on {@link #listFiles(File, String[], boolean)}.
     *
     * @param directory  the directory to search in
     * @param extensions  an array of extensions, ex. {"java","xml"}. If this
     * parameter is null, all files are returned.
     * @param recursive  if true all subdirectories are searched as well
     * @return an iterator of java.io.File with the matching files
     * @since Commons IO 1.2
     */
    public static Iterator iterateFiles(
            File directory, String[] extensions, boolean recursive) {
        return listFiles(directory, extensions, recursive).iterator();
    }

    //-----------------------------------------------------------------------
    /**
     * Compare the contents of two files to determine if they are equal or not.
     * <p>
     * This method checks to see if the two files are different lengths
     * or if they point to the same file, before resorting to byte-by-byte
     * comparison of the contents.
     * <p>
     * Code origin: Avalon
     *
     * @param file1  the first file
     * @param file2  the second file

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一区电影| 午夜精品爽啪视频| 精品国产成人系列| 欧美日韩激情一区| av在线不卡观看免费观看| 精品在线视频一区| 日韩专区在线视频| 天堂影院一区二区| 亚洲午夜久久久久| 一级中文字幕一区二区| 久久精品视频在线看| 久久综合九色综合97_久久久| 欧美夫妻性生活| 欧美性猛片xxxx免费看久爱| 成人v精品蜜桃久久一区| 国产精品一区二区在线播放 | 欧美日韩成人在线一区| 一本久久a久久精品亚洲| 99久久精品免费| 成人动漫在线一区| 丰满白嫩尤物一区二区| 国产一区二区调教| 麻豆freexxxx性91精品| 六月丁香婷婷色狠狠久久| 蜜臀av性久久久久蜜臀aⅴ流畅| 丝袜脚交一区二区| 蜜臂av日日欢夜夜爽一区| 日本亚洲视频在线| 久久99精品久久久久久| 蜜臀av性久久久久蜜臀aⅴ四虎 | 丝袜美腿亚洲一区| 免费人成网站在线观看欧美高清| 日韩不卡一区二区三区| 裸体歌舞表演一区二区| 国产麻豆欧美日韩一区| 成人少妇影院yyyy| 国产福利不卡视频| a美女胸又www黄视频久久| 色爱区综合激月婷婷| 欧美日韩一区二区电影| 制服丝袜亚洲网站| 欧美一级视频精品观看| 久久精品人人做人人爽97| 678五月天丁香亚洲综合网| 日韩一区二区精品在线观看| 精品久久久久久无| 中文字幕高清一区| 一区二区三区日韩精品视频| 日本成人在线电影网| 国产精一区二区三区| 国产伦精品一区二区三区免费 | 午夜视频一区二区| 亚洲一区二区三区四区在线观看| 日韩制服丝袜av| 国产一二精品视频| 91久久精品网| 2023国产精品视频| 中文字幕一区二区三区在线不卡| 亚洲午夜激情网站| 午夜精品福利一区二区三区蜜桃| 国内精品第一页| 色网站国产精品| 制服.丝袜.亚洲.中文.综合| 欧美日韩综合色| 久久亚洲一区二区三区明星换脸| 亚洲乱码国产乱码精品精可以看 | 久久日一线二线三线suv| 中文字幕一区二区三区视频| 久久影院视频免费| 亚洲无人区一区| 国产精品一级二级三级| 欧美日韩综合在线| 日本一区二区三区四区| 午夜激情综合网| 成人污视频在线观看| 欧美丰满嫩嫩电影| 欧美激情一区二区三区| 亚洲一区二区三区中文字幕在线| 国产呦萝稀缺另类资源| 色老头久久综合| 久久婷婷国产综合精品青草| 亚洲国产精品一区二区久久| 国产麻豆日韩欧美久久| 欧美日韩激情一区二区三区| 国产精品视频免费| 久久国产精品第一页| 欧美在线不卡视频| 国产精品护士白丝一区av| 亚洲欧美一区二区三区国产精品| 肉色丝袜一区二区| 色婷婷精品久久二区二区蜜臀av| 久久久久久亚洲综合影院红桃| 亚洲成av人片一区二区三区| 高清在线观看日韩| 日本一区二区高清| 天堂在线亚洲视频| 色综合视频在线观看| 精品国产乱码久久久久久图片| 亚洲人成网站在线| 国产一区二区三区精品视频| 在线成人小视频| 亚洲国产日韩在线一区模特| 99re这里只有精品视频首页| 久久久精品蜜桃| 美女www一区二区| 欧美一区二区三区日韩视频| 亚洲午夜激情网站| 日本二三区不卡| 亚洲人成网站色在线观看| 成人免费看视频| 久久久久久99精品| 精品一区二区三区在线观看国产| 欧美理论电影在线| 亚洲成人激情社区| 欧美无人高清视频在线观看| 亚洲欧美日韩人成在线播放| 99国产精品一区| 国产精品免费看片| 成人免费观看av| 国产欧美日韩综合| 粉嫩久久99精品久久久久久夜 | 亚洲男人的天堂在线aⅴ视频| 精品一区二区三区欧美| 日韩欧美国产电影| 国内精品视频一区二区三区八戒 | 欧美精品精品一区| 亚洲国产一区二区三区| 在线视频观看一区| 视频一区中文字幕国产| 欧美一区二区成人| 美女网站视频久久| 日韩一二三区视频| 蜜臀av一级做a爰片久久| 欧美一区二区三区在线视频 | 国内不卡的二区三区中文字幕 | 一区二区三区中文免费| 欧美三级电影在线看| 日本在线观看不卡视频| 日韩欧美国产三级| 国产精品1区2区3区在线观看| 2023国产精品视频| 成人亚洲一区二区一| 欧美人与禽zozo性伦| 麻豆精品视频在线观看视频| 精品美女一区二区| 国产91精品免费| 一区二区三区四区视频精品免费| 欧美日韩综合一区| 久久精品国产成人一区二区三区| 久久久久久免费网| av午夜精品一区二区三区| 亚洲午夜久久久| 欧美一区二区三区思思人| 国产精品99久久久久久久vr | 日韩午夜在线观看| 国产一区二区三区蝌蚪| 亚洲天堂免费看| 欧美日韩视频第一区| 国内不卡的二区三区中文字幕| 国产精品色在线| 欧美日韩久久久久久| 轻轻草成人在线| 国产女同互慰高潮91漫画| 欧洲国内综合视频| 激情深爱一区二区| 中文字幕一区二区不卡| 中文字幕视频一区二区三区久| 在线影院国内精品| 狠狠色狠狠色综合系列| 亚洲人123区| 精品伦理精品一区| 91国在线观看| 国产精品一区二区久激情瑜伽 | 欧美性极品少妇| 国产剧情一区二区| 亚洲成av人综合在线观看| 久久久777精品电影网影网 | 在线观看91av| 国产精品无码永久免费888| 亚洲精品乱码久久久久久黑人| 国产一区二区三区| 欧美理论在线播放| 久久久一区二区三区| 性欧美疯狂xxxxbbbb| 91亚洲国产成人精品一区二区三 | 久久免费的精品国产v∧| 亚洲激情av在线| 欧美亚洲自拍偷拍| 欧美一区二区三区婷婷月色| 91小视频免费看| 久久成人免费网站| 肉丝袜脚交视频一区二区| 亚洲丝袜另类动漫二区| 欧美国产97人人爽人人喊| 欧美日韩免费高清一区色橹橹| 色综合一区二区三区| 丁香桃色午夜亚洲一区二区三区| 国产一区二区在线免费观看| 石原莉奈在线亚洲二区| 日日摸夜夜添夜夜添亚洲女人|