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

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

?? smartupload.java

?? smarty原碼和幫助說明,說明下面的文字是本人寫給初學者的
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SmartUpload.java

package com.jspsmart.upload;

import java.io.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.servlet.*;
import javax.servlet.http.*;
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).");
        if(isVirtual(sourceFilePathName))
            sourceFilePathName = m_application.getRealPath(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(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(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).");
        }
    }

    private String getDataFieldValue(String dataHeader, String fieldName)
    {
        String token = new String();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩精品综合一本久道在线视频| 亚洲一区二区三区国产| 一区二区三区在线视频观看58| 免费视频最近日韩| 成人免费高清在线观看| 日韩欧美一二区| 亚洲一区二区中文在线| av中文字幕一区| 久久久不卡网国产精品二区| 亚洲成人动漫在线观看| 色哟哟国产精品免费观看| 久久夜色精品国产噜噜av| 日韩不卡一二三区| 欧美裸体一区二区三区| 亚洲女子a中天字幕| 国产曰批免费观看久久久| 555夜色666亚洲国产免| 亚洲自拍另类综合| 色综合 综合色| 日韩理论片网站| 99视频一区二区| 国产精品护士白丝一区av| 懂色av噜噜一区二区三区av| 精品国产乱码久久久久久牛牛| 免费观看久久久4p| 日韩情涩欧美日韩视频| 青青国产91久久久久久| 欧美肥大bbwbbw高潮| 日韩不卡一区二区| 欧美一级午夜免费电影| 欧美aaa在线| 精品国产在天天线2019| 国产精品一区二区你懂的| 精品99一区二区| 国产麻豆视频精品| 国产校园另类小说区| 粉嫩嫩av羞羞动漫久久久| 日本一区二区电影| 91久久香蕉国产日韩欧美9色| 最新日韩av在线| 欧美综合在线视频| 丝袜诱惑亚洲看片| 久久综合色天天久久综合图片| 国产美女在线观看一区| 国产精品灌醉下药二区| 欧美午夜精品一区二区蜜桃| 舔着乳尖日韩一区| 欧美不卡一二三| 成人妖精视频yjsp地址| 亚洲综合在线第一页| 欧美精品自拍偷拍| 国产一区免费电影| 国产精品乱码一区二三区小蝌蚪| 色综合久久天天| 天天综合色天天| 精品国产乱码91久久久久久网站| 国产 欧美在线| 夜夜精品视频一区二区| 日韩免费电影网站| 成人ar影院免费观看视频| 亚洲一区二区在线免费看| 精品国产成人在线影院| 色综合天天综合色综合av | 久久免费精品国产久精品久久久久 | 国产东北露脸精品视频| 亚洲欧美日韩国产手机在线 | 欧美日韩国产a| 精品一二三四区| 亚洲精品欧美二区三区中文字幕| 欧美一级欧美一级在线播放| 成人网男人的天堂| 日韩av中文字幕一区二区三区 | 欧美最猛黑人xxxxx猛交| 极品销魂美女一区二区三区| 亚洲免费观看高清完整版在线观看 | 亚洲精品伦理在线| 欧美videos大乳护士334| 一本大道av一区二区在线播放| 精品亚洲国内自在自线福利| 一区二区视频免费在线观看| 久久久久久日产精品| 欧美日韩综合在线免费观看| aaa欧美大片| 国产在线播放一区| 丝袜美腿一区二区三区| 亚洲精选视频免费看| 久久影院电视剧免费观看| 欧美精品久久99| 91福利在线观看| 国产露脸91国语对白| 美国十次综合导航| 亚洲bt欧美bt精品777| 亚洲女厕所小便bbb| 久久日一线二线三线suv| 91精品国产免费| 欧美日韩国产美| 欧美私人免费视频| 99久久亚洲一区二区三区青草| 国内精品在线播放| 麻豆91在线看| 麻豆国产精品官网| 理论电影国产精品| 人人超碰91尤物精品国产| 日韩中文字幕区一区有砖一区| 亚洲一区视频在线观看视频| 亚洲精品视频在线看| 一区二区三区资源| 亚洲黄色av一区| 亚洲成人福利片| 亚洲va韩国va欧美va精品| 亚洲国产精品自拍| 偷拍日韩校园综合在线| 午夜国产不卡在线观看视频| 五月综合激情日本mⅴ| 午夜精品久久久久久久久| 日韩国产在线观看一区| 免费在线观看成人| 精品一区二区三区免费| 国产一区二区精品久久91| 国产乱码精品一区二区三区忘忧草| 精品在线播放免费| 国产成人啪免费观看软件| 成人污污视频在线观看| 99久久99久久久精品齐齐| 日本精品一区二区三区四区的功能| 一本一道久久a久久精品综合蜜臀| 91久久精品网| 日韩一卡二卡三卡| 久久九九全国免费| 亚洲私人黄色宅男| 亚洲二区在线视频| 经典一区二区三区| 91尤物视频在线观看| 欧美三区在线视频| 精品三级在线观看| 国产精品成人免费精品自在线观看| 亚洲精品日日夜夜| 理论电影国产精品| av一二三不卡影片| 91精品国产91久久综合桃花| 久久久不卡影院| 亚洲一区二区三区中文字幕| 蜜桃视频在线观看一区| 大尺度一区二区| 欧美一区欧美二区| 国产精品嫩草影院av蜜臀| 视频一区免费在线观看| 国产乱人伦精品一区二区在线观看| 色综合激情五月| 久久亚洲私人国产精品va媚药| 亚洲日本丝袜连裤袜办公室| 欧美aaaaa成人免费观看视频| 成人国产精品免费| 欧美日韩1234| 亚洲国产高清在线观看视频| 日本视频中文字幕一区二区三区| 成人涩涩免费视频| 日韩欧美中文一区| 亚洲情趣在线观看| 国产在线麻豆精品观看| 在线一区二区三区做爰视频网站| 久久综合久久综合亚洲| 亚洲一区二区三区免费视频| 风间由美一区二区三区在线观看 | 韩国精品久久久| 色婷婷综合久色| 国产精品久久久久国产精品日日| 男女男精品视频| 欧美色图在线观看| 亚洲欧美综合在线精品| 国产精品99久久久久久久女警 | 日韩精品专区在线| 亚洲精品久久7777| 成人av网站免费观看| 亚洲精品一区二区三区99| 夜夜亚洲天天久久| 91老师片黄在线观看| 欧美国产精品专区| 国产一本一道久久香蕉| 日韩欧美高清dvd碟片| 日韩av网站免费在线| 欧美色区777第一页| 一区二区久久久| 色婷婷综合久久久久中文一区二区 | 欧美天天综合网| 亚洲美女在线国产| 99精品视频中文字幕| 中文一区一区三区高中清不卡| 狠狠色综合色综合网络| 日韩免费高清视频| 久久精品国产免费| 日韩一区二区麻豆国产| 美国三级日本三级久久99| 91精品国产综合久久婷婷香蕉 | 色婷婷亚洲综合| 亚洲欧美日韩国产成人精品影院 | 色综合天天综合网天天看片| 中文字幕一区二| 91在线观看污| 亚洲精品水蜜桃|