uploadfile.java

来自「欢迎使用 FastJsp 开发框架! 编译说明: * 若要生成Api J」· Java 代码 · 共 83 行

JAVA
83
字号
// Copyright 2005-2007 onetsoft.com
//
// 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 com.onetsoft.fastjsp.request;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

/**
 * 上载文件接口
 *
 * @author <a href="mailto:hgw@onetsoft.com">hgw</a>
 */
public interface UploadFile {
    /**
     * 上载文件名称
     *
     * @return
     */
    public String getFileName();

    /**
     * 返回客户端文件名称
     *
     * @return
     */
    public String getFilePath();

    /**
     * 返回文件流
     *
     * @return
     */
    public InputStream getStream() throws IOException;


    /**
     * 返回上载文件的MIME类型
     * 注:可能返回值为null
     *
     * @return
     */
    public String getContentType();

    /**
     * 将上载文件写到指定文件中
     * 此方法可多次调用
     *
     * @param file
     */
    public void write(File file) throws Exception;

    /**
     * 若上载文件在内存中,则返回true,若为系统上载临时文件则返回false
     */

    public boolean isInMemory();

    /**
     * 返回上载文件大小
     * 单位:bytes
     */

    public long getSize();

    /**
     * 手动清理上载临时文件
     * 注:系统会自动清理产生的临时文件,此方法有助于加速清理。
     */
    void cleanup();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?