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

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

?? diskfileitem.java

?? < JavaME核心技術最佳實踐>>的全部源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright 2001-2005 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.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.rmi.server.UID;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. * * @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 399546 2006-05-04 04:53:30Z martinc $ */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 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;        } else {            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);    }    /**     * Returns the contents of the file as a String, using the default     * character encoding.  This method uses {@link #get()} to retrieve the     * contents of the file.     *

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲丝袜传媒另类| 欧美一区二区三区在| 青娱乐精品在线视频| 日韩美女视频一区二区| 日韩欧美一区在线| 91成人免费在线| 国产精品12区| 日韩成人一区二区三区在线观看| 国产精品蜜臀av| 精品国产亚洲在线| 欧美一区永久视频免费观看| 91免费观看在线| 国产ts人妖一区二区| 麻豆一区二区在线| 五月婷婷另类国产| 亚洲国产综合在线| 亚洲女与黑人做爰| 18成人在线视频| 国产农村妇女毛片精品久久麻豆| 日韩欧美电影在线| 91麻豆精品国产综合久久久久久| 91啦中文在线观看| 99久久精品国产一区| 成人午夜精品一区二区三区| 国产一区视频导航| 国产精品综合二区| 久草中文综合在线| 免费成人小视频| 免费高清视频精品| 美女网站色91| 狠狠色丁香九九婷婷综合五月| 亚洲h在线观看| 亚洲成av人**亚洲成av**| 亚洲精品国产无套在线观| 亚洲女性喷水在线观看一区| 亚洲少妇屁股交4| 亚洲欧美日韩中文字幕一区二区三区| 国产精品久久精品日日| 国产精品毛片无遮挡高清| 久久精品一区二区三区不卡 | 欧美日韩三级一区二区| 在线观看成人免费视频| 91久久精品一区二区三区| 一本久道久久综合中文字幕 | 韩国成人福利片在线播放| 蜜臀av性久久久久蜜臀aⅴ流畅| 麻豆精品国产91久久久久久| 久草这里只有精品视频| 国产精品自在在线| 99re成人精品视频| 欧美唯美清纯偷拍| 日韩三级在线观看| 国产亚洲自拍一区| 亚洲女性喷水在线观看一区| 亚洲一区二区三区四区在线免费观看 | 欧美群妇大交群的观看方式| 欧美日韩亚洲综合一区二区三区| 91精品久久久久久久91蜜桃| 亚洲视频一二区| 亚洲色欲色欲www在线观看| 亚洲国产视频a| 欧美a级一区二区| 国产九九视频一区二区三区| 成人一道本在线| 欧美视频自拍偷拍| 日韩精品资源二区在线| 国产精品日日摸夜夜摸av| 一区二区三区免费在线观看| 日本成人在线不卡视频| 国产成人亚洲综合a∨婷婷图片| 91一区二区在线| 欧美剧在线免费观看网站 | 亚洲一线二线三线视频| 日韩电影在线免费观看| 国产精品一二三在| 色哟哟欧美精品| 欧美不卡123| 亚洲欧美视频在线观看视频| 免费成人在线网站| 9i在线看片成人免费| 在线综合视频播放| 国产精品萝li| 日日摸夜夜添夜夜添精品视频 | 成人黄动漫网站免费app| 欧美伊人久久久久久午夜久久久久| 欧美一级高清片| 国产精品福利一区二区| 日本午夜精品视频在线观看| 成人午夜大片免费观看| 欧美一级免费大片| 亚洲视频一区二区在线观看| 精品一区二区日韩| 欧美调教femdomvk| 国产免费成人在线视频| 日本欧美肥老太交大片| 91视频观看视频| 久久久综合视频| 视频精品一区二区| 色综合久久中文综合久久97| www日韩大片| 日韩高清一级片| 91国产成人在线| 国产精品欧美久久久久无广告 | 日韩成人免费电影| 91免费观看在线| 国产蜜臀97一区二区三区| 蜜桃av一区二区| 7777女厕盗摄久久久| 亚洲黄色小视频| 91污片在线观看| 国产欧美一区二区精品秋霞影院 | 国产成人综合视频| 欧美成人精品二区三区99精品| 亚洲蜜桃精久久久久久久| 国产91在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 天天综合网天天综合色| 在线视频一区二区三区| 亚洲欧美日韩国产一区二区三区| 国产一区美女在线| 欧美大片顶级少妇| 麻豆精品在线观看| 亚洲精品伦理在线| 99精品久久免费看蜜臀剧情介绍| 国产欧美一区二区精品性| 狠狠色伊人亚洲综合成人| 日韩一级免费观看| 婷婷中文字幕综合| 欧美精品1区2区| 午夜精品在线视频一区| 欧美日韩一区二区三区免费看| 亚洲男人的天堂在线aⅴ视频| 成人午夜视频免费看| 国产精品久久久久影院亚瑟| 成人小视频免费观看| 日本一二三不卡| 成人免费毛片a| 亚洲欧美综合在线精品| 91麻豆福利精品推荐| 依依成人精品视频| 欧美性高清videossexo| 午夜精品爽啪视频| 在线成人av网站| 爽好久久久欧美精品| 日韩一级片在线观看| 狠狠色综合播放一区二区| 久久久久国产精品厨房| 成人免费黄色大片| 亚洲女人的天堂| 欧美日韩高清一区| 久久超级碰视频| 日本一区二区三区在线观看| 99在线精品免费| 亚洲v日本v欧美v久久精品| 6080午夜不卡| 国产一区二区看久久| 中文字幕日韩av资源站| 欧美亚洲动漫制服丝袜| 首页欧美精品中文字幕| 精品国产一区二区三区久久影院| 国产成人8x视频一区二区| 国产精品久久影院| 欧美日韩国产三级| 国产一区视频网站| 亚洲精品国产视频| 日韩一区二区视频在线观看| 国产精品一二三四区| 亚洲啪啪综合av一区二区三区| 欧美精品国产精品| 韩国av一区二区三区| 中文字幕视频一区二区三区久| 欧美日韩一二区| 国产不卡高清在线观看视频| 一区二区三区欧美日韩| 日韩精品一区在线观看| 91美女蜜桃在线| 亚洲国产综合视频在线观看| 精品国产一区二区在线观看| 丁香婷婷综合网| 午夜精品一区在线观看| 中文成人av在线| 欧美一区二区在线观看| 91亚洲国产成人精品一区二区三| 日韩不卡一区二区三区 | 亚洲欧美日韩在线不卡| 日韩欧美中文字幕一区| 91麻豆国产精品久久| 老司机免费视频一区二区三区| 国产精品国产三级国产aⅴ无密码| 91精品国产综合久久久蜜臀粉嫩 | 欧美高清激情brazzers| 国产宾馆实践打屁股91| 日本中文字幕一区二区有限公司| 国产精品美女久久久久久久久 | 在线视频欧美精品| 国产精品一区一区| 日本网站在线观看一区二区三区| 国产精品成人一区二区艾草| 亚洲精品一区二区在线观看| 久久久久亚洲蜜桃|