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

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

?? fileutils.java

?? j2me簡單實例,j2me教程加源碼,希望大家喜歡
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/*
 * 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品卡一卡二| 国产欧美va欧美不卡在线| 在线这里只有精品| 欧美三级电影在线看| 欧洲日韩一区二区三区| 色一情一乱一乱一91av| 欧美在线高清视频| 在线播放/欧美激情| 欧美精品一区二区三| 国产精品三级电影| 亚洲777理论| 国产大陆精品国产| 一本色道**综合亚洲精品蜜桃冫 | 成人免费看片app下载| 国产91精品一区二区麻豆网站| 不卡的av在线| 91精品国产一区二区| 久久综合国产精品| 亚洲精品成人悠悠色影视| 亚洲成人综合在线| 成人av影院在线| 88在线观看91蜜桃国自产| 国产精品欧美经典| 午夜精品福利一区二区三区av| 日本午夜一本久久久综合| 91在线观看美女| 久久综合资源网| 日本在线观看不卡视频| 色欧美88888久久久久久影院| 久久综合中文字幕| 三级不卡在线观看| 欧美在线综合视频| 亚洲欧美偷拍三级| 99re这里只有精品视频首页| 欧美激情在线观看视频免费| 久久精品国产成人一区二区三区 | eeuss鲁片一区二区三区在线看| 成人午夜伦理影院| 国产视频在线观看一区二区三区| 午夜精品一区在线观看| 在线观看国产日韩| 亚洲午夜在线视频| 欧美高清性hdvideosex| 日韩制服丝袜先锋影音| 欧美老年两性高潮| 日韩电影在线免费| 精品剧情在线观看| 福利电影一区二区三区| 国产精品欧美经典| 色婷婷精品久久二区二区蜜臀av | 国产乱色国产精品免费视频| 久久久久99精品一区| 国产精品77777竹菊影视小说| 日韩一级精品视频在线观看| 九九视频精品免费| 国产视频一区在线观看| av欧美精品.com| 亚洲国产成人tv| 精品国产一区二区三区四区四| 国产91高潮流白浆在线麻豆 | 国产主播一区二区三区| 国产精品久久久久久亚洲伦 | 亚洲免费观看高清完整版在线观看 | 一本大道久久a久久精品综合| 亚洲精品乱码久久久久久久久| 欧美老人xxxx18| 成人爱爱电影网址| 精品一区二区三区av| 一区二区三区在线播| 2021国产精品久久精品| 欧美吞精做爰啪啪高潮| 成人伦理片在线| 久久99精品视频| 日韩不卡一区二区| 亚洲一区av在线| 中文字幕免费一区| 久久综合国产精品| 日韩一二三区不卡| 日韩亚洲欧美中文三级| 欧美亚洲一区三区| 91福利在线观看| 欧美日韩亚洲综合在线| 日本韩国欧美国产| 91黄色激情网站| 在线日韩一区二区| 91尤物视频在线观看| 青娱乐精品视频在线| 1区2区3区国产精品| 国产欧美日韩在线视频| 久久久精品2019中文字幕之3| 日韩一区二区在线观看| 精品电影一区二区三区| 久久麻豆一区二区| 国产精品美女久久久久久久久久久| 久久奇米777| 亚洲日本一区二区| 亚洲国产cao| 美国三级日本三级久久99| 久久精品二区亚洲w码| 国产91精品一区二区麻豆网站| 成人晚上爱看视频| 欧美日韩在线精品一区二区三区激情| 91国产福利在线| 日韩三级免费观看| 久久久久99精品一区| 亚洲乱码国产乱码精品精98午夜| 亚洲一二三区在线观看| 麻豆精品蜜桃视频网站| 99re8在线精品视频免费播放| 精品视频999| 国产精品久久福利| 日本欧洲一区二区| 色哟哟国产精品| 欧美国产欧美亚州国产日韩mv天天看完整| 国产精品国产三级国产三级人妇 | 久久99精品久久久久| 欧洲精品在线观看| 欧美国产激情二区三区| 美腿丝袜在线亚洲一区| 色天天综合久久久久综合片| xfplay精品久久| 久久国产精品99久久人人澡| 欧美日韩精品电影| 亚洲人成在线播放网站岛国| 国产成人综合亚洲91猫咪| 欧美一区二区在线播放| 日韩电影在线一区| 欧美二区在线观看| 午夜精品视频一区| 欧美日韩国产综合一区二区三区| 日韩一区在线播放| 91在线小视频| 亚洲大型综合色站| 色菇凉天天综合网| 偷拍自拍另类欧美| 欧美一区永久视频免费观看| 欧美a级理论片| 精品欧美一区二区在线观看| 免费成人在线视频观看| 欧美精品日韩一本| 理论片日本一区| 中文字幕av一区二区三区高 | 国产欧美日韩另类一区| 国产精品亚洲一区二区三区在线| 久久蜜桃av一区二区天堂| av在线不卡免费看| 中文字幕不卡的av| 国产伦精一区二区三区| 久久综合色天天久久综合图片| 激情综合网激情| 国产午夜精品一区二区三区四区| 91视频免费观看| 免费久久99精品国产| 亚洲乱码精品一二三四区日韩在线| 在线欧美一区二区| 国产精品一区二区久激情瑜伽| 亚洲欧美一区二区三区国产精品| 欧美一级日韩免费不卡| 色成人在线视频| 一本久久a久久精品亚洲| 蜜臀久久99精品久久久画质超高清| 久久精品人人爽人人爽| 在线成人av网站| 色婷婷av一区二区三区大白胸| 精品在线一区二区| 免费三级欧美电影| 亚洲国产成人av| 亚洲成人自拍偷拍| 亚洲国产日韩精品| 亚洲一区二区三区爽爽爽爽爽| 中文字幕五月欧美| 国产日韩欧美a| 国产精品色在线观看| 国产视频911| 久久久久国产精品麻豆| 久久一日本道色综合| 久久―日本道色综合久久| 精品国产乱码久久久久久牛牛| 欧美成人艳星乳罩| 久久美女艺术照精彩视频福利播放| 日韩免费电影一区| 国产亚洲精品资源在线26u| 久久久亚洲高清| 亚洲色大成网站www久久九九| 亚洲欧洲日韩在线| 亚洲一区二区三区中文字幕 | 欧美日韩亚洲高清一区二区| 欧美日韩在线精品一区二区三区激情 | 国产宾馆实践打屁股91| 国产成人av影院| 在线视频你懂得一区| 3d成人h动漫网站入口| 久久精品一区二区三区不卡牛牛 | 高清av一区二区| 在线亚洲+欧美+日本专区| 欧美日韩中文另类| 欧美激情一二三区| 香蕉av福利精品导航| 成人中文字幕电影| 91精品国产免费|