亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩亚洲国产中文字幕欧美| zzijzzij亚洲日本少妇熟睡| 国产亚洲午夜高清国产拍精品| 成人三级在线视频| 亚洲第一狼人社区| 国产精品色哟哟| 日韩欧美国产三级| 欧美日韩在线精品一区二区三区激情| 国产老女人精品毛片久久| 亚洲福利视频一区| 亚洲精品国产精华液| 久久久久国产精品麻豆ai换脸| 波多野结衣91| caoporn国产精品| 国产精选一区二区三区| 捆绑变态av一区二区三区| 亚洲码国产岛国毛片在线| 国产精品灌醉下药二区| 中文字幕精品在线不卡| 久久久久国产精品厨房| 国产片一区二区| 久久精品水蜜桃av综合天堂| 久久嫩草精品久久久精品一| 日韩视频不卡中文| 日韩欧美成人一区二区| 久久蜜桃香蕉精品一区二区三区| 欧美一区二区三区播放老司机| 欧美日韩dvd在线观看| 欧美日韩在线一区二区| 欧美视频一区二区三区四区 | 欧美高清一级片在线观看| 中文子幕无线码一区tr| 国产精品久久久久久久久免费丝袜| 国产欧美久久久精品影院| 亚洲欧美怡红院| 视频一区视频二区中文字幕| 美女视频免费一区| 成人黄页毛片网站| 91一区在线观看| 欧美一区二区三区免费大片| 日韩无一区二区| 国产精品欧美极品| 亚洲国产美女搞黄色| 久久av资源网| 在线中文字幕不卡| 久久久久久久久久久黄色| 亚洲欧美一区二区久久| 免费看日韩精品| 色婷婷精品久久二区二区蜜臀av | 专区另类欧美日韩| 蜜桃视频在线观看一区二区| 成人h动漫精品一区二区| 欧美男男青年gay1069videost | www.久久精品| 日本韩国欧美一区| 国产精品女上位| 免费视频一区二区| 日韩黄色小视频| 国产精品一二三四区| 欧美亚洲高清一区二区三区不卡| 中文字幕中文乱码欧美一区二区| 欧美唯美清纯偷拍| 久久综合资源网| 亚洲高清不卡在线观看| 成人免费高清在线| 精品国产免费人成在线观看| 亚洲一区二区三区四区在线 | 日韩欧美一级在线播放| 成人欧美一区二区三区| 天天色综合天天| 欧美午夜寂寞影院| 一区二区三区日本| 日本精品一级二级| 亚洲一区二区免费视频| av午夜精品一区二区三区| 中日韩av电影| av电影在线观看完整版一区二区| 中文一区二区在线观看| 成人黄色在线视频| 中文字幕视频一区二区三区久| 国产91在线观看丝袜| 国产精品久久一级| 欧美午夜精品久久久久久超碰| 亚洲国产精品久久久男人的天堂| 欧美亚一区二区| 日韩经典中文字幕一区| 日韩一区二区免费在线观看| 亚洲成a人v欧美综合天堂下载 | 蜜臀av一区二区在线免费观看| 欧美一区三区二区| 国产盗摄视频一区二区三区| 欧美激情一区二区三区四区| 99精品久久99久久久久| 五月开心婷婷久久| 精品入口麻豆88视频| 成人精品一区二区三区中文字幕| 亚洲精品写真福利| 欧美大片在线观看一区| 99久久er热在这里只有精品15| 日日摸夜夜添夜夜添国产精品| 精品免费日韩av| 91精品91久久久中77777| 韩日av一区二区| 亚洲v日本v欧美v久久精品| 久久久91精品国产一区二区精品 | 中文一区二区在线观看| 4438亚洲最大| 91美女视频网站| 国产成人精品亚洲777人妖| 偷拍与自拍一区| 国产精品久久一级| 久久久一区二区| 精品国产免费人成在线观看| 欧美自拍偷拍午夜视频| 91农村精品一区二区在线| 国产剧情一区在线| 久久精品国产**网站演员| 日欧美一区二区| 亚洲成人av中文| 天堂va蜜桃一区二区三区| 亚洲综合精品自拍| 一区二区不卡在线播放| 亚洲日本成人在线观看| 日韩一区在线看| 亚洲欧美日韩综合aⅴ视频| 中文字幕免费观看一区| 国产日韩av一区| 国产欧美视频在线观看| 日韩欧美123| 久久精品日产第一区二区三区高清版 | 色猫猫国产区一区二在线视频| 成人精品视频网站| 91浏览器入口在线观看| 色爱区综合激月婷婷| 欧美精品丝袜久久久中文字幕| 精品视频免费看| 久久久久久久国产精品影院| 精品国产成人在线影院| 日韩精品中文字幕在线一区| 一本久久综合亚洲鲁鲁五月天| 韩国成人在线视频| 日日摸夜夜添夜夜添精品视频 | 国产91丝袜在线播放0| 国产美女精品人人做人人爽| 国产经典欧美精品| 不卡高清视频专区| 欧美色涩在线第一页| 精品免费视频.| 国产精品麻豆99久久久久久| 一区二区三区四区中文字幕| 日韩不卡一区二区三区| 国产成人免费在线视频| 99在线精品观看| 精品国产一区二区在线观看| 亚洲美女一区二区三区| 日本视频一区二区| 99久久精品免费看国产免费软件| 欧美片在线播放| 国产精品初高中害羞小美女文| 日本成人中文字幕在线视频 | 国产午夜精品一区二区三区视频| 亚洲欧美自拍偷拍色图| 日韩高清在线不卡| 欧美视频日韩视频| 国产精品久久久久久久久免费相片| 日韩国产高清在线| 91视频免费播放| 国产精品家庭影院| 国产成人免费视频精品含羞草妖精| 在线观看亚洲a| 日韩美女久久久| 99久久久精品| 中文字幕在线不卡视频| 成人少妇影院yyyy| 亚洲国产精品黑人久久久| 国产成人免费av在线| 久久久久亚洲综合| 国产在线精品一区在线观看麻豆| 欧美高清视频不卡网| 视频一区视频二区中文| 欧美日韩aaaaaa| 久久精品国产澳门| 久久这里只有精品首页| 激情综合网av| 国产欧美日韩精品一区| 99在线精品一区二区三区| 中文在线免费一区三区高中清不卡| 国产真实乱子伦精品视频| 国产日韩欧美a| 日本韩国精品在线| 一区二区视频免费在线观看| 欧美日韩一区二区三区四区五区 | 亚洲国产aⅴ成人精品无吗| 欧美一区二区三区婷婷月色| 日本不卡不码高清免费观看| 久久精品视频在线看| 欧美日韩一级大片网址| 日本欧美在线观看| 26uuu另类欧美亚洲曰本| 国产精品99久久不卡二区|