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

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

?? diskfileitem.java

?? apache commons-fileupload-1.2.jar
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements.  See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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.fileupload.disk;import java.io.BufferedInputStream;import java.io.BufferedOutputStream;import java.io.ByteArrayInputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;import java.io.ObjectOutputStream;import java.io.ObjectInputStream;import java.io.UnsupportedEncodingException;import java.util.Map;import org.apache.commons.io.IOUtils;import org.apache.commons.io.FileCleaner;import org.apache.commons.io.output.DeferredFileOutputStream;import org.apache.commons.fileupload.FileItem;import org.apache.commons.fileupload.FileUploadException;import org.apache.commons.fileupload.ParameterParser;/** * <p> The default implementation of the * {@link org.apache.commons.fileupload.FileItem FileItem} interface. * * <p> After retrieving an instance of this class from a {@link * org.apache.commons.fileupload.DiskFileUpload DiskFileUpload} instance (see * {@link org.apache.commons.fileupload.DiskFileUpload * #parseRequest(javax.servlet.http.HttpServletRequest)}), you may * either request all contents of file at once using {@link #get()} or * request an {@link java.io.InputStream InputStream} with * {@link #getInputStream()} and process the file without attempting to load * it into memory, which may come handy with large files. * * <p>When using the <code>DiskFileItemFactory</code>, then you should * consider the following: Temporary files are automatically deleted as * soon as they are no longer needed. (More precisely, when the * corresponding instance of {@link java.io.File} is garbage collected.) * This is done by the so-called reaper thread, which is started * automatically when the class {@link FileCleaner} is loaded. * It might make sense to terminate that thread, for example, if * your web application ends. See the section on "Resource cleanup" * in the users guide of commons-fileupload.</p> * * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a> * @author <a href="mailto:sean@informage.net">Sean Legassick</a> * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> * @author <a href="mailto:jmcnally@apache.org">John McNally</a> * @author <a href="mailto:martinc@apache.org">Martin Cooper</a> * @author Sean C. Sullivan * * @since FileUpload 1.1 * * @version $Id: DiskFileItem.java 482993 2006-12-06 09:42:01Z jochen $ */public class DiskFileItem    implements FileItem {    // ----------------------------------------------------- Manifest constants    /**     * Default content charset to be used when no explicit charset     * parameter is provided by the sender. Media subtypes of the     * "text" type are defined to have a default charset value of     * "ISO-8859-1" when received via HTTP.     */    public static final String DEFAULT_CHARSET = "ISO-8859-1";    // ----------------------------------------------------------- Data members    /**     * UID used in unique file name generation.     */    private static final String UID =            new java.rmi.server.UID().toString()                .replace(':', '_').replace('-', '_');    /**     * Counter used in unique identifier generation.     */    private static int counter = 0;    /**     * The name of the form field as provided by the browser.     */    private String fieldName;    /**     * The content type passed by the browser, or <code>null</code> if     * not defined.     */    private String contentType;    /**     * Whether or not this item is a simple form field.     */    private boolean isFormField;    /**     * The original filename in the user's filesystem.     */    private String fileName;    /**     * The size of the item, in bytes. This is used to cache the size when a     * file item is moved from its original location.     */    private long size = -1;    /**     * The threshold above which uploads will be stored on disk.     */    private int sizeThreshold;    /**     * The directory in which uploaded files will be stored, if stored on disk.     */    private File repository;    /**     * Cached contents of the file.     */    private byte[] cachedContent;    /**     * Output stream for this item.     */    private transient DeferredFileOutputStream dfos;    /**     * File to allow for serialization of the content of this item.     */    private File dfosFile;    // ----------------------------------------------------------- Constructors    /**     * Constructs a new <code>DiskFileItem</code> instance.     *     * @param fieldName     The name of the form field.     * @param contentType   The content type passed by the browser or     *                      <code>null</code> if not specified.     * @param isFormField   Whether or not this item is a plain form field, as     *                      opposed to a file upload.     * @param fileName      The original filename in the user's filesystem, or     *                      <code>null</code> if not specified.     * @param sizeThreshold The threshold, in bytes, below which items will be     *                      retained in memory and above which they will be     *                      stored as a file.     * @param repository    The data repository, which is the directory in     *                      which files will be created, should the item size     *                      exceed the threshold.     */    public DiskFileItem(String fieldName, String contentType,            boolean isFormField, String fileName, int sizeThreshold,            File repository) {        this.fieldName = fieldName;        this.contentType = contentType;        this.isFormField = isFormField;        this.fileName = fileName;        this.sizeThreshold = sizeThreshold;        this.repository = repository;    }    // ------------------------------- Methods from javax.activation.DataSource    /**     * Returns an {@link java.io.InputStream InputStream} that can be     * used to retrieve the contents of the file.     *     * @return An {@link java.io.InputStream InputStream} that can be     *         used to retrieve the contents of the file.     *     * @throws IOException if an error occurs.     */    public InputStream getInputStream()        throws IOException {        if (!isInMemory()) {            return new FileInputStream(dfos.getFile());        }        if (cachedContent == null) {            cachedContent = dfos.getData();        }        return new ByteArrayInputStream(cachedContent);    }    /**     * Returns the content type passed by the agent or <code>null</code> if     * not defined.     *     * @return The content type passed by the agent or <code>null</code> if     *         not defined.     */    public String getContentType() {        return contentType;    }    /**     * Returns the content charset passed by the agent or <code>null</code> if     * not defined.     *     * @return The content charset passed by the agent or <code>null</code> if     *         not defined.     */    public String getCharSet() {        ParameterParser parser = new ParameterParser();        parser.setLowerCaseNames(true);        // Parameter parser can handle null input        Map params = parser.parse(getContentType(), ';');        return (String) params.get("charset");    }    /**     * Returns the original filename in the client's filesystem.     *     * @return The original filename in the client's filesystem.     */    public String getName() {        return fileName;    }    // ------------------------------------------------------- FileItem methods    /**     * Provides a hint as to whether or not the file contents will be read     * from memory.     *     * @return <code>true</code> if the file contents will be read     *         from memory; <code>false</code> otherwise.     */    public boolean isInMemory() {        if (cachedContent != null) {            return true;        }        return dfos.isInMemory();    }    /**     * Returns the size of the file.     *     * @return The size of the file, in bytes.     */    public long getSize() {        if (size >= 0) {            return size;        } else if (cachedContent != null) {            return cachedContent.length;        } else if (dfos.isInMemory()) {            return dfos.getData().length;        } else {            return dfos.getFile().length();        }    }    /**     * Returns the contents of the file as an array of bytes.  If the     * contents of the file were not yet cached in memory, they will be     * loaded from the disk storage and cached.     *     * @return The contents of the file as an array of bytes.     */    public byte[] get() {        if (isInMemory()) {            if (cachedContent == null) {                cachedContent = dfos.getData();            }            return cachedContent;        }        byte[] fileData = new byte[(int) getSize()];        FileInputStream fis = null;        try {            fis = new FileInputStream(dfos.getFile());            fis.read(fileData);        } catch (IOException e) {            fileData = null;        } finally {            if (fis != null) {                try {                    fis.close();                } catch (IOException e) {                    // ignore                }            }        }        return fileData;    }    /**     * Returns the contents of the file as a String, using the specified     * encoding.  This method uses {@link #get()} to retrieve the     * contents of the file.     *     * @param charset The charset to use.     *     * @return The contents of the file, as a string.     *     * @throws UnsupportedEncodingException if the requested character     *                                      encoding is not available.     */    public String getString(final String charset)        throws UnsupportedEncodingException {        return new String(get(), charset);    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品电影在线播放| 欧美一区二区三区小说| 亚洲一区二区三区爽爽爽爽爽| 91蜜桃视频在线| 亚洲精品日韩综合观看成人91| www.成人网.com| 亚洲r级在线视频| 欧美精品一区二| 91日韩在线专区| 久久精品国产在热久久| 1区2区3区国产精品| 欧美亚洲国产一区在线观看网站| 日本va欧美va精品发布| 国产亚洲一二三区| 欧美日韩综合色| 国产·精品毛片| 亚洲一区二区三区四区在线观看| 精品国产乱码久久久久久浪潮 | 在线观看日韩高清av| 日韩激情一区二区| 国产日韩精品一区二区三区| 在线观看三级视频欧美| 国产精品18久久久久久久久| 一区二区三区影院| 久久色中文字幕| 成人少妇影院yyyy| 久草这里只有精品视频| 日韩一级二级三级| 国产一区999| 精品免费国产二区三区| 国产精品一区二区你懂的| 亚洲成av人片www| 97精品视频在线观看自产线路二| 国产欧美精品日韩区二区麻豆天美| 亚洲国产成人一区二区三区| 成人av资源在线| 国产乱码字幕精品高清av| 国产综合久久久久久鬼色 | 欧美经典三级视频一区二区三区| 欧美一级理论片| 欧美一级欧美三级在线观看| 日韩国产精品久久久| 欧美一区二区视频网站| 国产精品1区2区3区| 亚洲h在线观看| 国内精品伊人久久久久av一坑 | 欧美国产日产图区| 久久精品欧美日韩精品| 欧美激情综合五月色丁香 | 天堂一区二区在线免费观看| 亚洲第一福利一区| 男女激情视频一区| 激情国产一区二区| 成人一区二区三区| 91黄色在线观看| 欧美日韩成人综合| 日韩女优视频免费观看| 久久久亚洲欧洲日产国码αv| 久久久噜噜噜久久中文字幕色伊伊| 久久久不卡网国产精品二区| 国产精品婷婷午夜在线观看| 亚洲免费在线视频一区 二区| 亚洲一卡二卡三卡四卡无卡久久| 五月天丁香久久| 九九九久久久精品| 成人av电影观看| 欧美精品一卡两卡| 欧美日韩国产综合一区二区| 国产日本欧洲亚洲| 国产欧美一区二区三区在线看蜜臀 | 日韩av电影免费观看高清完整版| 日韩精品久久久久久| 韩国毛片一区二区三区| 99久久99久久久精品齐齐| 欧美午夜一区二区三区| 日韩欧美一区二区免费| 国产精品国产三级国产| 日韩中文字幕av电影| 国内成+人亚洲+欧美+综合在线| 成人免费三级在线| 欧美日韩一区二区三区视频| 日韩久久精品一区| 中文字幕一区日韩精品欧美| 亚洲成人黄色小说| 国产a久久麻豆| 欧美日韩一级二级三级| 久久久久久日产精品| 一区二区三区四区在线免费观看| 99久久国产综合精品女不卡| 欧美精选午夜久久久乱码6080| 蜜乳av一区二区| 国产精品丝袜一区| 色综合天天综合网天天看片| 欧美肥胖老妇做爰| 亚洲色图视频网站| 国产精品99久| 91丨九色porny丨蝌蚪| 中文在线资源观看网站视频免费不卡| 色婷婷综合在线| 亚洲一二三四在线| 久久久99精品久久| 精品少妇一区二区三区在线视频| 亚洲欧洲另类国产综合| 国产精品中文字幕一区二区三区| 色琪琪一区二区三区亚洲区| 依依成人精品视频| 日韩三级伦理片妻子的秘密按摩| 3d动漫精品啪啪1区2区免费| 色综合一个色综合| 亚洲国产日韩综合久久精品| 91视频在线观看免费| 亚洲成av人片一区二区梦乃| 69堂国产成人免费视频| 九九视频精品免费| 国产精品视频一二三| 日本高清成人免费播放| 午夜视频一区二区| 国产亚洲精品中文字幕| 99久久婷婷国产| 五月婷婷久久综合| 国产欧美精品在线观看| 91毛片在线观看| 日韩欧美色综合| 亚洲理论在线观看| 精品国产欧美一区二区| 91小视频免费看| 国产美女av一区二区三区| 欧美少妇xxx| 久久99久国产精品黄毛片色诱| 国产精品毛片a∨一区二区三区 | 91免费精品国自产拍在线不卡 | 日韩毛片精品高清免费| 麻豆精品蜜桃视频网站| 91色九色蝌蚪| 欧美国产一区二区在线观看| 石原莉奈一区二区三区在线观看| 国产欧美日韩久久| 国产精品18久久久久久久久| 中文字幕在线观看一区二区| 综合婷婷亚洲小说| 精品在线一区二区| 六月丁香婷婷久久| 美女诱惑一区二区| 亚洲二区在线视频| 欧美日韩国产色站一区二区三区| 夜夜嗨av一区二区三区四季av| 亚洲国产精品尤物yw在线观看| 亚洲第一福利视频在线| 亚洲综合一区在线| 欧美浪妇xxxx高跟鞋交| 色婷婷亚洲一区二区三区| 亚洲国产精品久久久久婷婷884| 国产91高潮流白浆在线麻豆| 国产精品美女久久久久aⅴ| 国产精品乱人伦| 欧美在线综合视频| 欧美性感一区二区三区| 在线观看免费视频综合| 免费在线成人网| 国产拍揄自揄精品视频麻豆| 日本一区二区三区电影| 欧美性猛交xxxx乱大交退制版 | 亚洲一区二区三区国产| 久久精品视频免费观看| 亚洲日本在线观看| 精品一区二区三区欧美| 麻豆久久久久久久| 国产成人一级电影| 久久精品免费看| 欧美日韩国产区一| 免费观看久久久4p| 欧美日韩综合在线免费观看| 国产精品国模大尺度视频| 国产日韩精品一区二区三区在线| 久久99深爱久久99精品| 欧美精品高清视频| 欧美日韩一区二区欧美激情| 91麻豆精品视频| 久久久久国产精品麻豆| 国产在线一区二区综合免费视频| 亚洲图片欧美综合| 色狠狠一区二区三区香蕉| 99久久精品99国产精品| 国产精品一区二区x88av| 日韩精品专区在线影院观看| 亚洲第一久久影院| 欧美影片第一页| 欧美一激情一区二区三区| 欧美乱妇23p| 毛片不卡一区二区| 免费亚洲电影在线| 日韩一区二区三区电影| 激情六月婷婷久久| 99国产欧美另类久久久精品| 国产精品久久久久永久免费观看 | 欧美性猛片xxxx免费看久爱| 欧美日韩一区二区三区高清| 亚洲国产精品精华液网站| 久久国产精品区| 国产精品精品国产色婷婷|