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

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

?? diskfileitem.java

?? Apache Commons FileUpload Copyright 2002-2008 The Apache Software Foundation This product includ
?? 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.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.OutputStream;import java.io.UnsupportedEncodingException;import java.util.Map;import org.apache.commons.fileupload.FileItem;import org.apache.commons.fileupload.FileItemHeaders;import org.apache.commons.fileupload.FileItemHeadersSupport;import org.apache.commons.fileupload.FileUploadException;import org.apache.commons.fileupload.ParameterParser;import org.apache.commons.io.IOUtils;import org.apache.commons.io.output.DeferredFileOutputStream;/** * <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 org.apache.commons.io.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 607869 2008-01-01 16:42:17Z jochen $ */public class DiskFileItem    implements FileItem, FileItemHeadersSupport {    // ----------------------------------------------------- Manifest constants    /**     * The UID to use when serializing this instance.     */    private static final long serialVersionUID = 2237570099615271025L;    /**     * 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;    /**     * The temporary file to use.     */    private transient File tempFile;    /**     * File to allow for serialization of the content of this item.     */    private File dfosFile;    /**     * The file items headers.     */    private FileItemHeaders headers;    // ----------------------------------------------------------- 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一区二区三区免费野_久草精品视频
国产精品综合网| 国产精品久久一卡二卡| 久久精品国产999大香线蕉| 丁香啪啪综合成人亚洲小说| 欧美吻胸吃奶大尺度电影 | 亚洲免费视频中文字幕| 老汉av免费一区二区三区| 91极品视觉盛宴| 国产精品久久久久久久裸模| 久久97超碰色| 日韩视频一区二区在线观看| 一区二区三区精品久久久| 99国产精品99久久久久久| 亚洲国产精品激情在线观看| 国产麻豆成人精品| 中文字幕精品在线不卡| 成人动漫av在线| 一区二区三区四区乱视频| 日韩一区和二区| 九色综合狠狠综合久久| 一区二区高清在线| 国产精品污污网站在线观看 | 久久99精品久久久久久久久久久久| 精品国产乱码91久久久久久网站| www.亚洲色图.com| 蜜臀精品久久久久久蜜臀| 亚洲视频香蕉人妖| 久久蜜臀中文字幕| 欧美日韩国产bt| 在线免费观看日本欧美| 国产乱码精品一区二区三区av| 中文成人综合网| 欧美一区二区三区在线观看视频 | 久久久久国产精品麻豆ai换脸| 在线观看国产精品网站| 成人精品国产福利| 精品一区二区免费| 婷婷中文字幕一区三区| 亚洲人成7777| 一区二区三区不卡在线观看| 国产精品高潮呻吟| 国产欧美日韩视频一区二区| 日韩一级二级三级精品视频| 久久蜜桃av一区精品变态类天堂| 国产精品女同互慰在线看| 91丨九色丨蝌蚪富婆spa| 日韩免费观看2025年上映的电影| 久久精品国产99| 国产麻豆成人传媒免费观看| 日本伦理一区二区| 亚洲在线视频一区| 国产日韩三级在线| 欧美性生活大片视频| 成人黄动漫网站免费app| 国产99久久久国产精品| 91亚洲国产成人精品一区二区三| 欧美日韩国产综合久久| 久久综合九色综合97婷婷女人| 亚洲日本va午夜在线电影| 日韩在线观看一区二区| av亚洲精华国产精华精华 | 在线免费av一区| 欧美国产一区视频在线观看| 卡一卡二国产精品 | 51精品久久久久久久蜜臀| 国产91清纯白嫩初高中在线观看| 美女尤物国产一区| 亚洲视频你懂的| 国产精品久久久久久久久免费丝袜| 一色屋精品亚洲香蕉网站| 国产日韩欧美高清在线| 久久久激情视频| 欧美本精品男人aⅴ天堂| 日韩欧美高清一区| 91精品国产色综合久久ai换脸| 亚洲天堂免费看| 亚洲男人天堂av| 综合久久久久久| 国产视频一区二区在线| 欧美私人免费视频| 欧美精品一卡二卡| 欧美一级久久久| 欧美一区二区久久| 一区二区三区四区蜜桃| 午夜激情一区二区三区| 成人免费毛片片v| 欧美日韩中文精品| 国产精品人人做人人爽人人添| 亚洲国产成人高清精品| 波波电影院一区二区三区| 日韩欧美在线网站| 肉色丝袜一区二区| 欧美精品日韩一区| 亚洲精品成人悠悠色影视| 国产精品1区2区3区在线观看| 欧亚洲嫩模精品一区三区| 亚洲国产精品一区二区www在线| 久久精品国产精品亚洲红杏| www.亚洲色图| 制服丝袜在线91| 日本视频一区二区| 久久精品视频免费| 在线观看av一区二区| 国产一区欧美一区| 一区二区三区中文字幕| 精品欧美一区二区三区精品久久| 国产成人av一区| 人人狠狠综合久久亚洲| 国产精品每日更新在线播放网址| 欧美羞羞免费网站| 国产精品白丝jk黑袜喷水| 亚洲小说春色综合另类电影| 国产美女精品一区二区三区| 色综合一个色综合| 亚洲午夜精品久久久久久久久| 欧美性做爰猛烈叫床潮| 美脚の诱脚舐め脚责91 | 日韩成人一区二区三区在线观看| 制服.丝袜.亚洲.中文.综合| 国产在线视视频有精品| 亚洲成精国产精品女| 久久综合av免费| 国产伦精品一区二区三区在线观看| av不卡免费电影| 欧美成人精品高清在线播放| 免费成人av在线| 欧美亚洲一区二区在线观看| 亚洲桃色在线一区| jlzzjlzz欧美大全| 亚洲图片有声小说| 欧美国产国产综合| 日韩一级大片在线观看| 久久成人久久鬼色| 一区二区三区日韩在线观看| 久久综合九色综合欧美98| 欧美精品久久天天躁| 日本电影欧美片| 成人av一区二区三区| 麻豆久久久久久| 日韩精彩视频在线观看| 一区二区三区四区在线免费观看 | 韩日av一区二区| 亚洲久草在线视频| 亚洲欧洲精品一区二区三区不卡| 亚洲精品一区二区三区精华液| 欧美一级片在线看| 欧美一卡2卡三卡4卡5免费| 欧美在线视频你懂得| 色婷婷国产精品| 日韩欧美一区二区三区在线| 欧美性生活一区| 成人午夜电影久久影院| 亚洲免费av高清| 久久久亚洲综合| 国产一区在线不卡| 亚洲一区二区精品视频| 91精品午夜视频| 欧美日韩一级二级三级| 日本道精品一区二区三区| 在线观看日韩电影| 91精品国产综合久久国产大片| 欧美一级二级三级蜜桃| 精品国产网站在线观看| 一区二区三区欧美视频| 五月激情丁香一区二区三区| 中文字幕亚洲不卡| 日韩欧美区一区二| 欧美日韩在线直播| 欧美午夜电影网| 91香蕉视频污| 欧美电视剧在线看免费| 欧美精品一区二区三区高清aⅴ| 成人美女在线观看| 91丨九色丨黑人外教| 欧美伦理电影网| 国产精品素人视频| 日韩av电影免费观看高清完整版 | 亚洲欧洲另类国产综合| 午夜精品视频在线观看| 成人手机在线视频| 欧美一区二区在线不卡| 久久免费电影网| 日本欧美久久久久免费播放网| 国产激情视频一区二区三区欧美| 色天使久久综合网天天| 久久精品欧美一区二区三区麻豆 | 一级中文字幕一区二区| 国产高清精品久久久久| 欧美一级日韩免费不卡| 亚洲综合丁香婷婷六月香| 成人网男人的天堂| 国产日韩欧美亚洲| 大陆成人av片| 国产日韩欧美综合一区| 国产精品中文有码| 欧美tickle裸体挠脚心vk| 日韩专区一卡二卡| 欧美精品一卡两卡| 国产丝袜美腿一区二区三区| 免费人成在线不卡|