public class CommonParamCheckUtils extends Object
| 构造器和说明 |
|---|
CommonParamCheckUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
AssertLegalCosFilePath(String cosFilePath)
判断用户指定的cos文件路径是否合法有效, 即不以/结尾
|
static void |
AssertLegalCosFolderPath(String cosFolderPath)
判断用户指定的cos目录路径是否合法有效, 即必须以/结尾, 同时不包含非法字符
|
static void |
AssertLegalLocalFilePath(String localFilePath)
判断用户指定的本地文件路径是否合法有效,即文件存在且可读
|
static void |
AssertLegalSliceSize(int sliceSize) |
static void |
AssertLegalUpdateFlag(int updateFlag) |
static void |
AssertLegalXCosMeta(Map<String,String> xCosMetaMap) |
static void |
AssertNotNull(String objName,
Object obj)
判断参数是否为NULL,如果为NULL,抛出参数异常
|
static void |
AssertNotRootCosPath(String cosCosFolderPath)
判断cos目录是否是根路径,即路径为/
|
static void |
AssertSliceInRange(int sliceSize)
判断分片尺寸是否在规定的范围内,抛出参数异常,目前的有效值为64KB ~ 10MB
|
static void |
AssertUploadEntireFileInRange(String localFilePath)
判断文件是否适合使用整文件上传,使用范围0 ~ 10MB, 大文件应该用分片上传
|
public static void AssertNotNull(String objName, Object obj) throws ParamException
objName - 参数名obj - 参数对象ParamExceptionpublic static void AssertUploadEntireFileInRange(String localFilePath) throws ParamException
localFilePath - 本地文件路径ParamExceptionpublic static void AssertSliceInRange(int sliceSize)
throws ParamException
sliceSize - 分片大小, 单位ByteParamExceptionpublic static void AssertLegalCosFolderPath(String cosFolderPath) throws ParamException
cosFolderPath - cos目录路径ParamExceptionpublic static void AssertLegalCosFilePath(String cosFilePath) throws ParamException
cosFilePath - cos文件路径ParamExceptionpublic static void AssertNotRootCosPath(String cosCosFolderPath) throws ParamException
cosCosFolderPath - cos目录路径ParamExceptionpublic static void AssertLegalLocalFilePath(String localFilePath) throws ParamException
localFilePath - 本地文件路径ParamExceptionpublic static void AssertLegalXCosMeta(Map<String,String> xCosMetaMap) throws ParamException
ParamExceptionpublic static void AssertLegalUpdateFlag(int updateFlag)
throws ParamException
ParamExceptionpublic static void AssertLegalSliceSize(int sliceSize)
throws ParamException
ParamExceptionCopyright © 2017. All rights reserved.