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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? defaultfileitemtest.java

?? apache commons-fileupload-1.2.jar
?? JAVA
字號:
/* * 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;import java.io.File;import java.io.IOException;import java.io.OutputStream;import java.util.Arrays;import junit.framework.TestCase;import org.apache.commons.fileupload.DefaultFileItem;import org.apache.commons.fileupload.DefaultFileItemFactory;/** * Unit tests for {@link org.apache.commons.fileupload.DefaultFileItem}. * * @author <a href="mailto:martinc@apache.org">Martin Cooper</a> */public class DefaultFileItemTest extends TestCase {    /**     * Content type for regular form items.     */    private static final String textContentType = "text/plain";    /**     * Content type for file uploads.     */    private static final String fileContentType = "application/octet-stream";    /**     * Very low threshold for testing memory versus disk options.     */    private static final int threshold = 16;    /**     * Standard JUnit test case constructor.     *     * @param name The name of the test case.     */    public DefaultFileItemTest(String name)    {        super(name);    }    /**     * Test construction of a regular text field.     */    public void testTextFieldConstruction()    {        FileItemFactory factory = createFactory(null);        String textFieldName = "textField";        FileItem item = factory.createItem(                textFieldName,                textContentType,                true,                null        );        assertNotNull(item);        assertEquals(item.getFieldName(), textFieldName);        assertEquals(item.getContentType(), textContentType);        assertTrue(item.isFormField());        assertNull(item.getName());    }    /**     * Test construction of a file field.     */    public void testFileFieldConstruction()    {        FileItemFactory factory = createFactory(null);        String fileFieldName = "fileField";        String fileName = "originalFileName";        FileItem item = factory.createItem(                fileFieldName,                fileContentType,                false,                fileName        );        assertNotNull(item);        assertEquals(item.getFieldName(), fileFieldName);        assertEquals(item.getContentType(), fileContentType);        assertFalse(item.isFormField());        assertEquals(item.getName(), fileName);    }    /**     * Test creation of a field for which the amount of data falls below the     * configured threshold.     */    public void testBelowThreshold()    {        FileItemFactory factory = createFactory(null);        String textFieldName = "textField";        String textFieldValue = "0123456789";        byte[] testFieldValueBytes = textFieldValue.getBytes();        FileItem item = factory.createItem(                textFieldName,                textContentType,                true,                null        );        assertNotNull(item);        try        {            OutputStream os = item.getOutputStream();            os.write(testFieldValueBytes);            os.close();        }        catch(IOException e)        {            fail("Unexpected IOException");        }        assertTrue(item.isInMemory());        assertEquals(item.getSize(), testFieldValueBytes.length);        assertTrue(Arrays.equals(item.get(), testFieldValueBytes));        assertEquals(item.getString(), textFieldValue);    }    /**     * Test creation of a field for which the amount of data falls above the     * configured threshold, where no specific repository is configured.     */    public void testAboveThresholdDefaultRepository()    {        doTestAboveThreshold(null);    }    /**     * Test creation of a field for which the amount of data falls above the     * configured threshold, where a specific repository is configured.     */    public void testAboveThresholdSpecifiedRepository()    {        String tempPath = System.getProperty("java.io.tmpdir");        String tempDirName = "testAboveThresholdSpecifiedRepository";        File tempDir = new File(tempPath, tempDirName);        tempDir.mkdir();        doTestAboveThreshold(tempDir);        assertTrue(tempDir.delete());    }    /**     * Common code for cases where the amount of data is above the configured     * threshold, but the ultimate destination of the data has not yet been     * determined.     *     * @param repository The directory within which temporary files will be     *                   created.     */    public void doTestAboveThreshold(File repository)    {        FileItemFactory factory = createFactory(repository);        String textFieldName = "textField";        String textFieldValue = "01234567890123456789";        byte[] testFieldValueBytes = textFieldValue.getBytes();        FileItem item = factory.createItem(                textFieldName,                textContentType,                true,                null        );        assertNotNull(item);        try        {            OutputStream os = item.getOutputStream();            os.write(testFieldValueBytes);            os.close();        }        catch(IOException e)        {            fail("Unexpected IOException");        }        assertFalse(item.isInMemory());        assertEquals(item.getSize(), testFieldValueBytes.length);        assertTrue(Arrays.equals(item.get(), testFieldValueBytes));        assertEquals(item.getString(), textFieldValue);        assertTrue(item instanceof DefaultFileItem);        DefaultFileItem dfi = (DefaultFileItem) item;        File storeLocation = dfi.getStoreLocation();        assertNotNull(storeLocation);        assertTrue(storeLocation.exists());        assertEquals(storeLocation.length(), testFieldValueBytes.length);        if (repository != null)        {            assertEquals(storeLocation.getParentFile(), repository);        }        item.delete();    }    /**     * Creates a new <code>FileItemFactory</code> and returns it, obscuring     * from the caller the underlying implementation of this interface.     *     * @param repository The directory within which temporary files will be     *                   created.     * @return the new <code>FileItemFactory</code> instance.     */    protected FileItemFactory createFactory(File repository)    {        return new DefaultFileItemFactory(threshold, repository);    }    static final String CHARSET_ISO88591 = "ISO-8859-1";    static final String CHARSET_ASCII = "US-ASCII";    static final String CHARSET_UTF8 = "UTF-8";    static final String CHARSET_KOI8_R = "KOI8_R";    static final String CHARSET_WIN1251 = "Cp1251";    static final int SWISS_GERMAN_STUFF_UNICODE [] =     {        0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4    };        static final int SWISS_GERMAN_STUFF_ISO8859_1 [] =     {        0x47, 0x72, 0xFC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xE4, 0x6D, 0xE4    };        static final int SWISS_GERMAN_STUFF_UTF8 [] =     {        0x47, 0x72, 0xC3, 0xBC, 0x65, 0x7A, 0x69, 0x5F, 0x7A, 0xC3, 0xA4,        0x6D, 0xC3, 0xA4    };    static final int RUSSIAN_STUFF_UNICODE [] =     {        0x412, 0x441, 0x435, 0x43C, 0x5F, 0x43F, 0x440, 0x438,         0x432, 0x435, 0x442     };     static final int RUSSIAN_STUFF_UTF8 [] =     {        0xD0, 0x92, 0xD1, 0x81, 0xD0, 0xB5, 0xD0, 0xBC, 0x5F,         0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0,         0xB5, 0xD1, 0x82    };    static final int RUSSIAN_STUFF_KOI8R [] =     {        0xF7, 0xD3, 0xC5, 0xCD, 0x5F, 0xD0, 0xD2, 0xC9, 0xD7,         0xC5, 0xD4    };    static final int RUSSIAN_STUFF_WIN1251 [] =     {        0xC2, 0xF1, 0xE5, 0xEC, 0x5F, 0xEF, 0xF0, 0xE8, 0xE2,         0xE5, 0xF2    };    private static String constructString(int[] unicodeChars)    {        StringBuffer buffer = new StringBuffer();        if (unicodeChars != null)        {            for (int i = 0; i < unicodeChars.length; i++)            {                buffer.append((char) unicodeChars[i]);            }        }        return buffer.toString();    }    /**     * Test construction of content charset.     */    public void testContentCharSet() throws Exception    {        FileItemFactory factory = createFactory(null);        String teststr = constructString(SWISS_GERMAN_STUFF_UNICODE);        FileItem item =            factory.createItem(                "doesnotmatter",                "text/plain; charset=" + CHARSET_ISO88591,                true,                null);        OutputStream outstream = item.getOutputStream();        for (int i = 0; i < SWISS_GERMAN_STUFF_ISO8859_1.length; i++)        {            outstream.write(SWISS_GERMAN_STUFF_ISO8859_1[i]);        }        outstream.close();        assertEquals(teststr, teststr, item.getString());        item =            factory.createItem(                "doesnotmatter",                "text/plain; charset=" + CHARSET_UTF8,                true,                null);        outstream = item.getOutputStream();        for (int i = 0; i < SWISS_GERMAN_STUFF_UTF8.length; i++)        {            outstream.write(SWISS_GERMAN_STUFF_UTF8[i]);        }        outstream.close();        assertEquals(teststr, teststr, item.getString());        teststr = constructString(RUSSIAN_STUFF_UNICODE);        item =            factory.createItem(                "doesnotmatter",                "text/plain; charset=" + CHARSET_KOI8_R,                true,                null);        outstream = item.getOutputStream();        for (int i = 0; i < RUSSIAN_STUFF_KOI8R.length; i++)        {            outstream.write(RUSSIAN_STUFF_KOI8R[i]);        }        outstream.close();        assertEquals(teststr, teststr, item.getString());        item =            factory.createItem(                "doesnotmatter",                "text/plain; charset=" + CHARSET_WIN1251,                true,                null);        outstream = item.getOutputStream();        for (int i = 0; i < RUSSIAN_STUFF_WIN1251.length; i++)        {            outstream.write(RUSSIAN_STUFF_WIN1251[i]);        }        outstream.close();        assertEquals(teststr, teststr, item.getString());        item =            factory.createItem(                "doesnotmatter",                "text/plain; charset=" + CHARSET_UTF8,                true,                null);        outstream = item.getOutputStream();        for (int i = 0; i < RUSSIAN_STUFF_UTF8.length; i++)        {            outstream.write(RUSSIAN_STUFF_UTF8[i]);        }        outstream.close();        assertEquals(teststr, teststr, item.getString());    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品国产一区| 丁香婷婷综合激情五月色| 不卡在线视频中文字幕| 亚洲精品国产无套在线观| 欧美老年两性高潮| 国产精品99久久久久久久女警 | 这里只有精品电影| 国产激情视频一区二区三区欧美| 欧美韩国日本综合| 欧美日韩国产bt| 国产不卡视频在线观看| 国产精品乱子久久久久| 欧美二区三区91| 大尺度一区二区| 日韩不卡手机在线v区| 91精品国产综合久久精品| 成人美女视频在线观看| 香蕉影视欧美成人| 日韩欧美一区二区视频| 国产综合成人久久大片91| 亚洲欧美另类小说视频| 精品免费国产一区二区三区四区| 99精品视频免费在线观看| 喷水一区二区三区| 亚洲伦理在线精品| 国产网站一区二区| 欧美福利视频导航| 国产一区二区不卡老阿姨| 亚洲第一狼人社区| 国产精品女同一区二区三区| 欧美tk丨vk视频| 日本精品裸体写真集在线观看 | 国产主播一区二区| 亚洲va在线va天堂| 国产精品色噜噜| wwww国产精品欧美| 91精品国产综合久久福利软件 | 91在线国产福利| 国产麻豆91精品| 肉色丝袜一区二区| 国产精品免费视频网站| 精品国精品国产尤物美女| 欧美高清性hdvideosex| 色婷婷综合久久久中文字幕| 国产精品亚洲一区二区三区在线 | 国产91精品欧美| 蜜臀av性久久久久蜜臀aⅴ流畅 | 日本一区二区成人| 久久久99精品免费观看| 2020国产精品自拍| 91精品国产一区二区三区香蕉| 欧美私模裸体表演在线观看| 在线视频综合导航| 成人av资源站| 99久久伊人网影院| 国产精品系列在线观看| 国产呦萝稀缺另类资源| 久久99精品久久久久久久久久久久| 同产精品九九九| 亚洲国产va精品久久久不卡综合| 一区二区三区中文字幕| 国产精品美日韩| 亚洲欧美自拍偷拍色图| 亚洲人亚洲人成电影网站色| 亚洲丝袜自拍清纯另类| 亚洲女与黑人做爰| 亚洲精品视频自拍| 亚洲精品写真福利| 午夜精品一区二区三区三上悠亚| 亚洲一区二区av在线| 亚洲老司机在线| 亚洲国产精品嫩草影院| 国产精品国产成人国产三级| 亚洲丝袜美腿综合| 亚洲制服丝袜在线| 天天操天天干天天综合网| 亚洲国产欧美在线| 全国精品久久少妇| 国产伦精品一区二区三区视频青涩 | 国精产品一区一区三区mba视频 | 日韩成人午夜电影| 国产精品自拍一区| 日本精品一级二级| 精品福利在线导航| 亚洲一区二三区| 国产一区二区三区久久悠悠色av| 一本到一区二区三区| 精品国产亚洲在线| 一区二区三区电影在线播| 蜜臀av国产精品久久久久| a级高清视频欧美日韩| 欧美一区二区三区四区在线观看| 亚洲欧美综合色| 精品亚洲欧美一区| 欧美男男青年gay1069videost | 日韩精品专区在线影院观看| 国产精品久久久久久久久久免费看 | 成人激情小说网站| 欧美一区午夜精品| 亚洲免费观看高清完整版在线观看 | 91免费国产视频网站| 欧美v日韩v国产v| 亚洲不卡一区二区三区| 成人福利在线看| 欧美变态凌虐bdsm| 午夜电影网亚洲视频| 91免费精品国自产拍在线不卡| 国产亚洲污的网站| 久久精品国产一区二区| 欧美日韩成人一区| 亚洲综合丁香婷婷六月香| 成人av电影免费在线播放| 亚洲精品在线免费观看视频| 日韩专区在线视频| 欧美色图免费看| 亚洲免费电影在线| 成人av电影观看| 国产精品毛片大码女人| 国产美女主播视频一区| 精品国产乱码久久| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美日韩国产成人在线91| 亚洲图片欧美一区| 91国产成人在线| 亚洲一区二区精品久久av| 91极品视觉盛宴| 亚洲黄色免费电影| 色哟哟一区二区| 一区二区三区在线视频免费 | 26uuu另类欧美亚洲曰本| 日本视频免费一区| 5月丁香婷婷综合| 日本欧美在线观看| 日韩美女主播在线视频一区二区三区| 亚洲一级二级在线| 欧美少妇bbb| 亚洲va国产va欧美va观看| 欧美日韩高清一区二区| 天天色天天爱天天射综合| 欧美一级淫片007| 国内精品久久久久影院薰衣草 | 国产麻豆欧美日韩一区| 国产午夜精品一区二区三区四区| 国产精一品亚洲二区在线视频| 国产色一区二区| av午夜一区麻豆| 亚洲自拍与偷拍| 欧美日韩国产首页在线观看| 丝袜亚洲另类丝袜在线| 日韩欧美综合一区| 国产一区二区调教| 国产精品美女一区二区| 91猫先生在线| 天堂成人国产精品一区| 欧美一区二区在线观看| 紧缚奴在线一区二区三区| 亚洲成精国产精品女| 日韩欧美视频一区| 国产真实乱子伦精品视频| 国产偷国产偷精品高清尤物| 色中色一区二区| 日韩av一级片| 久久精品视频一区二区三区| 91看片淫黄大片一级在线观看| 亚洲午夜精品17c| 日韩精品一区二区三区视频在线观看| 国产精品综合网| 一区二区三区日韩精品视频| 欧美一区二区观看视频| 国产福利91精品一区| 一区二区成人在线视频| 日韩欧美国产小视频| 粉嫩av一区二区三区在线播放| 亚洲欧美一区二区三区国产精品 | 亚洲国产成人午夜在线一区 | 欧美亚洲综合在线| 狠狠久久亚洲欧美| 亚洲精品中文字幕乱码三区 | 欧美大片顶级少妇| 不卡电影免费在线播放一区| 亚洲成av人**亚洲成av**| 久久综合九色综合久久久精品综合| aa级大片欧美| 免费成人美女在线观看| 中文字幕中文字幕在线一区| 制服.丝袜.亚洲.中文.综合| av亚洲产国偷v产偷v自拍| 久久国产生活片100| 一区二区三区成人| 欧美精彩视频一区二区三区| 91麻豆精品国产| bt7086福利一区国产| 国产在线国偷精品产拍免费yy| 亚洲国产一区二区a毛片| 国产亚洲精品精华液| 日韩欧美在线影院| 欧美在线免费视屏| av成人免费在线| 国产精品一区二区在线播放| 丝袜美腿成人在线|