fix comment

This commit is contained in:
Looly 2019-10-09 10:50:26 +08:00
parent ee9a2f70dd
commit 855ff3e2c6
8 changed files with 62 additions and 41 deletions

View File

@ -1,5 +1,5 @@
/**
* 基于<a href=https://github.com/vdurmont/emoji-java>emoji-java</a>的Emoji表情工具类
* 基于https://github.com/vdurmont/emoji-java的Emoji表情工具类
*
* @author looly
*

View File

@ -36,6 +36,7 @@ public class MultipartRequestInputStream extends BufferedInputStream {
* 跳过指定位数的 bytes.
*
* @param i 跳过的byte数
* @throws IOException IO异常
*/
public void skipBytes(int i) throws IOException {
long len = super.skip(i);

View File

@ -83,6 +83,7 @@ public class UploadFile {
*
* @param destination 目标文件
* @return 目标文件
* @throws IOException IO异常
*/
public File write(File destination) throws IOException {
assertValid();

View File

@ -1,29 +1,40 @@
package cn.hutool.http;
import java.nio.charset.Charset;
import cn.hutool.core.util.StrUtil;
import java.nio.charset.Charset;
/**
* 常用Content-Type类型枚举
*
*
* @author looly
* @since 4.0.11
*/
public enum ContentType {
/** 标准表单编码当action为get时候浏览器用x-www-form-urlencoded的编码方式把form数据转换成一个字串name1=value1&name2=value2…*/
/**
* 标准表单编码当action为get时候浏览器用x-www-form-urlencoded的编码方式把form数据转换成一个字串name1=value1&amp;name2=value2
*/
FORM_URLENCODED("application/x-www-form-urlencoded"),
/** 文件上传编码浏览器会把整个表单以控件为单位分割并为每个部分加上Content-Disposition并加上分割符(boundary) */
/**
* 文件上传编码浏览器会把整个表单以控件为单位分割并为每个部分加上Content-Disposition并加上分割符(boundary)
*/
MULTIPART("multipart/form-data"),
/** Rest请求JSON编码 */
/**
* Rest请求JSON编码
*/
JSON("application/json"),
/** Rest请求XML编码 */
/**
* Rest请求XML编码
*/
XML("application/xml"),
/** Rest请求text/xml编码 */
/**
* Rest请求text/xml编码
*/
TEXT_XML("text/xml");
private String value;
ContentType(String value) {
this.value = value;
}
@ -32,19 +43,20 @@ public enum ContentType {
public String toString() {
return value;
}
/**
* 输出Content-Type字符串附带编码信息
*
* @param charset 编码
* @return Content-Type字符串
*/
public String toString(Charset charset) {
return build(this.value, charset);
}
/**
* 是否为默认Content-Type默认包括<code>null</code>和application/x-www-form-urlencoded
*
*
* @param contentType 内容类型
* @return 是否为默认Content-Type
* @since 4.1.5
@ -55,7 +67,7 @@ public enum ContentType {
/**
* 是否为application/x-www-form-urlencoded
*
*
* @param contentType 内容类型
* @return 是否为application/x-www-form-urlencoded
*/
@ -65,12 +77,12 @@ public enum ContentType {
/**
* 从请求参数的body中判断请求的Content-Type类型支持的类型有
*
*
* <pre>
* 1. application/json
* 1. application/xml
* </pre>
*
*
* @param body 请求参数体
* @return Content-Type类型如果无法判断返回null
*/
@ -79,28 +91,28 @@ public enum ContentType {
if (StrUtil.isNotBlank(body)) {
char firstChar = body.charAt(0);
switch (firstChar) {
case '{':
case '[':
// JSON请求体
contentType = JSON;
break;
case '<':
// XML请求体
contentType = XML;
break;
case '{':
case '[':
// JSON请求体
contentType = JSON;
break;
case '<':
// XML请求体
contentType = XML;
break;
default:
break;
default:
break;
}
}
return contentType;
}
/**
* 输出Content-Type字符串附带编码信息
*
*
* @param contentType Content-Type类型
* @param charset 编码
* @param charset 编码
* @return Content-Type字符串
* @since 4.5.4
*/

View File

@ -261,6 +261,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
* 设置URL
*
* @param url url字符串
* @return this
* @since 4.1.8
*/
public HttpRequest setUrl(String url) {
@ -278,6 +279,7 @@ public class HttpRequest extends HttpBase<HttpRequest> {
* 相关issue见https://gitee.com/loolly/hutool/issues/IMD1X
*
* @param urlHandler {@link URLStreamHandler}
* @return this
* @since 4.1.9
*/
public HttpRequest setUrlHandler(URLStreamHandler urlHandler) {

View File

@ -55,6 +55,7 @@ public class Browser extends UserAgentInfo {
*
* @param name 浏览器名称
* @param regex 关键字或表达式
* @param versionRegex 匹配版本的正则
*/
public Browser(String name, String regex, String versionRegex) {
super(name, regex);

View File

@ -546,7 +546,7 @@ public class ExcelUtil {
* 将Sheet列号变为列名
*
* @param index 列号, 从0开始
* @return 0->A; 1->B...26->AA
* @return 0-A; 1-B...26-AA
* @since 4.1.20
*/
public static String indexToColName(int index) {
@ -569,7 +569,7 @@ public class ExcelUtil {
* 根据表元的列名转换为列号
*
* @param colName 列名, 从A开始
* @return A1->0; B1->1...AA1->26
* @return A1-0; B1-1...AA1-26
* @since 4.1.20
*/
public static int colNameToIndex(String colName) {

View File

@ -567,7 +567,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
final DVConstraint constraint = DVConstraint.createExplicitListConstraint(selectList);
// 绑定
DataValidation dataValidation = null;
DataValidation dataValidation;
if(this.sheet instanceof XSSFSheet) {
final XSSFDataValidationHelper dvHelper = new XSSFDataValidationHelper((XSSFSheet)sheet);
@ -647,8 +647,11 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
* 合并某行的单元格并写入对象到单元格<br>
* 如果写到单元格中的内容非null行号自动+1否则当前行号不变<br>
* 样式为默认标题样式可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式
*
* @param lastColumn 合并到的最后一个列号
*
* @param firstRow 起始行0开始
* @param lastRow 结束行0开始
* @param firstColumn 起始列0开始
* @param lastColumn 结束列0开始
* @param content 合并单元格后的内容
* @param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式
* @return this
@ -748,7 +751,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
map = new TreeMap<>(comparator);
map.putAll((Map) obj);
} else {
map = BeanUtil.beanToMap(obj, new TreeMap<String, Object>(comparator), false, false);
map = BeanUtil.beanToMap(obj, new TreeMap<>(comparator), false, false);
}
writeRow(map, isFirstRow);
if (isFirstRow) {
@ -789,12 +792,12 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
* @see #writeRow(Map, boolean)
* @since 4.1.5
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({"rawtypes" })
public ExcelWriter writeRow(Object rowBean, boolean isWriteKeyAsHead) {
if (rowBean instanceof Iterable) {
return writeRow((Iterable<?>) rowBean);
}
Map rowMap = null;
Map rowMap;
if (rowBean instanceof Map) {
if (MapUtil.isNotEmpty(this.headerAlias)) {
rowMap = MapUtil.newTreeMap((Map) rowBean, getInitedAliasComparator());
@ -806,7 +809,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
rowMap = BeanUtil.beanToMap(rowBean, new LinkedHashMap<String, Object>(), false, false);
} else {
// 别名存在情况下按照别名的添加顺序排序Bean数据
rowMap = BeanUtil.beanToMap(rowBean, new TreeMap<String, Object>(getInitedAliasComparator()), false, false);
rowMap = BeanUtil.beanToMap(rowBean, new TreeMap<>(getInitedAliasComparator()), false, false);
}
} else {
// 其它转为字符串默认输出
@ -893,7 +896,8 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
*
* <p>
* 需要注意的是共享样式会共享同一个{@link CellStyle}一个单元格样式改变全部改变
*
*
* @param style 单元格样式
* @param x X坐标从0计数即列号
* @param y Y坐标从0计数即行号
* @return this
@ -1003,7 +1007,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
/**
* 为指定的key列表添加标题别名如果没有定义key的别名在onlyAlias为false时使用原key
*
* @param keys 键列表
* @param rowMap 一行数据
* @return 别名列表
*/
private Map<?, ?> aliasMap(Map<?, ?> rowMap) {