com.feilong.component.upload.MultipartFileResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of feilong Show documentation
Show all versions of feilong Show documentation
feilong is a suite of core and expanded libraries that include utility classes, http, excel,cvs, io classes, and much much more.
/*
* Copyright (C) 2008 feilong
*
* 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.feilong.component.upload;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
/**
* {@link MultipartFile} 解析器.
*
* @author feilong
* @since 1.5.4
*/
public interface MultipartFileResolver{
/**
* 将MultipartFile
上传到指定目录directoryName
下面重命名指定的文件名称fileName
.
*
*
* 如果{@link MultipartFile#isEmpty()},那么log warn并跳过
*
*
* @param multipartFile
* the multipart file
* @param directoryName
* 指定目录
* @param fileName
* the file name
* @return 如果 multipartFile
是null,抛出 {@link NullPointerException}
* 如果 directoryName
是null,抛出 {@link NullPointerException}
* 如果 directoryName
是blank,抛出 {@link IllegalArgumentException}
* 如果 fileName
是null,抛出 {@link NullPointerException}
* 如果 fileName
是blank,抛出 {@link IllegalArgumentException}
*/
String upload(MultipartFile multipartFile,String directoryName,String fileName);
/**
* 将一组multipartFiles
上传到指定目录directoryName
下面,依次重命名指定的文件名称fileNames
.
*
*
* 如果{@link MultipartFile#isEmpty()},那么log warn并跳过
*
*
* @param multipartFiles
* the multipart files
* @param directoryName
* 指定目录
* @param fileNames
* the file names
* @return 如果 multipartFiles
是null,抛出 {@link NullPointerException}
* 如果 multipartFiles
是empty,抛出 {@link IllegalArgumentException}
* 如果 directoryName
是null,抛出 {@link NullPointerException}
* 如果 directoryName
是blank,抛出 {@link IllegalArgumentException}
* 如果 fileNames
是null,抛出 {@link NullPointerException}
* 如果 fileNames
是empty,抛出 {@link IllegalArgumentException}
*/
List upload(MultipartFile[] multipartFiles,String directoryName,String[] fileNames);
}