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

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

?? smartupload.java

?? smartupload原代碼 smartupload原代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
// FrontEnd Plus GUI for JAD
// DeCompiled : SmartUpload.class
/**
 * @file: SmartUpload.java
 * 文件上傳下載類.
 *
 * Revision History:
 *
 * Version: 1.00<br>
 * Reason: 修改toUTF8String=>toUnicode,以支持中文文件名下載。<br>
 * Author: whj<br>
 * Date: 2004-4-16<br>
 *
 * Version: 1.00<br>
 * Reason: 添加toUTF8String,以支持中文文件名下載。<br>
 * Author: whj<br>
 * Date: 2004-4-2<br>
 */
package com.jspsmart.upload;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;

// Referenced classes of package com.jspsmart.upload:
//            Files, Request, SmartUploadException, File

public class SmartUpload
{
    protected byte m_binArray[];
    protected HttpServletRequest m_request;
    protected HttpServletResponse m_response;
    protected ServletContext m_application;
    private int m_totalBytes;
    private int m_currentIndex;
    private int m_startData;
    private int m_endData;
    private String m_boundary;
    private long m_totalMaxFileSize;
    private long m_maxFileSize;
    private Vector m_deniedFilesList;
    private Vector m_allowedFilesList;
    private boolean m_denyPhysicalPath;
    private boolean m_forcePhysicalPath;
    private String m_contentDisposition;
    public static final int SAVE_AUTO = 0;
    public static final int SAVE_VIRTUAL = 1;
    public static final int SAVE_PHYSICAL = 2;
    private Files m_files;
    private Request m_formRequest;

    public SmartUpload()
    {
        m_totalBytes = 0;
        m_currentIndex = 0;
        m_startData = 0;
        m_endData = 0;
        m_boundary = new String();
        m_totalMaxFileSize = 0L;
        m_maxFileSize = 0L;
        m_deniedFilesList = new Vector();
        m_allowedFilesList = new Vector();
        m_denyPhysicalPath = false;
        m_forcePhysicalPath = false;
        m_contentDisposition = new String();
        m_files = new Files();
        m_formRequest = new Request();
    }

    public final void init(ServletConfig config)
        throws ServletException
    {
        m_application = config.getServletContext();
    }

    public void service(HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        m_request = request;
        m_response = response;
    }

    public final void initialize(ServletConfig config, HttpServletRequest request, HttpServletResponse response)
        throws ServletException
    {
        m_application = config.getServletContext();
        m_request = request;
        m_response = response;
    }

    public final void initialize(PageContext pageContext)
        throws ServletException
    {
        m_application = pageContext.getServletContext();
        m_request = (HttpServletRequest)pageContext.getRequest();
        m_response = (HttpServletResponse)pageContext.getResponse();
    }

    public final void initialize(ServletContext application, HttpSession session, HttpServletRequest request, HttpServletResponse response, JspWriter out)
        throws ServletException
    {
        m_application = application;
        m_request = request;
        m_response = response;
    }

    public void upload()
        throws SmartUploadException, IOException, ServletException
    {
        int totalRead = 0;
        int readBytes = 0;
        long totalFileSize = 0L;
        boolean found = false;
        String dataHeader = new String();
        String fieldName = new String();
        String fileName = new String();
        String fileExt = new String();
        String filePathName = new String();
        String contentType = new String();
        String contentDisp = new String();
        String typeMIME = new String();
        String subTypeMIME = new String();
        boolean isFile = false;
        m_totalBytes = m_request.getContentLength();
        m_binArray = new byte[m_totalBytes];
        for(; totalRead < m_totalBytes; totalRead += readBytes)
            try
            {
                m_request.getInputStream();
                readBytes = m_request.getInputStream().read(m_binArray, totalRead, m_totalBytes - totalRead);
            }
            catch(Exception e)
            {
                throw new SmartUploadException("Unable to upload.");
            }

        for(; !found && m_currentIndex < m_totalBytes; m_currentIndex++)
            if(m_binArray[m_currentIndex] == 13)
                found = true;
            else
                m_boundary = m_boundary + (char)m_binArray[m_currentIndex];

        if(m_currentIndex == 1)
            return;
        m_currentIndex++;
        do
        {
            if(m_currentIndex >= m_totalBytes)
                break;
            dataHeader = getDataHeader();
            m_currentIndex = m_currentIndex + 2;
            isFile = dataHeader.indexOf("filename") > 0;
            fieldName = getDataFieldValue(dataHeader, "name");
            if(isFile)
            {
                filePathName = getDataFieldValue(dataHeader, "filename");
                fileName = getFileName(filePathName);
                fileExt = getFileExt(fileName);
                contentType = getContentType(dataHeader);
                contentDisp = getContentDisp(dataHeader);
                typeMIME = getTypeMIME(contentType);
                subTypeMIME = getSubTypeMIME(contentType);
            }
            getDataSection();
            if(isFile && fileName.length() > 0)
            {
                if(m_deniedFilesList.contains(fileExt))
                    throw new SecurityException("The extension of the file is denied to be uploaded (1015).");
                if(!m_allowedFilesList.isEmpty() && !m_allowedFilesList.contains(fileExt))
                    throw new SecurityException("The extension of the file is not allowed to be uploaded (1010).");
                if(m_maxFileSize > (long)0 && (long)((m_endData - m_startData) + 1) > m_maxFileSize)
                    throw new SecurityException(String.valueOf((new StringBuffer("Size exceeded for this file : ")).append(fileName).append(" (1105).")));
                totalFileSize += (m_endData - m_startData) + 1;
                if(m_totalMaxFileSize > (long)0 && totalFileSize > m_totalMaxFileSize)
                    throw new SecurityException("Total File Size exceeded (1110).");
            }
            if(isFile)
            {
                com.jspsmart.upload.File newFile = new com.jspsmart.upload.File();
                newFile.setParent(this);
                newFile.setFieldName(fieldName);
                newFile.setFileName(fileName);
                newFile.setFileExt(fileExt);
                newFile.setFilePathName(filePathName);
                newFile.setIsMissing(filePathName.length() == 0);
                newFile.setContentType(contentType);
                newFile.setContentDisp(contentDisp);
                newFile.setTypeMIME(typeMIME);
                newFile.setSubTypeMIME(subTypeMIME);
                if(contentType.indexOf("application/x-macbinary") > 0)
                    m_startData = m_startData + 128;
                newFile.setSize((m_endData - m_startData) + 1);
                newFile.setStartData(m_startData);
                newFile.setEndData(m_endData);
                m_files.addFile(newFile);
            } else
            {
                String value = new String(m_binArray, m_startData, (m_endData - m_startData) + 1);
                m_formRequest.putParameter(fieldName, value);
            }
            if((char)m_binArray[m_currentIndex + 1] == '-')
                break;
            m_currentIndex = m_currentIndex + 2;
        } while(true);
    }

    public int save(String destPathName)
        throws SmartUploadException, IOException, ServletException
    {
        return save(destPathName, 0);
    }

    public int save(String destPathName, int option)
        throws SmartUploadException, IOException, ServletException
    {
        int count = 0;
        if(destPathName == null)
            destPathName = m_application.getRealPath("/");
        if(destPathName.indexOf("/") != -1)
        {
            if(destPathName.charAt(destPathName.length() - 1) != '/')
                destPathName = String.valueOf(destPathName).concat("/");
        } else
        if(destPathName.charAt(destPathName.length() - 1) != '\\')
            destPathName = String.valueOf(destPathName).concat("\\");
        for(int i = 0; i < m_files.getCount(); i++)
            if(!m_files.getFile(i).isMissing())
            {
                m_files.getFile(i).saveAs(destPathName + m_files.getFile(i).getFileName(), option);
                count++;
            }

        return count;
    }

    public int getSize()
    {
        return m_totalBytes;
    }

    public byte getBinaryData(int index)
    {
        byte retval;
        try
        {
            retval = m_binArray[index];
        }
        catch(Exception e)
        {
            throw new ArrayIndexOutOfBoundsException("Index out of range (1005).");
        }
        return retval;
    }

    public Files getFiles()
    {
        return m_files;
    }

    public Request getRequest()
    {
        return m_formRequest;
    }

    public void downloadFile(String sourceFilePathName)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, null, null);
    }

    public void downloadFile(String sourceFilePathName, String contentType)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, contentType, null);
    }

    public void downloadFile(String sourceFilePathName, String contentType, String destFileName)
        throws SmartUploadException, IOException, ServletException
    {
        downloadFile(sourceFilePathName, contentType, destFileName, 65000);
    }

    public void downloadFile(String sourceFilePathName, String contentType, String destFileName, int blockSize)
        throws SmartUploadException, IOException, ServletException
    {
        if(sourceFilePathName == null)
            throw new IllegalArgumentException(String.valueOf((new StringBuffer("File '")).append(sourceFilePathName).append("' not found (1040).")));
        if(sourceFilePathName.equals(""))
            throw new IllegalArgumentException(String.valueOf((new StringBuffer("File '")).append(sourceFilePathName).append("' not found (1040).")));
        if(!isVirtual(sourceFilePathName) && m_denyPhysicalPath)
            throw new SecurityException("Physical path is denied (1035).");

		//System.out.println("smartupload:fiepath befroe mapping="+sourceFilePathName);
		//System.out.println("smartupload:get realpath fiepath=" + m_application.getRealPath(sourceFilePathName));
        if(isVirtual(sourceFilePathName)) {
			//System.out.println("smartupload:is virtual fiepath=" + m_application.getRealPath(sourceFilePathName));
			sourceFilePathName = m_application.getRealPath(sourceFilePathName);
        }
        //System.out.println("smartupload:fiepath after mapping="+sourceFilePathName);
        File file = new File(sourceFilePathName);
        FileInputStream fileIn = new FileInputStream(file);
        long fileLen = file.length();
        int readBytes = 0;
        int totalRead = 0;
        byte b[] = new byte[blockSize];
        if(contentType == null)
            m_response.setContentType("application/x-msdownload");
        else
        if(contentType.length() == 0)
            m_response.setContentType("application/x-msdownload");
        else
            m_response.setContentType(contentType);
        m_response.setContentLength((int)fileLen);
        m_contentDisposition = m_contentDisposition != null ? m_contentDisposition : "attachment;";

        if(destFileName == null)
           m_response.setHeader("Content-Disposition", String.valueOf((new StringBuffer(String.valueOf(m_contentDisposition))).append(" filename=").append(toUnicode(getFileName(sourceFilePathName)))));
        else if(destFileName.length() == 0)
            m_response.setHeader("Content-Disposition", m_contentDisposition);
        else
            m_response.setHeader("Content-Disposition", String.valueOf((new StringBuffer(String.valueOf(m_contentDisposition))).append(" filename=").append(toUnicode(destFileName))));

        while((long)totalRead < fileLen)
        {
            readBytes = fileIn.read(b, 0, blockSize);
            totalRead += readBytes;
            m_response.getOutputStream().write(b, 0, readBytes);
        }
        fileIn.close();
    }

    public void downloadField(ResultSet rs, String columnName, String contentType, String destFileName)
        throws SQLException, IOException, ServletException
    {
        if(rs == null)
            throw new IllegalArgumentException("The RecordSet cannot be null (1045).");
        if(columnName == null)
            throw new IllegalArgumentException("The columnName cannot be null (1050).");
        if(columnName.length() == 0)
            throw new IllegalArgumentException("The columnName cannot be empty (1055).");
        byte b[] = rs.getBytes(columnName);
        if(contentType == null)
            m_response.setContentType("application/x-msdownload");
        else
        if(contentType.length() == 0)
            m_response.setContentType("application/x-msdownload");
        else
            m_response.setContentType(contentType);
        m_response.setContentLength(b.length);
        if(destFileName == null)
            m_response.setHeader("Content-Disposition", "attachment;");
        else
        if(destFileName.length() == 0)
            m_response.setHeader("Content-Disposition", "attachment;");
        else
            m_response.setHeader("Content-Disposition", "attachment; filename=".concat(String.valueOf(destFileName)));
        m_response.getOutputStream().write(b, 0, b.length);
    }

    public void fieldToFile(ResultSet rs, String columnName, String destFilePathName)
        throws SQLException, SmartUploadException, IOException, ServletException
    {
        try
        {
            if(m_application.getRealPath(destFilePathName) != null)
                destFilePathName = m_application.getRealPath(destFilePathName);
            InputStream is_data = rs.getBinaryStream(columnName);
            FileOutputStream file = new FileOutputStream(destFilePathName);
            int c;
            while((c = is_data.read()) != -1)
                file.write(c);
            file.close();
        }
        catch(Exception e)
        {
            throw new SmartUploadException("Unable to save file from the DataBase (1020).");
        }
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91激情在线视频| 色噜噜偷拍精品综合在线| 美女网站色91| 日本色综合中文字幕| 午夜影视日本亚洲欧洲精品| 亚洲国产欧美日韩另类综合 | 2022国产精品视频| 亚洲精品一区二区三区蜜桃下载| 欧美成人精品福利| 精品久久久久久久久久久院品网| 日韩精品在线一区二区| 精品久久久久香蕉网| 久久久亚洲精华液精华液精华液| 久久综合九色综合97_久久久| 久久综合狠狠综合| 国产精品午夜免费| 亚洲人成网站色在线观看| 一区二区高清免费观看影视大全 | 成人午夜私人影院| 99久久精品一区| 欧美视频完全免费看| 91麻豆精品国产91| 亚洲精品一线二线三线无人区| 国产三级精品视频| 亚洲精品欧美二区三区中文字幕| 亚洲综合色成人| 日本视频一区二区三区| 国产老肥熟一区二区三区| 成人免费的视频| 欧美色电影在线| 精品久久一区二区| 18欧美乱大交hd1984| 亚洲成人综合视频| 黄色精品一二区| 91麻豆国产精品久久| 在线电影院国产精品| 久久久噜噜噜久噜久久综合| 亚洲素人一区二区| 日本女人一区二区三区| 国产成人鲁色资源国产91色综| 91福利在线观看| 精品捆绑美女sm三区| 亚洲人成网站在线| 久久狠狠亚洲综合| 91同城在线观看| 日韩一区二区三区观看| 国产精品九色蝌蚪自拍| 午夜久久久久久| 国产成人亚洲综合色影视| 欧美三级一区二区| 国产欧美精品在线观看| 一区二区三区在线免费观看| 久久99久久久久| 色婷婷久久99综合精品jk白丝| 日韩欧美国产精品| 亚洲精品中文在线影院| 欧美在线一区二区三区| 26uuu精品一区二区三区四区在线| 综合分类小说区另类春色亚洲小说欧美| 亚洲成人在线免费| 成人夜色视频网站在线观看| 欧美日韩国产高清一区| 国产精品视频免费看| 男男视频亚洲欧美| 一本久道中文字幕精品亚洲嫩| wwwwww.欧美系列| 日韩精品久久理论片| gogo大胆日本视频一区| 久久亚洲精品国产精品紫薇| 五月激情综合色| 91热门视频在线观看| 精品国产乱码久久久久久牛牛| 亚洲成av人片一区二区| 99久久婷婷国产综合精品电影 | 亚洲一区二区三区四区的| 国产激情一区二区三区四区| 91精品国产一区二区三区香蕉| 亚洲图片你懂的| 成人丝袜高跟foot| 久久亚洲一区二区三区明星换脸| 午夜精品福利一区二区三区蜜桃| 色婷婷综合久色| 国产精品三级视频| 国产激情一区二区三区四区| 日韩精品一区二区三区视频在线观看 | 欧美日韩一区二区不卡| 国产精品久久久久久久裸模| 国产尤物一区二区在线| 日韩美女一区二区三区四区| 午夜精品久久久久久不卡8050| 99视频有精品| 国产精品国产三级国产普通话99| 国产一区激情在线| 欧美精品一区二区在线播放| 蜜桃传媒麻豆第一区在线观看| 欧美男人的天堂一二区| 亚洲国产一区二区在线播放| 在线观看亚洲a| 一级日本不卡的影视| 色综合久久中文综合久久97| 亚洲视频香蕉人妖| 97久久精品人人澡人人爽| 亚洲欧洲精品成人久久奇米网 | www国产成人免费观看视频 深夜成人网 | 视频一区国产视频| 欧美高清hd18日本| 免费亚洲电影在线| 日韩精品一区二区三区四区视频 | 国产精品99久久久久久有的能看| 欧美mv日韩mv| 国产麻豆精品一区二区| 日本一区二区免费在线观看视频| 成人性色生活片免费看爆迷你毛片| 国产精品网曝门| 一本久久精品一区二区| 亚洲电影一级片| 日韩免费观看高清完整版 | 欧美福利一区二区| 麻豆精品视频在线| 久久久久久久久久美女| 成人激情小说网站| 亚洲免费观看高清| 欧美日韩国产另类一区| 蓝色福利精品导航| 久久精品人人做人人综合| 99久久99久久综合| 亚洲妇女屁股眼交7| 欧美一级艳片视频免费观看| 国产一区二区不卡| 亚洲天堂精品视频| 91精品国产福利在线观看| 韩国v欧美v亚洲v日本v| 国产精品久久久久四虎| 欧美亚一区二区| 久久精品99久久久| 国产精品久久毛片| 欧美理论电影在线| 国产乱子伦一区二区三区国色天香| 国产精品情趣视频| 欧美三区在线观看| 国产成人亚洲综合a∨猫咪| 亚洲啪啪综合av一区二区三区| 欧美日本高清视频在线观看| 国产乱码一区二区三区| 亚洲午夜久久久久久久久电影院| 日韩免费观看2025年上映的电影| 成人av高清在线| 日韩成人av影视| 国产精品系列在线| 日韩一区二区在线观看| 成人免费的视频| 麻豆精品视频在线| 亚洲美女少妇撒尿| 日韩免费视频一区| 欧洲一区在线观看| 国产乱对白刺激视频不卡| 亚洲一区在线看| 国产日韩av一区| 欧美疯狂做受xxxx富婆| 国产凹凸在线观看一区二区 | 91福利资源站| 国产精品一区2区| 午夜精品福利一区二区三区蜜桃| 欧美激情一区二区三区在线| 91精品在线一区二区| 波波电影院一区二区三区| 免费观看在线色综合| 亚洲老妇xxxxxx| 国产亚洲美州欧州综合国| 欧美日韩极品在线观看一区| 99久久精品国产导航| 国精品**一区二区三区在线蜜桃| 亚洲最大成人网4388xx| 亚洲国产成人私人影院tom | 一区二区三区日本| 久久久午夜电影| 91麻豆精品国产91久久久| 91成人国产精品| 成人在线视频首页| 激情五月激情综合网| 天堂蜜桃91精品| 一区二区在线免费| 国产精品久久久久aaaa樱花 | 中文一区二区在线观看| 日韩欧美在线观看一区二区三区| 色天天综合久久久久综合片| 国产99久久久国产精品免费看| 久久精品国产澳门| 日韩成人伦理电影在线观看| 午夜精品影院在线观看| 亚洲激情成人在线| 亚洲欧洲韩国日本视频| 国产精品久久久久桃色tv| 国产欧美日韩三区| 久久综合网色—综合色88| 日韩欧美在线123| 精品日产卡一卡二卡麻豆| 91精品国产综合久久蜜臀| 欧美日韩精品一区二区| 欧美在线观看一二区|