mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix comment
This commit is contained in:
parent
a418b5922b
commit
b1674a933f
@ -30,6 +30,7 @@ public final class ProxyUtil {
|
||||
* 使用切面代理对象
|
||||
*
|
||||
* @param <T> 被代理对象类型
|
||||
* @param target 被代理对象
|
||||
* @param aspect 切面对象
|
||||
* @return 代理对象
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@ public abstract class ProxyFactory implements Serializable{
|
||||
/**
|
||||
* 创建代理
|
||||
*
|
||||
* @param <T> 代理对象类型
|
||||
* @param target 被代理对象
|
||||
* @param aspect 切面实现
|
||||
* @return 代理对象
|
||||
|
@ -516,6 +516,7 @@ public abstract class AbstractDb implements Serializable {
|
||||
*
|
||||
* @param <T> Bean类型
|
||||
* @param where 条件实体类(包含表名)
|
||||
* @param beanClass 返回的对象类型
|
||||
* @return 数据对象列表
|
||||
* @throws SQLException SQL执行异常
|
||||
* @since 3.2.2
|
||||
|
@ -142,6 +142,7 @@ public abstract class DSFactory implements Closeable, Serializable{
|
||||
* 此方法通过“试错”方式查找引入项目的连接池库,按照优先级寻找,一旦寻找到则创建对应的数据源工厂<br>
|
||||
* 连接池优先级:Hikari > Druid > Tomcat > Dbcp > C3p0 > Hutool Pooled
|
||||
*
|
||||
* @param setting 数据库配置项
|
||||
* @return 日志实现类
|
||||
*/
|
||||
public static DSFactory create(Setting setting) {
|
||||
@ -155,6 +156,7 @@ public abstract class DSFactory implements Closeable, Serializable{
|
||||
* 此方法通过“试错”方式查找引入项目的连接池库,按照优先级寻找,一旦寻找到则创建对应的数据源工厂<br>
|
||||
* 连接池优先级:Hikari > Druid > Tomcat > Dbcp > C3p0 > Hutool Pooled
|
||||
*
|
||||
* @param setting 数据库配置项
|
||||
* @return 日志实现类
|
||||
* @since 4.1.3
|
||||
*/
|
||||
|
@ -127,6 +127,7 @@ public class EmojiUtil {
|
||||
* 例如:<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
|
||||
*
|
||||
* @param str 包含Emoji Unicode字符的字符串
|
||||
* @param fitzpatrickAction {@link FitzpatrickAction}
|
||||
* @return 替换后的字符串
|
||||
*/
|
||||
public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
|
||||
|
@ -35,25 +35,45 @@ import cn.hutool.core.util.StrUtil;
|
||||
*/
|
||||
public class Mail {
|
||||
|
||||
/** 邮箱帐户信息以及一些客户端配置信息 */
|
||||
/**
|
||||
* 邮箱帐户信息以及一些客户端配置信息
|
||||
*/
|
||||
private MailAccount mailAccount;
|
||||
/** 收件人列表 */
|
||||
/**
|
||||
* 收件人列表
|
||||
*/
|
||||
private String[] tos;
|
||||
/** 抄送人列表(carbon copy) */
|
||||
/**
|
||||
* 抄送人列表(carbon copy)
|
||||
*/
|
||||
private String[] ccs;
|
||||
/** 密送人列表(blind carbon copy) */
|
||||
/**
|
||||
* 密送人列表(blind carbon copy)
|
||||
*/
|
||||
private String[] bccs;
|
||||
/** 回复地址(reply-to) */
|
||||
/**
|
||||
* 回复地址(reply-to)
|
||||
*/
|
||||
private String[] reply;
|
||||
/** 标题 */
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/** 内容 */
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
/** 是否为HTML */
|
||||
/**
|
||||
* 是否为HTML
|
||||
*/
|
||||
private boolean isHtml;
|
||||
/** 正文、附件和图片的混合部分 */
|
||||
/**
|
||||
* 正文、附件和图片的混合部分
|
||||
*/
|
||||
private Multipart multipart = new MimeMultipart();
|
||||
/** 是否使用全局会话,默认为false */
|
||||
/**
|
||||
* 是否使用全局会话,默认为false
|
||||
*/
|
||||
private boolean useGlobalSession = false;
|
||||
|
||||
/**
|
||||
@ -76,6 +96,7 @@ public class Mail {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- Constructor start
|
||||
|
||||
/**
|
||||
* 构造,使用全局邮件帐户
|
||||
*/
|
||||
@ -95,6 +116,7 @@ public class Mail {
|
||||
// --------------------------------------------------------------- Constructor end
|
||||
|
||||
// --------------------------------------------------------------- Getters and Setters start
|
||||
|
||||
/**
|
||||
* 设置收件人
|
||||
*
|
||||
@ -254,6 +276,7 @@ public class Mail {
|
||||
*
|
||||
* @param cid 图片与占位符,占位符格式为cid:${cid}
|
||||
* @param imageStream 图片文件
|
||||
* @return this
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public Mail addImage(String cid, InputStream imageStream) {
|
||||
@ -266,6 +289,7 @@ public class Mail {
|
||||
* @param cid 图片与占位符,占位符格式为cid:${cid}
|
||||
* @param imageStream 图片流,不关闭
|
||||
* @param contentType 图片类型,null赋值默认的"image/jpeg"
|
||||
* @return this
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public Mail addImage(String cid, InputStream imageStream, String contentType) {
|
||||
@ -284,6 +308,7 @@ public class Mail {
|
||||
*
|
||||
* @param cid 图片与占位符,占位符格式为cid:${cid}
|
||||
* @param imageFile 图片文件
|
||||
* @return this
|
||||
* @since 4.6.3
|
||||
*/
|
||||
public Mail addImage(String cid, File imageFile) {
|
||||
@ -336,6 +361,7 @@ public class Mail {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------- Private method start
|
||||
|
||||
/**
|
||||
* 执行发送
|
||||
*
|
||||
|
@ -247,7 +247,7 @@ public class MailAccount implements Serializable {
|
||||
*
|
||||
* <pre>
|
||||
* 1. user@xxx.xx
|
||||
* 2. name <user@xxx.xx>
|
||||
* 2. name <user@xxx.xx>
|
||||
* </pre>
|
||||
*
|
||||
* @param from 发送方,遵循RFC-822标准
|
||||
@ -272,6 +272,7 @@ public class MailAccount implements Serializable {
|
||||
* 设置是否打开调试模式,调试模式会显示与邮件服务器通信过程,默认不开启
|
||||
*
|
||||
* @param debug 是否打开调试模式,调试模式会显示与邮件服务器通信过程,默认不开启
|
||||
* @return this
|
||||
* @since 4.0.2
|
||||
*/
|
||||
public MailAccount setDebug(boolean debug) {
|
||||
|
@ -71,7 +71,7 @@ public class ServletUtil {
|
||||
* @return Map
|
||||
*/
|
||||
public static Map<String, String> getParamMap(ServletRequest request) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : getParams(request).entrySet()) {
|
||||
params.put(entry.getKey(), ArrayUtil.join(entry.getValue(), StrUtil.COMMA));
|
||||
}
|
||||
@ -186,7 +186,6 @@ public class ServletUtil {
|
||||
* 3、Proxy-Client-IP
|
||||
* 4、WL-Proxy-Client-IP
|
||||
* </pre>
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* otherHeaderNames参数用于自定义检测的Header<br>
|
||||
@ -278,7 +277,7 @@ public class ServletUtil {
|
||||
final Map<String, String> headerMap = new HashMap<>();
|
||||
|
||||
final Enumeration<String> names = request.getHeaderNames();
|
||||
String name = null;
|
||||
String name;
|
||||
while (names.hasMoreElements()) {
|
||||
name = names.nextElement();
|
||||
headerMap.put(name, request.getHeader(name));
|
||||
@ -297,7 +296,7 @@ public class ServletUtil {
|
||||
*/
|
||||
public static String getHeaderIgnoreCase(HttpServletRequest request, String nameIgnoreCase) {
|
||||
final Enumeration<String> names = request.getHeaderNames();
|
||||
String name = null;
|
||||
String name;
|
||||
while (names.hasMoreElements()) {
|
||||
name = names.nextElement();
|
||||
if (name != null && name.equalsIgnoreCase(nameIgnoreCase)) {
|
||||
@ -347,9 +346,7 @@ public class ServletUtil {
|
||||
String userAgent = getHeaderIgnoreCase(request, "User-Agent");
|
||||
if (StrUtil.isNotBlank(userAgent)) {
|
||||
userAgent = userAgent.toUpperCase();
|
||||
if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) {
|
||||
return true;
|
||||
}
|
||||
return userAgent.contains("MSIE") || userAgent.contains("TRIDENT");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -389,11 +386,7 @@ public class ServletUtil {
|
||||
if (StrUtil.isBlank(contentType)) {
|
||||
return false;
|
||||
}
|
||||
if (contentType.toLowerCase().startsWith("multipart/")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return contentType.toLowerCase().startsWith("multipart/");
|
||||
}
|
||||
// --------------------------------------------------------- Header end
|
||||
|
||||
@ -417,7 +410,7 @@ public class ServletUtil {
|
||||
* @return Cookie map
|
||||
*/
|
||||
public static Map<String, Cookie> readCookieMap(HttpServletRequest httpServletRequest) {
|
||||
Map<String, Cookie> cookieMap = new HashMap<String, Cookie>();
|
||||
Map<String, Cookie> cookieMap = new HashMap<>();
|
||||
Cookie[] cookies = httpServletRequest.getCookies();
|
||||
if (null == cookies) {
|
||||
return null;
|
||||
|
@ -22,7 +22,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
* 读取byte字节流,在末尾抛出异常
|
||||
*
|
||||
* @return byte
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public byte readByte() throws IOException {
|
||||
int i = super.read();
|
||||
@ -53,7 +53,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
* 输入流中读取边界
|
||||
*
|
||||
* @return 边界
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public byte[] readBoundary() throws IOException {
|
||||
ByteArrayOutputStream boundaryOutput = new ByteArrayOutputStream(1024);
|
||||
@ -91,7 +91,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
*
|
||||
* @param encoding 字符集
|
||||
* @return 头部信息, 如果达到末尾则返回null
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public UploadFileHeader readDataHeader(String encoding) throws IOException {
|
||||
String dataHeader = readDataHeaderString(encoding);
|
||||
@ -136,7 +136,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
*
|
||||
* @param out 输出流
|
||||
* @return 复制的字节数
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public int copy(OutputStream out) throws IOException {
|
||||
int count = 0;
|
||||
@ -157,7 +157,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
* @param out 输出流
|
||||
* @param limit 最大字节数
|
||||
* @return 复制的字节数
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public int copy(OutputStream out, int limit) throws IOException {
|
||||
int count = 0;
|
||||
@ -195,7 +195,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
|
||||
/**
|
||||
* @param b byte
|
||||
* @return 是否为边界的标志
|
||||
* @throws IOException
|
||||
* @throws IOException 读取异常
|
||||
*/
|
||||
public boolean isBoundary(byte b) throws IOException {
|
||||
int boundaryLen = boundary.length;
|
||||
|
@ -81,6 +81,7 @@ public class UploadFile {
|
||||
* 将上传的文件写入目标文件<br>
|
||||
* 写入后原临时文件会被删除
|
||||
*
|
||||
* @param destination 目标文件
|
||||
* @return 目标文件
|
||||
*/
|
||||
public File write(File destination) throws IOException {
|
||||
@ -151,7 +152,7 @@ public class UploadFile {
|
||||
// ---------------------------------------------------------------- properties
|
||||
|
||||
/**
|
||||
* @return 上传文件的大小,< 0 表示未上传
|
||||
* @return 上传文件的大小,> 0 表示未上传
|
||||
*/
|
||||
public int size() {
|
||||
return size;
|
||||
@ -176,6 +177,7 @@ public class UploadFile {
|
||||
* 处理上传表单流,提取出文件
|
||||
*
|
||||
* @param input 上传表单的流
|
||||
* @return 是否成功
|
||||
* @throws IOException IO异常
|
||||
*/
|
||||
protected boolean processStream(MultipartRequestInputStream input) throws IOException {
|
||||
|
@ -32,27 +32,35 @@ public class UploadFileHeader {
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if uploaded data are correctly marked as a file. This is true if header contains string 'filename'.
|
||||
*
|
||||
* @return 是否为文件
|
||||
*/
|
||||
public boolean isFile() {
|
||||
return isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns form field name.
|
||||
* 返回表单字段名
|
||||
*
|
||||
* @return 表单字段名
|
||||
*/
|
||||
public String getFormFieldName() {
|
||||
return formFieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns complete file name as specified at client side.
|
||||
* 返回表单中的文件名,来自客户端传入
|
||||
*
|
||||
* @return 表单文件名
|
||||
*/
|
||||
public String getFormFileName() {
|
||||
return formFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns file name (base name and extension, without full path data).
|
||||
* 获取文件名,不包括路径
|
||||
*
|
||||
* @return 文件名
|
||||
*/
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
@ -62,6 +70,7 @@ public class UploadFileHeader {
|
||||
* Returns uploaded content type. It is usually in the following form:<br>
|
||||
* mime_type/mime_subtype.
|
||||
*
|
||||
* @return content type
|
||||
* @see #getMimeType()
|
||||
* @see #getMimeSubtype()
|
||||
*/
|
||||
@ -71,6 +80,8 @@ public class UploadFileHeader {
|
||||
|
||||
/**
|
||||
* Returns file types MIME.
|
||||
*
|
||||
* @return types MIME
|
||||
*/
|
||||
public String getMimeType() {
|
||||
return mimeType;
|
||||
@ -78,6 +89,8 @@ public class UploadFileHeader {
|
||||
|
||||
/**
|
||||
* Returns file sub type MIME.
|
||||
*
|
||||
* @return sub type MIME
|
||||
*/
|
||||
public String getMimeSubtype() {
|
||||
return mimeSubtype;
|
||||
@ -85,6 +98,8 @@ public class UploadFileHeader {
|
||||
|
||||
/**
|
||||
* Returns content disposition. Usually it is 'form-data'.
|
||||
*
|
||||
* @return content disposition
|
||||
*/
|
||||
public String getContentDisposition() {
|
||||
return contentDisposition;
|
||||
@ -154,7 +169,8 @@ public class UploadFileHeader {
|
||||
|
||||
/**
|
||||
* 处理头字符串,使之转化为字段
|
||||
* @param dataHeader
|
||||
*
|
||||
* @param dataHeader 头字符串
|
||||
*/
|
||||
private void processHeaderString(String dataHeader) {
|
||||
isFile = dataHeader.indexOf("filename") > 0;
|
||||
|
@ -56,8 +56,8 @@ public class JSONConverter implements Converter<JSON> {
|
||||
/**
|
||||
* JSON递归转换<br>
|
||||
* 首先尝试JDK类型转换,如果失败尝试JSON转Bean
|
||||
* @param <T>
|
||||
*
|
||||
* @param <T> 转换后的对象类型
|
||||
* @param targetType 目标类型
|
||||
* @param value 值
|
||||
* @param ignoreError 是否忽略转换错误
|
||||
|
@ -33,11 +33,11 @@ import cn.hutool.json.serialize.JSONSerializer;
|
||||
* JSON工具类
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
public final class JSONUtil {
|
||||
|
||||
// -------------------------------------------------------------------- Pause start
|
||||
|
||||
/**
|
||||
* 创建JSONObject
|
||||
*
|
||||
@ -209,6 +209,7 @@ public final class JSONUtil {
|
||||
// -------------------------------------------------------------------- Pause end
|
||||
|
||||
// -------------------------------------------------------------------- Read start
|
||||
|
||||
/**
|
||||
* 读取JSON
|
||||
*
|
||||
@ -247,6 +248,7 @@ public final class JSONUtil {
|
||||
// -------------------------------------------------------------------- Read end
|
||||
|
||||
// -------------------------------------------------------------------- toString start
|
||||
|
||||
/**
|
||||
* 转为JSON字符串
|
||||
*
|
||||
@ -357,6 +359,7 @@ public final class JSONUtil {
|
||||
* @param <T> Bean类型
|
||||
* @param jsonString JSON字符串
|
||||
* @param typeReference {@link TypeReference}类型参考子类,可以获取其泛型参数中的Type类型
|
||||
* @param ignoreError 是否忽略错误
|
||||
* @return 实体类对象
|
||||
* @since 4.3.2
|
||||
*/
|
||||
@ -370,6 +373,7 @@ public final class JSONUtil {
|
||||
* @param <T> Bean类型
|
||||
* @param jsonString JSON字符串
|
||||
* @param beanType 实体类对象类型
|
||||
* @param ignoreError 是否忽略错误
|
||||
* @return 实体类对象
|
||||
* @since 4.3.2
|
||||
*/
|
||||
@ -412,6 +416,7 @@ public final class JSONUtil {
|
||||
/**
|
||||
* 将JSONArray转换为Bean的List,默认为ArrayList
|
||||
*
|
||||
* @param <T> Bean类型
|
||||
* @param jsonArray JSONArray
|
||||
* @param elementType List中元素类型
|
||||
* @return List
|
||||
@ -427,7 +432,7 @@ public final class JSONUtil {
|
||||
* <li>.表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值</li>
|
||||
* <li>[]表达式,可以获取集合等对象中对应index的值</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>
|
||||
* 表达式栗子:
|
||||
*
|
||||
* <pre>
|
||||
@ -454,7 +459,7 @@ public final class JSONUtil {
|
||||
* <li>.表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值</li>
|
||||
* <li>[]表达式,可以获取集合等对象中对应index的值</li>
|
||||
* </ol>
|
||||
*
|
||||
* <p>
|
||||
* 表达式栗子:
|
||||
*
|
||||
* <pre>
|
||||
@ -780,6 +785,7 @@ public final class JSONUtil {
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------- Private method start
|
||||
|
||||
/**
|
||||
* 转义不可见字符<br>
|
||||
* 见:https://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF
|
||||
|
@ -99,7 +99,7 @@ public final class Props extends Properties implements BasicTypeGetter<String>,
|
||||
/**
|
||||
* 构造,使用相对于Class文件根目录的相对路径
|
||||
*
|
||||
* @param path
|
||||
* @param path 配置文件路径,相对于ClassPath,或者使用绝对路径
|
||||
*/
|
||||
public Props(String path) {
|
||||
this(path, CharsetUtil.CHARSET_ISO_8859_1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user