亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美日韩精品福利| 精品一区二区三区久久久| 日韩av一级片| 日韩和欧美一区二区| 日韩专区中文字幕一区二区| 91麻豆精品国产自产在线| 欧美图片一区二区三区| 欧美日韩黄色影视| 蜜臀av亚洲一区中文字幕| 一区二区三区国产精华| 亚洲视频综合在线| 精品在线免费视频| 成人av免费在线| 一区二区成人在线视频| 日韩极品在线观看| 麻豆国产精品官网| gogogo免费视频观看亚洲一| 欧美精品 国产精品| 精品一区二区三区在线播放视频| 中文字幕成人av| 在线91免费看| 97精品视频在线观看自产线路二| 亚洲女爱视频在线| 99久久伊人网影院| 欧美日韩综合色| 久久精品国产精品亚洲综合| 99久久婷婷国产综合精品电影| 欧美亚洲自拍偷拍| 国产精品中文有码| 亚洲超碰97人人做人人爱| 国产精品天美传媒| 国产九色sp调教91| 欧美色爱综合网| 成人av综合一区| 日韩午夜av电影| 亚洲一区二区三区四区在线免费观看| 国产免费成人在线视频| 欧美日韩一卡二卡三卡 | 国产一区二区在线免费观看| 国产精品亚洲第一| 欧美精三区欧美精三区| 日韩欧美美女一区二区三区| 亚洲最色的网站| 日韩欧美另类在线| 国产精品久久久久aaaa樱花 | 一本到不卡精品视频在线观看| 欧美色窝79yyyycom| 久草这里只有精品视频| 日韩精品色哟哟| 成人动漫精品一区二区| 激情av综合网| 奇米777欧美一区二区| 国产高清久久久久| 久久九九久久九九| 欧美日韩成人综合| 免费不卡在线视频| 亚洲精品一线二线三线| 欧美电影免费观看完整版| 欧美日韩国产一区| 久久尤物电影视频在线观看| 久久不见久久见免费视频1| 亚洲综合成人在线视频| 久久久久久久久伊人| 日韩你懂的在线观看| 国产ts人妖一区二区| 麻豆成人久久精品二区三区小说| 国产一区二区三区免费看| 久久99国产精品久久| 国产精品国产三级国产普通话蜜臀 | 视频一区视频二区中文字幕| 日产国产欧美视频一区精品| 久久国产精品99久久久久久老狼| 国产精品亚洲午夜一区二区三区| 粉嫩绯色av一区二区在线观看| 成人美女在线观看| 久久久午夜精品理论片中文字幕| 欧美精品一区男女天堂| 国产精品美女久久久久aⅴ| 亚洲欧美色图小说| 日韩中文字幕一区二区三区| 国产又粗又猛又爽又黄91精品| 东方欧美亚洲色图在线| 一本久久精品一区二区| 欧美精品免费视频| 2014亚洲片线观看视频免费| 《视频一区视频二区| 天使萌一区二区三区免费观看| 另类中文字幕网| 91美女片黄在线| 精品卡一卡二卡三卡四在线| 国产精品大尺度| 午夜精品一区二区三区三上悠亚| 国产一区二区三区四| 欧洲在线/亚洲| 日本一区免费视频| 亚洲香蕉伊在人在线观| 国模套图日韩精品一区二区| 色呦呦国产精品| 日韩欧美第一区| 一区二区三区四区激情| 一本大道久久a久久精品综合| 国产精品二三区| 久久这里只有精品6| 亚洲人成网站精品片在线观看| 天天av天天翘天天综合网| 国产激情一区二区三区四区| 亚洲国产精品欧美一二99| 婷婷久久综合九色综合绿巨人 | 亚洲欧美视频在线观看| 麻豆国产精品777777在线| 91久久精品一区二区二区| 国产亚洲一区二区三区四区| 婷婷一区二区三区| 色偷偷88欧美精品久久久| 久久久久国产成人精品亚洲午夜| 日韩精品一级中文字幕精品视频免费观看 | 久久精品综合网| 日精品一区二区三区| 一本高清dvd不卡在线观看| 国产免费久久精品| 久久国产视频网| 91精品国产综合久久久蜜臀图片| 一区二区三区中文字幕在线观看| 福利一区二区在线| 久久丝袜美腿综合| 久久se精品一区二区| 69堂国产成人免费视频| 亚洲国产综合在线| 色综合久久88色综合天天6| 国产亚洲欧美日韩俺去了| 久久99国产精品久久99果冻传媒| 日韩一区二区免费在线观看| 亚洲午夜精品一区二区三区他趣| 91网站在线播放| 中文字幕精品三区| 国产成人精品午夜视频免费| 久久九九久久九九| 国产福利一区二区三区视频| 久久久.com| 成人免费观看av| 亚洲色图20p| 在线精品观看国产| 亚洲成av人片在线观看无码| 欧美高清性hdvideosex| 日韩不卡一区二区三区| 正在播放一区二区| 久久国产精品72免费观看| 久久夜色精品国产欧美乱极品| 欧美午夜理伦三级在线观看| 亚洲一区二区三区小说| 欧美高清视频www夜色资源网| 日韩精品欧美精品| 精品少妇一区二区三区免费观看| 国产一区三区三区| 欧美经典一区二区三区| 不卡一二三区首页| 亚洲一区二区三区不卡国产欧美| 欧美日韩国产高清一区二区三区| 免费在线成人网| 国产无人区一区二区三区| 99精品视频在线观看免费| 国产精品天干天干在观线| 色哟哟一区二区在线观看 | 国产欧美一区二区三区在线看蜜臀| 国产成人综合在线观看| 亚洲欧洲另类国产综合| 在线观看日韩毛片| 婷婷丁香激情综合| 久久色.com| 99久久伊人网影院| 一区二区在线观看免费视频播放| 欧美三级韩国三级日本三斤| 毛片不卡一区二区| 国产精品超碰97尤物18| 欧美日韩中文精品| 久久超碰97人人做人人爱| 国产欧美日韩亚州综合 | 欧美性大战久久| 七七婷婷婷婷精品国产| 国产亚洲综合性久久久影院| 97成人超碰视| 亚洲午夜精品一区二区三区他趣| 91.com在线观看| 日本中文字幕一区| 中文一区在线播放| 欧美日韩免费不卡视频一区二区三区| 全部av―极品视觉盛宴亚洲| 国产精品国产三级国产aⅴ无密码| 欧美日韩一区国产| 床上的激情91.| 日韩 欧美一区二区三区| 1000部国产精品成人观看| 日韩美女视频在线| 在线看一区二区| 国产黄色91视频| 免费成人性网站| 亚洲一区二三区| 中文字幕va一区二区三区| 日韩一级黄色大片| 色婷婷亚洲婷婷|