- java.lang.Object
-
- org.redkale.util.Utility
-
public final class Utility extends Object
常见操作的工具类详情见: https://redkale.org
- 作者:
- zhangjx
-
-
方法概要
所有方法 静态方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static <T> CompletableFuture<List<T>>
allOfFutures(CompletableFuture<T>[] futures)
static <T> CompletableFuture<List<T>>
allOfFutures(CompletableFuture<T>[] futures, BiConsumer<Integer,T> consumer)
static <T> CompletableFuture<T[]>
allOfFutures(CompletableFuture<T>[] futures, IntFunction<T[]> func)
static <T> CompletableFuture<T[]>
allOfFutures(CompletableFuture<T>[] futures, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
static <T> CompletableFuture<List<T>>
allOfFutures(List<CompletableFuture<T>> list)
static <T> CompletableFuture<List<T>>
allOfFutures(List<CompletableFuture<T>> list, BiConsumer<Integer,T> consumer)
static <T> CompletableFuture<T[]>
allOfFutures(List<CompletableFuture<T>> list, IntFunction<T[]> func)
static <T> CompletableFuture<T[]>
allOfFutures(List<CompletableFuture<T>> list, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
static <T> CompletableFuture<List<T>>
allOfFutures(Stream<CompletableFuture<T>> stream)
static <T> CompletableFuture<List<T>>
allOfFutures(Stream<CompletableFuture<T>> stream, BiConsumer<Integer,T> consumer)
static <T> CompletableFuture<T[]>
allOfFutures(Stream<CompletableFuture<T>> stream, IntFunction<T[]> func)
static <T> CompletableFuture<T[]>
allOfFutures(Stream<CompletableFuture<T>> stream, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
static byte[]
append(byte[] array, byte... objs)
将一个或多个byte新元素添加到byte数组结尾static byte[]
append(byte[] array, byte[] objs, int offset, int length)
将一个或多个byte新元素添加到byte数组结尾static char[]
append(char[] array, char... objs)
将一个或多个char新元素添加到char数组结尾static int[]
append(int[] array, int... objs)
将一个或多个int新元素添加到int数组结尾static long[]
append(long[] array, long... objs)
将一个或多个long新元素添加到long数组结尾static short[]
append(short[] array, short... objs)
将一个或多个short新元素添加到short数组结尾static <T> Object[][]
append(Object[][] array, Object[]... objs)
将一个或多个新元素添加到数组结尾static String[]
append(String[] array, String... objs)
将一个或多个新元素添加到数组结尾static String[]
append(String one, String... objs)
将一个或多个新元素添加到数组结尾static String[]
append(String one, String two, String... objs)
将一个或多个新元素添加到数组结尾static <T> T[]
append(T[] array, Collection<T> objs)
将一个或多个新元素添加到数组结尾static <T> T[]
append(T[] array, T... objs)
将一个或多个新元素添加到数组结尾static String
binTo0xHexString(byte[] bytes)
将字节数组转换为以0x开头的16进制字符串static String
binTo0xHexString(byte[] bytes, int offset, int len)
将字节数组转换为以0x开头的16进制字符串static char[]
binToHex(byte[] bytes)
将字节数组转换为16进制字符数组static char[]
binToHex(byte[] bytes, int offset, int len)
将字节数组转换为16进制字符数组static String
binToHexString(byte[] bytes)
将字节数组转换为16进制字符串static String
binToHexString(byte[] bytes, int offset, int len)
将字节数组转换为16进制字符串static Boolean[]
box(boolean[] array)
static Byte[]
box(byte[] array)
static Character[]
box(char[] array)
static Double[]
box(double[] array)
static Float[]
box(float[] array)
static Integer[]
box(int[] array)
static Long[]
box(long[] array)
static Short[]
box(short[] array)
static boolean[]
box(Boolean[] array)
static byte[]
box(Byte[] array)
static char[]
box(Character[] array)
static double[]
box(Double[] array)
static float[]
box(Float[] array)
static int[]
box(Integer[] array)
static long[]
box(Long[] array)
static short[]
box(Short[] array)
static char[]
charArray(String value)
static char[]
charArray(StringBuilder value)
static int
compareVersion(String version1, String version2)
比较两个版本号的大小,ver1小于ver2返回 -1static <T> CompletableFuture<T>
completeOnTimeout(CompletableFuture future, T value, long timeout, TimeUnit unit)
static <T> CompletableFuture<T>
completeOnTimeout(CompletableFuture future, T value, Duration timeout)
static boolean
contains(char[] values, char value)
判断指定值是否包含指定的数组中,包含返回truestatic boolean
contains(int[] values, int value)
判断指定值是否包含指定的数组中,包含返回truestatic boolean
contains(int[] values, int... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回truestatic boolean
contains(long[] values, long value)
判断指定值是否包含指定的数组中,包含返回truestatic boolean
contains(long[] values, long... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回truestatic boolean
contains(short[] values, short value)
判断指定值是否包含指定的数组中,包含返回truestatic boolean
contains(short[] values, short... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回truestatic boolean
contains(String string, char... values)
判断字符串是否包含指定的字符,包含返回truestatic <T> boolean
contains(Collection<T> values, Predicate<T> predicate)
判断指定值是否包含指定的数组中,包含返回truestatic <T> boolean
contains(T[] values, Predicate<T> predicate)
判断指定值是否包含指定的数组中,包含返回truestatic <T> boolean
contains(T[] values, T value)
判断指定值是否包含指定的数组中,包含返回truestatic boolean
containsMatch(int[] array, int... items)
将指定的int元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new int[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new int[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = falsestatic boolean
containsMatch(long[] array, long... items)
将指定的long元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new long[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new long[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = falsestatic boolean
containsMatch(short[] array, short... items)
将指定的short元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new short[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new short[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = falsestatic <T> T
convertValue(Type type, Object value)
将源对象转换成目标类型static int
cpus()
static <V,A>
CompletionHandler<V,A>createAsyncHandler(BiConsumer<V,A> success, BiConsumer<Throwable,A> fail)
创建 CompletionHandler 对象static <A> CompletionHandler<Void,A>
createAsyncHandler(Consumer<A> success, BiConsumer<Throwable,A> fail)
创建没有返回结果的 CompletionHandler 对象static <V> CompletionHandler<V,Void>
createAsyncHandler(Consumer<V> success, Consumer<Throwable> fail)
创建没有附件对象的 CompletionHandler 对象static char[]
decodeUTF8(byte[] array)
使用UTF-8编码将byte[]转换成char[]static char[]
decodeUTF8(byte[] array, int start, int len)
static Executor
defaultExecutor()
static byte[]
encodeUTF8(char[] array)
static byte[]
encodeUTF8(char[] text, int start, int len)
static byte[]
encodeUTF8(String value)
static int
encodeUTF8Length(char[] text)
static int
encodeUTF8Length(char[] text, int start, int len)
static int
encodeUTF8Length(String value)
static <T> boolean
equalsElement(Collection<T> col1, Collection<T> col2)
比较两集合元素是否一样, 顺序不要求一样static <K,V>
booleanequalsElement(Map<K,V> map1, Map<K,V> map2)
比较两集合元素是否一样, 顺序不要求一样static <T> boolean
equalsElement(T[] array1, T[] array2)
比较两集合元素是否一样, 顺序不要求一样static String[]
exclude(String[] columns, String... cols)
删除掉字符串数组中包含指定的字符串static void
execute(Runnable task)
static <T> T
find(Collection<T> array, Predicate<T> predicate)
查询指定对象, 没有返回nullstatic <T> T
find(T[] array, Predicate<T> predicate)
查询指定对象, 没有返回nullstatic String
firstCharLowerCase(String str)
将字符串首字母小写static String
firstCharUpperCase(String str)
将字符串首字母大写static String
format36time(long time)
已过时。static String
formatTime(long time)
已过时。static String
formatTime(String format, int size, Object time)
已过时。static IntFunction<CompletableFuture[]>
futureArrayFunc()
static byte[]
generateRandomBytes(int size)
生成随机数static byte[]
getHttpBytesContent(String url)
static byte[]
getHttpBytesContent(String url, int timeoutMs)
static byte[]
getHttpBytesContent(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static byte[]
getHttpBytesContent(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, int timeoutMs)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
getHttpBytesContentAsync(HttpClient client, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static String
getHttpContent(String url)
static String
getHttpContent(String url, int timeoutMs)
static String
getHttpContent(String url, int timeoutMs, Charset charset)
static String
getHttpContent(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static String
getHttpContent(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static String
getHttpContent(String url, Charset charset)
static String
getHttpContent(String url, Charset charset, Map<String,Serializable> headers, String body)
static String
getHttpContent(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
getHttpContentAsync(String url)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Charset charset)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, Charset charset)
static CompletableFuture<String>
getHttpContentAsync(String url, Charset charset, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
getHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
getHttpContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(HttpClient client, String url, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(HttpClient client, String url, Charset charset, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
getHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static String
getTypeDescriptor(Type type)
static byte[]
hash(String algorithm, byte[] input)
根据指定算法进行hashstatic byte[]
hash(String algorithm, byte[] input, int offset, int length)
根据指定算法进行hashstatic byte[]
hexToBin(char[] src)
将16进制字符数组转换成字节数组static byte[]
hexToBin(char[] src, int offset, int len)
将16进制字符数组转换成字节数组static byte[]
hexToBin(CharSequence src)
将16进制字符串转换成字节数组static byte[]
hexToBin(CharSequence src, int offset, int len)
将16进制字符串转换成字节数组static byte[]
hexToBin(String str)
将16进制字符串转换成字节数组static byte[]
hmacSha1(byte[] key, byte[] input)
HmacSHA1static byte[]
hmacSha1(byte[] key, byte[] input, int offset, int len)
HmacSHA1static String
hmacSha1Base64(byte[] key, byte[] input)
HmacSHA1static String
hmacSha1Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA1static String
hmacSha1Base64(String key, String input)
HmacSHA1static String
hmacSha1Hex(byte[] key, byte[] input)
HmacSHA1static String
hmacSha1Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA1static String
hmacSha1Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA1static String
hmacSha1Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA1static byte[]
hmacSha256(byte[] key, byte[] input)
HmacSHA256static byte[]
hmacSha256(byte[] key, byte[] input, int offset, int len)
HmacSHA256static String
hmacSha256Base64(byte[] key, byte[] input)
HmacSHA256static String
hmacSha256Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA256static String
hmacSha256Base64(String key, String input)
HmacSHA256static String
hmacSha256Hex(byte[] key, byte[] input)
HmacSHA256static String
hmacSha256Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA256static String
hmacSha256Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA256static String
hmacSha256Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA256static byte[]
hmacSha512(byte[] key, byte[] input)
HmacSHA512static byte[]
hmacSha512(byte[] key, byte[] input, int offset, int len)
HmacSHA512static String
hmacSha512Base64(byte[] key, byte[] input)
HmacSHA512static String
hmacSha512Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA512static String
hmacSha512Base64(String key, String input)
HmacSHA512static String
hmacSha512Hex(byte[] key, byte[] input)
HmacSHA512static String
hmacSha512Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA512static String
hmacSha512Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA512static String
hmacSha512Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA512static int
indexOf(byte[] array, byte element)
查询指定值位置, 没有返回-1static int
indexOf(byte[] array, int fromIndex, byte element)
查询指定值位置, 没有返回-1static int
indexOf(char[] array, char element)
查询指定值位置, 没有返回-1static int
indexOf(char[] array, int fromIndex, char element)
查询指定值位置, 没有返回-1static int
indexOf(double[] array, double element)
查询指定值位置, 没有返回-1static int
indexOf(double[] array, int fromIndex, double element)
查询指定值位置, 没有返回-1static int
indexOf(float[] array, float element)
查询指定值位置, 没有返回-1static int
indexOf(float[] array, int fromIndex, float element)
查询指定值位置, 没有返回-1static int
indexOf(int[] array, int element)
查询指定值位置, 没有返回-1static int
indexOf(int[] array, int fromIndex, int element)
查询指定值位置, 没有返回-1static int
indexOf(long[] array, int fromIndex, long element)
查询指定值位置, 没有返回-1static int
indexOf(long[] array, long element)
查询指定值位置, 没有返回-1static int
indexOf(short[] array, int fromIndex, short element)
查询指定值位置, 没有返回-1static int
indexOf(short[] array, short element)
查询指定值位置, 没有返回-1static <T> int
indexOf(Collection<T> array, Predicate<T> predicate)
查询指定对象位置, 没有返回-1static <T> int
indexOf(T[] array, Predicate<T> predicate)
查询指定对象位置, 没有返回-1static boolean
inNativeImage()
static byte[]
intsToBytes(int[] value)
将int[]强制转换成byte[]static boolean
isAbstractOrInterface(Class clazz)
static boolean
isAnyBlank(String... strs)
字符串是否至少一个为空白static boolean
isAnyEmpty(CharSequence... strs)
字符串是否至少一个为空static boolean
isBlank(String str)
是否为空白static boolean
isBlank(String str, int fromIndex, int toIndex)
是否为空白static boolean
isEmpty(byte[] array)
是否为空static boolean
isEmpty(int[] array)
是否为空static boolean
isEmpty(long[] array)
是否为空static boolean
isEmpty(short[] array)
是否为空static boolean
isEmpty(CharSequence str)
是否为空static boolean
isEmpty(Collection collection)
是否为空static boolean
isEmpty(Map map)
是否为空static boolean
isEmpty(ByteArray array)
是否为空static <T> boolean
isEmpty(T[] array)
是否为空static boolean
isLatin1(String value)
static boolean
isNotBlank(String str)
是否不为空白static boolean
isNotBlank(String str, int fromIndex, int toIndex)
是否不为空白static boolean
isNotEmpty(byte[] array)
是否不为空static boolean
isNotEmpty(int[] array)
是否不为空static boolean
isNotEmpty(long[] array)
是否不为空static boolean
isNotEmpty(short[] array)
是否不为空static boolean
isNotEmpty(CharSequence str)
是否不为空static boolean
isNotEmpty(Collection collection)
是否不为空static boolean
isNotEmpty(Map map)
是否不为空static boolean
isNotEmpty(ByteArray array)
是否不为空static <T> boolean
isNotEmpty(T[] array)
是否不为空static boolean
isNumeric(String str)
是否为数字字符串static boolean
isRecordGetter(Class clazz, Method method)
static boolean
isRecordGetter(Method method)
static String
joining(char[] array, String delimiter)
将char数组用分隔符拼接成字符串static String
joining(int[] array, String delimiter)
将int数组用分隔符拼接成字符串static String
joining(long[] array, String delimiter)
将long数组用分隔符拼接成字符串static <T> String
joining(String[] array, char delimiter)
将对象数组用分隔符拼接成字符串static <T> String
joining(Stream<T> stream, String delimiter)
将对象集合用分隔符拼接成字符串static <T> String
joining(T[] array, String delimiter)
将对象数组用分隔符拼接成字符串static <T> String
joiningHex(byte[] array, char delimiter)
将对象数组用分隔符拼接成字符串static <T> String
joiningHex(byte[] array, int offset, int length, char delimiter)
将对象数组用分隔符拼接成字符串static byte[]
latin1ByteArray(String latin1Value)
static <T> List<T>
limit(List<T> list, int limit)
裁剪List,使其size不超过limit大小static InetAddress
localInetAddress()
返回本机的第一个内网IPv4地址, 没有则返回nullstatic int
max(int... array)
获取int数组最大值static long
max(long... array)
获取long数组最大值static byte[]
md5(byte[] input)
MD5加密static byte[]
md5(byte[] input, int offset, int len)
MD5加密static byte[]
md5(String str)
MD5加密static String
md5Hex(byte[] input)
MD5加密static String
md5Hex(String str)
MD5加密static long
merge(int high, int low)
将两个数字组装成一个longstatic <K,V>
Map<K,V>merge(Map<K,V>... maps)
将多个Map合并到第一个Map中static String
methodKey(Method method)
构建method的唯一key,用于遍历类及父类的所有方法,key过滤重载方法static long
midnight()
已过时。static long
midnight(long time)
已过时。static long
min(int... array)
获取int数组最小值static long
min(long... array)
获取long数组最小值static long
monday(long time)
已过时。static long
monthFirstDay(long time)
已过时。static long
monthLastDay(long time)
已过时。static ScheduledThreadPoolExecutor
newScheduledExecutor(int corePoolSize)
static ScheduledThreadPoolExecutor
newScheduledExecutor(int corePoolSize, String name)
static ScheduledThreadPoolExecutor
newScheduledExecutor(int corePoolSize, String name, RejectedExecutionHandler handler)
static ThreadFactory
newThreadFactory(String name)
static String
now()
已过时。static String
nowMillis()
已过时。static <T> T[]
ofArray(T... items)
将多个元素组合成一个Arraystatic <T> List<T>
ofList(T... items)
将多个元素组合成一个List
类似 JDK9中的 List.of 方法static <K,V>
HashMap<K,V>ofMap(Object... items)
将多个key:value对应值组合成一个Map,items长度必须是偶数, 参数个数若是奇数的话,最后一个会被忽略 类似 JDK9中的 Map.of 方法static <T> Set<T>
ofSet(T... items)
将多个元素组合成一个Setstatic <T> T
orElse(T... vals)
返回第一个不为null的对象static <T> T
orElse(T val1, T val2)
返回第一个不为null的对象static <T> CompletableFuture<T>
orTimeout(CompletableFuture future, Supplier<String> errMsgFunc, long timeout, TimeUnit unit)
static <T> CompletableFuture<T>
orTimeout(CompletableFuture future, Supplier<String> errMsgFunc, Duration timeout)
static byte[]
postHttpBytesContent(String url)
static byte[]
postHttpBytesContent(String url, int timeoutMs)
static byte[]
postHttpBytesContent(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static byte[]
postHttpBytesContent(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, int timeoutMs)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, Map<String,Serializable> respHeaders)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<byte[]>
postHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static String
postHttpContent(String url)
static String
postHttpContent(String url, int timeoutMs)
static String
postHttpContent(String url, int timeoutMs, String body)
static String
postHttpContent(String url, int timeoutMs, Charset charset)
static String
postHttpContent(String url, int timeoutMs, Charset charset, String body)
static String
postHttpContent(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static String
postHttpContent(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static String
postHttpContent(String url, String body)
static String
postHttpContent(String url, Charset charset)
static String
postHttpContent(String url, Charset charset, String body)
static String
postHttpContent(String url, Charset charset, Map<String,Serializable> headers, String body)
static String
postHttpContent(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(String url)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(String url, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Charset charset, String body)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Charset charset, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Map<String,Serializable> headers, String body)
static CompletableFuture<String>
postHttpContentAsync(HttpClient client, String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static String
println(String string, byte... bytes)
将字节数组的内容转换成字符串并打印到控制台, string参数不为空时会追加在字节数组内容字符串之前static String
println(String string, byte[] bytes, int start, int len)
将字节数组的内容转换成字符串并打印到控制台, string参数不为空时会追加在字节数组内容字符串之前static String
println(String string, ByteBuffer buffer)
将buffer的内容转换成字符串并打印到控制台, string参数不为空时会追加在buffer内容字符串之前static String
read(InputStream in)
static String
read(InputStream in, String charsetName)
static String
read(InputStream in, Charset charset)
static byte[]
readBytes(File file)
static byte[]
readBytes(InputStream in)
static byte[]
readBytesThenClose(InputStream in)
static Class
readClassName(LambdaBiConsumer consumer)
static Class
readClassName(LambdaSupplier func)
static String
readFieldName(LambdaBiConsumer consumer)
static String
readFieldName(LambdaFunction func)
static String
readFieldName(LambdaSupplier func)
static ByteArrayOutputStream
readStream(InputStream in)
static ByteArrayOutputStream
readStreamThenClose(InputStream in)
static String
readThenClose(InputStream in)
static byte[]
remoteHttpBytesContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers)
static byte[]
remoteHttpBytesContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static byte[]
remoteHttpBytesContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers, String body)
static ByteArrayOutputStream
remoteHttpContent(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
static ByteArrayOutputStream
remoteHttpContent(String method, String url, Map<String,Serializable> headers, String body)
static String
remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset)
static String
remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers)
static String
remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
static ByteArrayOutputStream
remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
static String
remoteHttpContent(HttpClient client, String method, String url, Charset charset)
static String
remoteHttpContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers)
static String
remoteHttpContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers, String body)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(String method, String url, Map<String,Serializable> headers, String body)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(String method, String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
static CompletableFuture<ByteArrayOutputStream>
remoteHttpContentAsync(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
static int[]
remove(int[] array, boolean repeat, int... items)
将指定的int元素从数组中删除, repeat=false时相同的元素会根据items里重复次数来执行删除
例如:
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static long[]
remove(long[] array, boolean repeat, long... items)
将指定的long元素从数组中删除, repeat=false时相同的元素会根据items里重复次数来执行删除
例如:
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static short[]
remove(short[] array, boolean repeat, short... items)
将指定的int元素从数组中删除, repeat=true时相同的元素会根据items里重复次数来执行删除
例如:
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static String[]
remove(String[] array, String item)
将符合条件的元素从数组中删除static <T> Collection<T>
remove(Collection<T> objs, Predicate filter)
将符合条件的元素从集合中删除static <T> T[]
remove(T[] array, Predicate filter)
将符合条件的元素从数组中删除static <T> T[]
remove(T[] array, T item)
将元素从数组中删除static int[]
removeMatch(int[] array, int... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static long[]
removeMatch(long[] array, long... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static short[]
removeMatch(short[] array, short... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]static <T> boolean[]
reverse(boolean[] array)
static <T> byte[]
reverse(byte[] array)
static <T> char[]
reverse(char[] array)
static <T> double[]
reverse(double[] array)
static <T> float[]
reverse(float[] array)
static <T> int[]
reverse(int[] array)
static <T> long[]
reverse(long[] array)
static <T> short[]
reverse(short[] array)
static <T> List<T>
reverse(List<T> list)
static <T> T[]
reverse(T[] array)
static int
roundToPowerOfTwo(int value)
static SecureRandom
secureRandom()
随机static IntFunction<Serializable[]>
serialArrayFunc()
static byte[]
sha256(byte[] input)
SHA-256static byte[]
sha256(byte[] input, int offset, int len)
SHA-256static byte[]
sha256(String str)
SHA-256static String
sha256Hex(byte[] input)
SHA-256static String
sha256Hex(byte[] input, int offset, int len)
SHA-256static String
sha256Hex(String str)
SHA-256static String
sha256Hex0x(byte[] input)
以0x开头的 SHA-256static String
sha256Hex0x(byte[] input, int offset, int len)
以0x开头的 SHA-256static Consumer<Consumer<String>>
signalShutdownConsumer()
static void
sleep(long millis)
static <P> List<P>
sortPriority(List<P> list)
排序, 值大排前面static int
sum(boolean check, int... array)
获取int数组之和static long
sum(boolean check, long... array)
获取long数组之和static int
sum(int... array)
获取int数组之和, 空数组返回0static long
sum(long... array)
获取long数组之和, 空数组返回0static long
sunday(long time)
已过时。static int
today()
已过时。static int
todayYYMMDD()
已过时。static int
todayYYMMDDHHmm()
已过时。static long
todayYYMMDDHHmmss()
已过时。static long
todayYYYYMMDDHHmmss()
已过时。static int
tomorrow()
已过时。static int
tomorrowYYMMDD()
已过时。static String
toString(String string, ByteBuffer buffer)
将buffer的内容转换成字符串, string参数不为空时会追加在buffer内容字符串之前static MethodHandles.Lookup
trustedLookup()
static <T> T[]
unshift(T[] array, Collection<T> objs)
将一个或多个新元素添加到数组开始,数组中的元素自动后移static <T> T[]
unshift(T[] array, T... objs)
将一个或多个新元素添加到数组开始,数组中的元素自动后移static byte[]
utf16ByteArray(String value)
static String
uuid()
获取不带"-"的UUID值static Function<String,ExecutorService>
virtualExecutorFunction()
static Function<String,ThreadFactory>
virtualFactoryFunction()
static <T> ThreadLocal<T>
withInitialThreadLocal(Supplier<T> supplier)
static int
yesterday()
已过时。static int
yesterdayYYMMDD()
已过时。static int
yyMMdd(long time)
已过时。static int
yyMMDDHHmm(long time)
已过时。static int
yyyyMMdd(long time)
已过时。
-
-
-
方法详细资料
-
cpus
public static int cpus()
-
trustedLookup
@Nullable public static MethodHandles.Lookup trustedLookup()
-
inNativeImage
public static boolean inNativeImage()
-
virtualExecutorFunction
public static Function<String,ExecutorService> virtualExecutorFunction()
-
withInitialThreadLocal
public static <T> ThreadLocal<T> withInitialThreadLocal(Supplier<T> supplier)
-
virtualFactoryFunction
public static Function<String,ThreadFactory> virtualFactoryFunction()
-
newThreadFactory
public static ThreadFactory newThreadFactory(String name)
-
newScheduledExecutor
public static ScheduledThreadPoolExecutor newScheduledExecutor(int corePoolSize)
-
newScheduledExecutor
public static ScheduledThreadPoolExecutor newScheduledExecutor(int corePoolSize, String name)
-
newScheduledExecutor
public static ScheduledThreadPoolExecutor newScheduledExecutor(int corePoolSize, String name, RejectedExecutionHandler handler)
-
serialArrayFunc
public static IntFunction<Serializable[]> serialArrayFunc()
-
futureArrayFunc
public static IntFunction<CompletableFuture[]> futureArrayFunc()
-
defaultExecutor
public static Executor defaultExecutor()
-
methodKey
public static String methodKey(Method method)
构建method的唯一key,用于遍历类及父类的所有方法,key过滤重载方法- 参数:
method
- 方法- 返回:
- key
-
orElse
public static <T> T orElse(T val1, T val2)
返回第一个不为null的对象- 类型参数:
T
- 泛型- 参数:
val1
- 对象1val2
- 对象2- 返回:
- 可用对象,可能返回null
-
orElse
public static <T> T orElse(T... vals)
返回第一个不为null的对象- 类型参数:
T
- 泛型- 参数:
vals
- 对象集合- 返回:
- 可用对象,可能返回null
-
execute
public static void execute(Runnable task)
-
sleep
public static void sleep(long millis)
-
isAbstractOrInterface
public static boolean isAbstractOrInterface(Class clazz)
-
readFieldName
public static String readFieldName(LambdaFunction func)
-
readFieldName
public static String readFieldName(LambdaBiConsumer consumer)
-
readClassName
public static Class readClassName(LambdaBiConsumer consumer)
-
readFieldName
public static String readFieldName(LambdaSupplier func)
-
readClassName
public static Class readClassName(LambdaSupplier func)
-
roundToPowerOfTwo
public static int roundToPowerOfTwo(int value)
- 参数:
value
- from which next positive power of two will be found.- 返回:
- the next positive power of 2, this value if it is a power of 2. Negative values are mapped to 1.
- 抛出:
IllegalArgumentException
- is value is more than MAX_POW2 or less than 0
-
isRecordGetter
public static boolean isRecordGetter(Method method)
-
orTimeout
public static <T> CompletableFuture<T> orTimeout(CompletableFuture future, Supplier<String> errMsgFunc, Duration timeout)
-
orTimeout
public static <T> CompletableFuture<T> orTimeout(CompletableFuture future, Supplier<String> errMsgFunc, long timeout, TimeUnit unit)
-
completeOnTimeout
public static <T> CompletableFuture<T> completeOnTimeout(CompletableFuture future, T value, Duration timeout)
-
completeOnTimeout
public static <T> CompletableFuture<T> completeOnTimeout(CompletableFuture future, T value, long timeout, TimeUnit unit)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(List<CompletableFuture<T>> list, IntFunction<T[]> func)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(Stream<CompletableFuture<T>> stream, IntFunction<T[]> func)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(CompletableFuture<T>[] futures, IntFunction<T[]> func)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(List<CompletableFuture<T>> list, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(Stream<CompletableFuture<T>> stream, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
-
allOfFutures
public static <T> CompletableFuture<T[]> allOfFutures(CompletableFuture<T>[] futures, IntFunction<T[]> func, BiConsumer<Integer,T> consumer)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(List<CompletableFuture<T>> list)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(Stream<CompletableFuture<T>> stream)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(CompletableFuture<T>[] futures)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(List<CompletableFuture<T>> list, BiConsumer<Integer,T> consumer)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(Stream<CompletableFuture<T>> stream, BiConsumer<Integer,T> consumer)
-
allOfFutures
public static <T> CompletableFuture<List<T>> allOfFutures(CompletableFuture<T>[] futures, BiConsumer<Integer,T> consumer)
-
isNumeric
public static boolean isNumeric(String str)
是否为数字字符串- 参数:
str
- 字符串- 返回:
- 是否为数字字符串
-
isBlank
public static boolean isBlank(String str)
是否为空白- 参数:
str
- 字符串- 返回:
- 是否为空白
-
isBlank
public static boolean isBlank(String str, int fromIndex, int toIndex)
是否为空白- 参数:
str
- 字符串fromIndex
- 起始位置toIndex
- 结束位置- 返回:
- 是否为空白
-
isAnyBlank
public static boolean isAnyBlank(String... strs)
字符串是否至少一个为空白- 参数:
strs
- 字符串集合- 返回:
- 是否为空白
-
isNotBlank
public static boolean isNotBlank(String str)
是否不为空白- 参数:
str
- 字符串- 返回:
- 是否不为空白
-
isNotBlank
public static boolean isNotBlank(String str, int fromIndex, int toIndex)
是否不为空白- 参数:
str
- 字符串fromIndex
- 起始位置toIndex
- 结束位置- 返回:
- 是否为空白
-
isEmpty
public static boolean isEmpty(CharSequence str)
是否为空- 参数:
str
- 字符串- 返回:
- 是否为空
-
isAnyEmpty
public static boolean isAnyEmpty(CharSequence... strs)
字符串是否至少一个为空- 参数:
strs
- 字符串集合- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(CharSequence str)
是否不为空- 参数:
str
- 字符串- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(Map map)
是否为空- 参数:
map
- Map- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(Map map)
是否不为空- 参数:
map
- Map- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(Collection collection)
是否为空- 参数:
collection
- Collection- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(Collection collection)
是否不为空- 参数:
collection
- Collection- 返回:
- 是否不为空
-
isEmpty
public static <T> boolean isEmpty(T[] array)
是否为空- 类型参数:
T
- 泛型- 参数:
array
- 数组- 返回:
- 是否为空
-
isNotEmpty
public static <T> boolean isNotEmpty(T[] array)
是否不为空- 类型参数:
T
- 泛型- 参数:
array
- 数组- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(byte[] array)
是否为空- 参数:
array
- 数组- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(byte[] array)
是否不为空- 参数:
array
- 数组- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(short[] array)
是否为空- 参数:
array
- 数组- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(short[] array)
是否不为空- 参数:
array
- 数组- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(int[] array)
是否为空- 参数:
array
- 数组- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(int[] array)
是否不为空- 参数:
array
- 数组- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(long[] array)
是否为空- 参数:
array
- 数组- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(long[] array)
是否不为空- 参数:
array
- 数组- 返回:
- 是否不为空
-
isEmpty
public static boolean isEmpty(ByteArray array)
是否为空- 参数:
array
- ByteArray- 返回:
- 是否为空
-
isNotEmpty
public static boolean isNotEmpty(ByteArray array)
是否不为空- 参数:
array
- ByteArray- 返回:
- 是否不为空
-
firstCharUpperCase
public static String firstCharUpperCase(String str)
将字符串首字母大写- 参数:
str
- 字符串- 返回:
- 首字母大写
-
firstCharLowerCase
public static String firstCharLowerCase(String str)
将字符串首字母小写- 参数:
str
- 字符串- 返回:
- 首字母小写
-
box
public static boolean[] box(Boolean[] array)
-
box
public static Boolean[] box(boolean[] array)
-
box
public static byte[] box(Byte[] array)
-
box
public static Byte[] box(byte[] array)
-
box
public static char[] box(Character[] array)
-
box
public static Character[] box(char[] array)
-
box
public static short[] box(Short[] array)
-
box
public static Short[] box(short[] array)
-
box
public static int[] box(Integer[] array)
-
box
public static Integer[] box(int[] array)
-
box
public static long[] box(Long[] array)
-
box
public static Long[] box(long[] array)
-
box
public static float[] box(Float[] array)
-
box
public static Float[] box(float[] array)
-
box
public static double[] box(Double[] array)
-
box
public static Double[] box(double[] array)
-
reverse
public static <T> boolean[] reverse(boolean[] array)
-
reverse
public static <T> byte[] reverse(byte[] array)
-
reverse
public static <T> char[] reverse(char[] array)
-
reverse
public static <T> short[] reverse(short[] array)
-
reverse
public static <T> int[] reverse(int[] array)
-
reverse
public static <T> long[] reverse(long[] array)
-
reverse
public static <T> float[] reverse(float[] array)
-
reverse
public static <T> double[] reverse(double[] array)
-
reverse
public static <T> T[] reverse(T[] array)
-
ofMap
@ClassDepends public static <K,V> HashMap<K,V> ofMap(Object... items)
将多个key:value对应值组合成一个Map,items长度必须是偶数, 参数个数若是奇数的话,最后一个会被忽略 类似 JDK9中的 Map.of 方法- 类型参数:
K
- 泛型V
- 泛型- 参数:
items
- 键值对- 返回:
- Map
-
merge
public static <K,V> Map<K,V> merge(Map<K,V>... maps)
将多个Map合并到第一个Map中- 类型参数:
K
- 泛型V
- 泛型- 参数:
maps
- Map- 返回:
- Map
-
ofSet
public static <T> Set<T> ofSet(T... items)
将多个元素组合成一个Set- 类型参数:
T
- 泛型- 参数:
items
- 元素- 返回:
- Set
-
ofList
public static <T> List<T> ofList(T... items)
将多个元素组合成一个List
类似 JDK9中的 List.of 方法- 类型参数:
T
- 泛型- 参数:
items
- 元素- 返回:
- List
-
ofArray
public static <T> T[] ofArray(T... items)
将多个元素组合成一个Array- 类型参数:
T
- 泛型- 参数:
items
- 元素- 返回:
- Array
-
limit
public static <T> List<T> limit(List<T> list, int limit)
裁剪List,使其size不超过limit大小- 类型参数:
T
- 泛型- 参数:
list
- 集合limit
- 大小- 返回:
- List
-
uuid
public static String uuid()
获取不带"-"的UUID值- 返回:
- 不带"-"UUID值
-
compareVersion
public static int compareVersion(String version1, String version2)
比较两个版本号的大小,ver1小于ver2返回 -1- 参数:
version1
- 版本号version2
- 版本号- 返回:
- 版本大小
-
sortPriority
public static <P> List<P> sortPriority(List<P> list)
排序, 值大排前面- 类型参数:
P
- 泛型- 参数:
list
- 集合- 返回:
- 排序后的集合
-
unshift
public static <T> T[] unshift(T[] array, T... objs)
将一个或多个新元素添加到数组开始,数组中的元素自动后移- 类型参数:
T
- 泛型- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
unshift
public static <T> T[] unshift(T[] array, Collection<T> objs)
将一个或多个新元素添加到数组开始,数组中的元素自动后移- 类型参数:
T
- 泛型- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
sum
public static int sum(int... array)
获取int数组之和, 空数组返回0- 参数:
array
- 数组- 返回:
- int
-
sum
public static int sum(boolean check, int... array)
获取int数组之和- 参数:
check
- 是否检测空array
- 数组- 返回:
- int
-
sum
public static long sum(long... array)
获取long数组之和, 空数组返回0- 参数:
array
- 数组- 返回:
- long
-
sum
public static long sum(boolean check, long... array)
获取long数组之和- 参数:
check
- 是否检测空array
- 数组- 返回:
- long
-
max
public static int max(int... array)
获取int数组最大值- 参数:
array
- 数组- 返回:
- int
-
max
public static long max(long... array)
获取long数组最大值- 参数:
array
- 数组- 返回:
- long
-
min
public static long min(int... array)
获取int数组最小值- 参数:
array
- 数组- 返回:
- int
-
min
public static long min(long... array)
获取long数组最小值- 参数:
array
- 数组- 返回:
- long
-
joining
public static String joining(char[] array, String delimiter)
将char数组用分隔符拼接成字符串- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joining
public static String joining(int[] array, String delimiter)
将int数组用分隔符拼接成字符串- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joining
public static String joining(long[] array, String delimiter)
将long数组用分隔符拼接成字符串- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joining
public static <T> String joining(T[] array, String delimiter)
将对象数组用分隔符拼接成字符串- 类型参数:
T
- 泛型- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joining
public static <T> String joining(Stream<T> stream, String delimiter)
将对象集合用分隔符拼接成字符串- 类型参数:
T
- 泛型- 参数:
stream
- 集合delimiter
- 分隔符- 返回:
- String
-
joining
public static <T> String joining(String[] array, char delimiter)
将对象数组用分隔符拼接成字符串- 类型参数:
T
- 泛型- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joiningHex
public static <T> String joiningHex(byte[] array, char delimiter)
将对象数组用分隔符拼接成字符串- 类型参数:
T
- 泛型- 参数:
array
- 数组delimiter
- 分隔符- 返回:
- String
-
joiningHex
public static <T> String joiningHex(byte[] array, int offset, int length, char delimiter)
将对象数组用分隔符拼接成字符串- 类型参数:
T
- 泛型- 参数:
array
- 数组offset
- 偏移量length
- 长度delimiter
- 分隔符- 返回:
- String
-
append
public static byte[] append(byte[] array, byte... objs)
将一个或多个byte新元素添加到byte数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static byte[] append(byte[] array, byte[] objs, int offset, int length)
将一个或多个byte新元素添加到byte数组结尾- 参数:
array
- 原数组objs
- 待追加数据offset
- 待追加数据偏移量length
- 待追加数据的长度- 返回:
- 新数组
-
append
public static short[] append(short[] array, short... objs)
将一个或多个short新元素添加到short数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static char[] append(char[] array, char... objs)
将一个或多个char新元素添加到char数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static int[] append(int[] array, int... objs)
将一个或多个int新元素添加到int数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static long[] append(long[] array, long... objs)
将一个或多个long新元素添加到long数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static String[] append(String[] array, String... objs)
将一个或多个新元素添加到数组结尾- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static String[] append(String one, String... objs)
将一个或多个新元素添加到数组结尾- 参数:
one
- 单个对象objs
- 待追加数据- 返回:
- 新数组
-
append
public static String[] append(String one, String two, String... objs)
将一个或多个新元素添加到数组结尾- 参数:
one
- 单个对象two
- 单个对象objs
- 待追加数据- 返回:
- 新数组
-
append
public static <T> T[] append(T[] array, T... objs)
将一个或多个新元素添加到数组结尾- 类型参数:
T
- 泛型- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static <T> Object[][] append(Object[][] array, Object[]... objs)
将一个或多个新元素添加到数组结尾- 类型参数:
T
- 泛型- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
append
public static <T> T[] append(T[] array, Collection<T> objs)
将一个或多个新元素添加到数组结尾- 类型参数:
T
- 泛型- 参数:
array
- 原数组objs
- 待追加数据- 返回:
- 新数组
-
remove
public static <T> T[] remove(T[] array, T item)
将元素从数组中删除- 类型参数:
T
- 泛型- 参数:
array
- 原数组item
- 元素- 返回:
- 新数组
-
remove
public static <T> T[] remove(T[] array, Predicate filter)
将符合条件的元素从数组中删除- 类型参数:
T
- 泛型- 参数:
array
- 原数组filter
- Predicate- 返回:
- 新数组
-
remove
public static String[] remove(String[] array, String item)
将符合条件的元素从数组中删除- 参数:
array
- 原数组item
- 元素- 返回:
- 新数组
-
removeMatch
public static short[] removeMatch(short[] array, short... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组items
- short[]- 返回:
- 新数组
-
remove
public static short[] remove(short[] array, boolean repeat, short... items)
将指定的int元素从数组中删除, repeat=true时相同的元素会根据items里重复次数来执行删除
例如:
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new short[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组repeat
- 是否重复删除相同的元素items
- short[]- 返回:
- 新数组
-
removeMatch
public static int[] removeMatch(int[] array, int... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组items
- int[]- 返回:
- 新数组
-
remove
public static int[] remove(int[] array, boolean repeat, int... items)
将指定的int元素从数组中删除, repeat=false时相同的元素会根据items里重复次数来执行删除
例如:
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new int[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组repeat
- 是否重复删除相同的元素items
- int[]- 返回:
- 新数组
-
removeMatch
public static long[] removeMatch(long[] array, long... items)
将指定的long元素从数组中删除, 相同的元素会根据items里重复次数来执行删除
例如:
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组items
- long[]- 返回:
- 新数组
-
remove
public static long[] remove(long[] array, boolean repeat, long... items)
将指定的long元素从数组中删除, repeat=false时相同的元素会根据items里重复次数来执行删除
例如:
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, true, 1, 1, 2, 3, 3) = []
remove(new long[]{1, 1, 1, 2, 2, 3, 3, 3}, false, 1, 1, 2, 3, 3) = [1,2,3]- 参数:
array
- 原数组repeat
- 是否重复删除相同的元素items
- long[]- 返回:
- 新数组
-
remove
public static <T> Collection<T> remove(Collection<T> objs, Predicate filter)
将符合条件的元素从集合中删除- 类型参数:
T
- 泛型- 参数:
objs
- 原集合filter
- Predicate- 返回:
- 新集合
-
contains
public static boolean contains(String string, char... values)
判断字符串是否包含指定的字符,包含返回true- 参数:
string
- 字符串values
- 字符集合- 返回:
- boolean
-
equalsElement
public static <T> boolean equalsElement(T[] array1, T[] array2)
比较两集合元素是否一样, 顺序不要求一样- 类型参数:
T
- 泛型- 参数:
array1
- 集合array2
- 集合- 返回:
- 元素是否完全相同
-
equalsElement
public static <T> boolean equalsElement(Collection<T> col1, Collection<T> col2)
比较两集合元素是否一样, 顺序不要求一样- 类型参数:
T
- 泛型- 参数:
col1
- 集合col2
- 集合- 返回:
- 元素是否完全相同
-
equalsElement
public static <K,V> boolean equalsElement(Map<K,V> map1, Map<K,V> map2)
比较两集合元素是否一样, 顺序不要求一样- 类型参数:
K
- 泛型V
- 泛型- 参数:
map1
- 集合map2
- 集合- 返回:
- 元素是否完全相同
-
contains
public static boolean contains(char[] values, char value)
判断指定值是否包含指定的数组中,包含返回true- 参数:
values
- 集合value
- 单值- 返回:
- boolean
-
contains
public static boolean contains(short[] values, short value)
判断指定值是否包含指定的数组中,包含返回true- 参数:
values
- 集合value
- 单值- 返回:
- boolean
-
contains
public static boolean contains(short[] values, short... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true- 参数:
values
- 集合items
- 多值- 返回:
- boolean
-
contains
public static boolean contains(int[] values, int value)
判断指定值是否包含指定的数组中,包含返回true- 参数:
values
- 集合value
- 单值- 返回:
- boolean
-
contains
public static boolean contains(int[] values, int... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true- 参数:
values
- 集合items
- 多值- 返回:
- boolean
-
contains
public static boolean contains(long[] values, long value)
判断指定值是否包含指定的数组中,包含返回true- 参数:
values
- 集合value
- 单值- 返回:
- boolean
-
contains
public static boolean contains(long[] values, long... items)
判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true- 参数:
values
- 集合items
- 多值- 返回:
- boolean
-
contains
public static <T> boolean contains(T[] values, T value)
判断指定值是否包含指定的数组中,包含返回true- 类型参数:
T
- 泛型- 参数:
values
- 集合value
- 单值- 返回:
- boolean
-
contains
public static <T> boolean contains(T[] values, Predicate<T> predicate)
判断指定值是否包含指定的数组中,包含返回true- 类型参数:
T
- 泛型- 参数:
values
- 集合predicate
- 过滤条件- 返回:
- boolean
-
contains
public static <T> boolean contains(Collection<T> values, Predicate<T> predicate)
判断指定值是否包含指定的数组中,包含返回true- 类型参数:
T
- 泛型- 参数:
values
- 集合predicate
- 过滤条件- 返回:
- boolean
-
containsMatch
public static boolean containsMatch(short[] array, short... items)
将指定的short元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new short[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new short[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = false- 参数:
array
- 原数组items
- short[]- 返回:
- 是否完全包含
-
containsMatch
public static boolean containsMatch(int[] array, int... items)
将指定的int元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new int[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new int[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = false- 参数:
array
- 原数组items
- int[]- 返回:
- 是否完全包含
-
containsMatch
public static boolean containsMatch(long[] array, long... items)
将指定的long元素是否数组中完全包含,重复元素的次数也要相同
例如:
containsMatch(new long[]{1, 2, 2, 3, 3, 3}, 1, 2, 3, 3) = true
containsMatch(new long[]{1, 2, 2, 3, 3, 3}, 1, 1, 2, 3, 3) = false- 参数:
array
- 原数组items
- long[]- 返回:
- 是否完全包含
-
exclude
public static String[] exclude(String[] columns, String... cols)
删除掉字符串数组中包含指定的字符串- 参数:
columns
- 待删除数组cols
- 需排除的字符串- 返回:
- 新字符串数组
-
find
public static <T> T find(T[] array, Predicate<T> predicate)
查询指定对象, 没有返回null- 类型参数:
T
- 泛型- 参数:
array
- 数组predicate
- 查找器- 返回:
- 对象
-
find
public static <T> T find(Collection<T> array, Predicate<T> predicate)
查询指定对象, 没有返回null- 类型参数:
T
- 泛型- 参数:
array
- 数组predicate
- 查找器- 返回:
- 对象
-
indexOf
public static <T> int indexOf(T[] array, Predicate<T> predicate)
查询指定对象位置, 没有返回-1- 类型参数:
T
- 泛型- 参数:
array
- 数组predicate
- 查找器- 返回:
- 位置
-
indexOf
public static <T> int indexOf(Collection<T> array, Predicate<T> predicate)
查询指定对象位置, 没有返回-1- 类型参数:
T
- 泛型- 参数:
array
- 数组predicate
- 查找器- 返回:
- 位置
-
indexOf
public static int indexOf(byte[] array, byte element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(byte[] array, int fromIndex, byte element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(short[] array, short element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(short[] array, int fromIndex, short element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(char[] array, char element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(char[] array, int fromIndex, char element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(int[] array, int element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(int[] array, int fromIndex, int element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(long[] array, long element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(long[] array, int fromIndex, long element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(float[] array, float element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(float[] array, int fromIndex, float element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(double[] array, double element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组element
- 指定值- 返回:
- 位置
-
indexOf
public static int indexOf(double[] array, int fromIndex, double element)
查询指定值位置, 没有返回-1- 参数:
array
- 数组fromIndex
- 起始位置,从0开始element
- 指定值- 返回:
- 位置
-
convertValue
@ClassDepends(Copier.class) public static <T> T convertValue(Type type, Object value)
将源对象转换成目标类型- 类型参数:
T
- 泛型- 参数:
type
- 目标类型value
- 源对象- 返回:
- 对象
-
toString
public static String toString(String string, ByteBuffer buffer)
将buffer的内容转换成字符串, string参数不为空时会追加在buffer内容字符串之前- 参数:
string
- 字符串前缀buffer
- ByteBuffer- 返回:
- 字符串
-
println
public static String println(String string, ByteBuffer buffer)
将buffer的内容转换成字符串并打印到控制台, string参数不为空时会追加在buffer内容字符串之前- 参数:
string
- 字符串前缀buffer
- ByteBuffer- 返回:
- 字符串
-
println
public static String println(String string, byte... bytes)
将字节数组的内容转换成字符串并打印到控制台, string参数不为空时会追加在字节数组内容字符串之前- 参数:
string
- 字符串前缀bytes
- 字节数组- 返回:
- 字符串
-
println
public static String println(String string, byte[] bytes, int start, int len)
将字节数组的内容转换成字符串并打印到控制台, string参数不为空时会追加在字节数组内容字符串之前- 参数:
string
- 字符串前缀bytes
- 字节数组start
- 起始位置len
- 长度- 返回:
- 字符串
-
localInetAddress
public static InetAddress localInetAddress()
返回本机的第一个内网IPv4地址, 没有则返回null- 返回:
- IPv4地址
-
createAsyncHandler
public static <V,A> CompletionHandler<V,A> createAsyncHandler(BiConsumer<V,A> success, BiConsumer<Throwable,A> fail)
创建 CompletionHandler 对象- 类型参数:
V
- 结果对象的泛型A
- 附件对象的泛型- 参数:
success
- 成功的回调函数fail
- 失败的回调函数- 返回:
- CompletionHandler
-
createAsyncHandler
public static <A> CompletionHandler<Void,A> createAsyncHandler(Consumer<A> success, BiConsumer<Throwable,A> fail)
创建没有返回结果的 CompletionHandler 对象- 类型参数:
A
- 附件对象的泛型- 参数:
success
- 成功的回调函数fail
- 失败的回调函数- 返回:
- CompletionHandler
-
createAsyncHandler
public static <V> CompletionHandler<V,Void> createAsyncHandler(Consumer<V> success, Consumer<Throwable> fail)
创建没有附件对象的 CompletionHandler 对象- 类型参数:
V
- 结果对象的泛型- 参数:
success
- 成功的回调函数fail
- 失败的回调函数- 返回:
- CompletionHandler
-
now
@Deprecated(since="2.8.0") public static String now()
已过时。获取格式为yyyy-MM-dd HH:mm:ss的当前时间- 返回:
- 格式为yyyy-MM-dd HH:mm:ss的时间值
-
nowMillis
@Deprecated(since="2.8.0") public static String nowMillis()
已过时。获取格式为yyyy-MM-dd HH:mm:ss.fff的当前时间- 返回:
- 格式为yyyy-MM-dd HH:mm:ss.fff的时间值
-
formatTime
@Deprecated(since="2.8.0") public static String formatTime(long time)
已过时。将指定时间格式化为 yyyy-MM-dd HH:mm:ss- 参数:
time
- 待格式化的时间- 返回:
- 格式为yyyy-MM-dd HH:mm:ss的时间值
-
format36time
@Deprecated(since="2.8.0") public static String format36time(long time)
已过时。将时间值转换为长度为9的36进制值- 参数:
time
- 时间值- 返回:
- 36进制时间值
-
midnight
@Deprecated(since="2.8.0") public static long midnight()
已过时。获取当天凌晨零点的格林时间- 返回:
- 毫秒数
-
midnight
@Deprecated(since="2.8.0") public static long midnight(long time)
已过时。获取指定时间当天凌晨零点的格林时间- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
today
@Deprecated(since="2.8.0") public static int today()
已过时。获取当天20151231格式的int值- 返回:
- 20151231格式的int值
-
todayYYMMDD
@Deprecated(since="2.8.0") public static int todayYYMMDD()
已过时。获取当天151231格式的int值- 返回:
- 151231格式的int值
-
todayYYMMDDHHmm
@Deprecated(since="2.8.0") public static int todayYYMMDDHHmm()
已过时。获取当天1512312359格式的int值- 返回:
- 1512312359格式的int值
-
todayYYYYMMDDHHmmss
@Deprecated(since="2.8.0") public static long todayYYYYMMDDHHmmss()
已过时。获取当天20151231235959格式的int值- 返回:
- 20151231235959格式的int值
-
todayYYMMDDHHmmss
@Deprecated(since="2.8.0") public static long todayYYMMDDHHmmss()
已过时。获取当天151231235959格式的int值- 返回:
- 151231235959格式的int值
-
tomorrow
@Deprecated(since="2.8.0") public static int tomorrow()
已过时。获取明天20151230格式的int值- 返回:
- 20151230格式的int值
-
tomorrowYYMMDD
@Deprecated(since="2.8.0") public static int tomorrowYYMMDD()
已过时。获取明天151230格式的int值- 返回:
- 151230格式的int值
-
yesterday
@Deprecated(since="2.8.0") public static int yesterday()
已过时。获取昨天20151230格式的int值- 返回:
- 20151230格式的int值
-
yesterdayYYMMDD
@Deprecated(since="2.8.0") public static int yesterdayYYMMDD()
已过时。获取昨天151230格式的int值- 返回:
- 151230格式的int值
-
yyyyMMdd
@Deprecated(since="2.8.0") public static int yyyyMMdd(long time)
已过时。获取指定时间的20160202格式的int值- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
yyMMdd
@Deprecated(since="2.8.0") public static int yyMMdd(long time)
已过时。获取指定时间的160202格式的int值- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
yyMMDDHHmm
@Deprecated(since="2.8.0") public static int yyMMDDHHmm(long time)
已过时。获取当天16020223格式的int值- 参数:
time
- 指定时间- 返回:
- 16020223格式的int值
-
monday
@Deprecated(since="2.8.0") public static long monday(long time)
已过时。获取时间点所在星期的周一- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
sunday
@Deprecated(since="2.8.0") public static long sunday(long time)
已过时。获取时间点所在星期的周日- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
monthFirstDay
@Deprecated(since="2.8.0") public static long monthFirstDay(long time)
已过时。获取时间点所在月份的1号- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
monthLastDay
@Deprecated(since="2.8.0") public static long monthLastDay(long time)
已过时。获取时间点所在月份的最后一天- 参数:
time
- 指定时间- 返回:
- 毫秒数
-
formatTime
@Deprecated(since="2.8.0") public static String formatTime(String format, int size, Object time)
已过时。将时间格式化, 支持%1$ty 和 %ty两种格式- 参数:
format
- 格式size
- 带%t的个数,值小于0则需要计算time
- 时间- 返回:
- 时间格式化
- 从以下版本开始:
- 2.7.0
-
intsToBytes
public static byte[] intsToBytes(int[] value)
将int[]强制转换成byte[]- 参数:
value
- int[]- 返回:
- byte[]
-
md5Hex
public static String md5Hex(byte[] input)
MD5加密- 参数:
input
- 待加密数据- 返回:
- md5值
-
md5
public static byte[] md5(String str)
MD5加密- 参数:
str
- 待加密数据- 返回:
- md5值
-
md5
public static byte[] md5(byte[] input)
MD5加密- 参数:
input
- 待加密数据- 返回:
- md5值
-
md5
public static byte[] md5(byte[] input, int offset, int len)
MD5加密- 参数:
input
- 待加密数据offset
- 偏移量len
- 长度- 返回:
- md5值
-
sha256Hex
public static String sha256Hex(byte[] input)
SHA-256- 参数:
input
- 待hash数据- 返回:
- hash值
-
sha256Hex
public static String sha256Hex(byte[] input, int offset, int len)
SHA-256- 参数:
input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
sha256Hex0x
public static String sha256Hex0x(byte[] input)
以0x开头的 SHA-256- 参数:
input
- 待hash数据- 返回:
- hash值
-
sha256Hex0x
public static String sha256Hex0x(byte[] input, int offset, int len)
以0x开头的 SHA-256- 参数:
input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
sha256
public static byte[] sha256(String str)
SHA-256- 参数:
str
- 待hash数据- 返回:
- hash值
-
sha256
public static byte[] sha256(byte[] input)
SHA-256- 参数:
input
- 待hash数据- 返回:
- hash值
-
sha256
public static byte[] sha256(byte[] input, int offset, int len)
SHA-256- 参数:
input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha1Base64
public static String hmacSha1Base64(String key, String input)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha1Base64
public static String hmacSha1Base64(byte[] key, byte[] input)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha1Base64
public static String hmacSha1Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha1Hex
public static String hmacSha1Hex(byte[] key, byte[] input)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha1Hex
public static String hmacSha1Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha1Hex0x
public static String hmacSha1Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA1- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha1Hex0x
public static String hmacSha1Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA1- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha1
public static byte[] hmacSha1(byte[] key, byte[] input)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha1
public static byte[] hmacSha1(byte[] key, byte[] input, int offset, int len)
HmacSHA1- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha256Base64
public static String hmacSha256Base64(String key, String input)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha256Base64
public static String hmacSha256Base64(byte[] key, byte[] input)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha256Base64
public static String hmacSha256Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha256Hex
public static String hmacSha256Hex(byte[] key, byte[] input)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha256Hex
public static String hmacSha256Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha256Hex0x
public static String hmacSha256Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA256- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha256Hex0x
public static String hmacSha256Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA256- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha256
public static byte[] hmacSha256(byte[] key, byte[] input)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha256
public static byte[] hmacSha256(byte[] key, byte[] input, int offset, int len)
HmacSHA256- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha512Base64
public static String hmacSha512Base64(String key, String input)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha512Base64
public static String hmacSha512Base64(byte[] key, byte[] input)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha512Base64
public static String hmacSha512Base64(byte[] key, byte[] input, int offset, int len)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha512Hex
public static String hmacSha512Hex(byte[] key, byte[] input)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha512Hex
public static String hmacSha512Hex(byte[] key, byte[] input, int offset, int len)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha512Hex0x
public static String hmacSha512Hex0x(byte[] key, byte[] input)
以0x开头的 HmacSHA512- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha512Hex0x
public static String hmacSha512Hex0x(byte[] key, byte[] input, int offset, int len)
以0x开头的 HmacSHA512- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hmacSha512
public static byte[] hmacSha512(byte[] key, byte[] input)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据- 返回:
- hash值
-
hmacSha512
public static byte[] hmacSha512(byte[] key, byte[] input, int offset, int len)
HmacSHA512- 参数:
key
- 密钥input
- 待hash数据offset
- 偏移量len
- 长度- 返回:
- hash值
-
hash
public static byte[] hash(String algorithm, byte[] input)
根据指定算法进行hash- 参数:
algorithm
- 算法名input
- 待hash数据- 返回:
- hash值
-
hash
public static byte[] hash(String algorithm, byte[] input, int offset, int length)
根据指定算法进行hash- 参数:
algorithm
- 算法名input
- 待hash数据offset
- 偏移量length
- 长度- 返回:
- hash值
-
secureRandom
public static SecureRandom secureRandom()
随机- 返回:
- 随机
-
generateRandomBytes
public static byte[] generateRandomBytes(int size)
生成随机数- 参数:
size
- 随机数长度- 返回:
- 随机数
-
binTo0xHexString
public static String binTo0xHexString(byte[] bytes)
将字节数组转换为以0x开头的16进制字符串- 参数:
bytes
- 字节数组- 返回:
- 16进制字符串
-
binTo0xHexString
public static String binTo0xHexString(byte[] bytes, int offset, int len)
将字节数组转换为以0x开头的16进制字符串- 参数:
bytes
- 字节数组offset
- 偏移量len
- 长度- 返回:
- 16进制字符串
-
binToHexString
public static String binToHexString(byte[] bytes)
将字节数组转换为16进制字符串- 参数:
bytes
- 字节数组- 返回:
- 16进制字符串
-
binToHex
public static char[] binToHex(byte[] bytes)
将字节数组转换为16进制字符数组- 参数:
bytes
- 字节数组- 返回:
- 16进制字符串的字符数组
-
binToHexString
public static String binToHexString(byte[] bytes, int offset, int len)
将字节数组转换为16进制字符串- 参数:
bytes
- 字节数组offset
- 偏移量len
- 长度- 返回:
- 16进制字符串
-
binToHex
public static char[] binToHex(byte[] bytes, int offset, int len)
将字节数组转换为16进制字符数组- 参数:
bytes
- 字节数组offset
- 偏移量len
- 长度- 返回:
- 16进制字符串的字符数组
-
hexToBin
public static byte[] hexToBin(CharSequence src)
将16进制字符串转换成字节数组- 参数:
src
- 16进制字符串- 返回:
- 字节数组
-
hexToBin
public static byte[] hexToBin(CharSequence src, int offset, int len)
将16进制字符串转换成字节数组- 参数:
src
- 16进制字符串offset
- 偏移量len
- 长度- 返回:
- 字节数组
-
hexToBin
public static byte[] hexToBin(String str)
将16进制字符串转换成字节数组- 参数:
str
- 16进制字符串- 返回:
- 字节数组
-
hexToBin
public static byte[] hexToBin(char[] src)
将16进制字符数组转换成字节数组- 参数:
src
- 16进制字符数组- 返回:
- 字节数组
-
hexToBin
public static byte[] hexToBin(char[] src, int offset, int len)
将16进制字符数组转换成字节数组- 参数:
src
- 16进制字符数组offset
- 偏移量len
- 长度- 返回:
- 字节数组
-
decodeUTF8
public static char[] decodeUTF8(byte[] array)
使用UTF-8编码将byte[]转换成char[]- 参数:
array
- byte[]- 返回:
- char[]
-
decodeUTF8
public static char[] decodeUTF8(byte[] array, int start, int len)
-
encodeUTF8
public static byte[] encodeUTF8(String value)
-
encodeUTF8
public static byte[] encodeUTF8(char[] array)
-
encodeUTF8
public static byte[] encodeUTF8(char[] text, int start, int len)
-
encodeUTF8Length
public static int encodeUTF8Length(String value)
-
encodeUTF8Length
public static int encodeUTF8Length(char[] text)
-
encodeUTF8Length
public static int encodeUTF8Length(char[] text, int start, int len)
-
charArray
public static char[] charArray(StringBuilder value)
-
isLatin1
public static boolean isLatin1(String value)
-
latin1ByteArray
public static byte[] latin1ByteArray(String latin1Value)
-
utf16ByteArray
public static byte[] utf16ByteArray(String value)
-
charArray
public static char[] charArray(String value)
-
merge
public static long merge(int high, int low)
将两个数字组装成一个long- 参数:
high
- 高位值low
- 低位值- 返回:
- long值
-
postHttpContent
public static String postHttpContent(String url) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, Charset charset) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs, Charset charset) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, Charset charset, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs, Charset charset, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpContent
public static String postHttpContent(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpBytesContent
public static byte[] postHttpBytesContent(String url) throws IOException
- 抛出:
IOException
-
postHttpBytesContent
public static byte[] postHttpBytesContent(String url, int timeoutMs) throws IOException
- 抛出:
IOException
-
postHttpBytesContent
public static byte[] postHttpBytesContent(String url, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpBytesContent
public static byte[] postHttpBytesContent(String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, int timeoutMs) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, Charset charset) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, int timeoutMs, Charset charset) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpContent
public static String getHttpContent(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpBytesContent
public static byte[] getHttpBytesContent(String url) throws IOException
- 抛出:
IOException
-
getHttpBytesContent
public static byte[] getHttpBytesContent(String url, int timeoutMs) throws IOException
- 抛出:
IOException
-
getHttpBytesContent
public static byte[] getHttpBytesContent(String url, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
getHttpBytesContent
public static byte[] getHttpBytesContent(String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, Charset charset) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static String remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpBytesContent
public static byte[] remoteHttpBytesContent(HttpClient client, String method, String url, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpBytesContent
public static byte[] remoteHttpBytesContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers) throws IOException
- 抛出:
IOException
-
remoteHttpBytesContent
public static byte[] remoteHttpBytesContent(HttpClient client, String method, String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static ByteArrayOutputStream remoteHttpContent(String method, String url, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static ByteArrayOutputStream remoteHttpContent(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
remoteHttpContent
public static ByteArrayOutputStream remoteHttpContent(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body) throws IOException
- 抛出:
IOException
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Charset charset, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Charset charset, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
-
postHttpContentAsync
public static CompletableFuture<String> postHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, Map<String,Serializable> respHeaders)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
postHttpBytesContentAsync
public static CompletableFuture<byte[]> postHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Map<String,Serializable> headers, String body)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Charset charset)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Charset charset, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Charset charset)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(String url, int timeoutMs, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(HttpClient client, String url, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(HttpClient client, String url, Charset charset, String body, Map<String,Serializable> respHeaders)
-
getHttpContentAsync
public static CompletableFuture<String> getHttpContentAsync(HttpClient client, String url, Charset charset, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, Map<String,Serializable> respHeaders)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> respHeaders)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
getHttpBytesContentAsync
public static CompletableFuture<byte[]> getHttpBytesContentAsync(HttpClient client, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(String method, String url, Map<String,Serializable> headers, String body)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(String method, String url, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(String method, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body)
-
remoteHttpContentAsync
public static CompletableFuture<ByteArrayOutputStream> remoteHttpContentAsync(HttpClient client, String method, String url, int timeoutMs, Map<String,Serializable> headers, String body, Map<String,Serializable> respHeaders)
-
read
public static String read(InputStream in) throws IOException
- 抛出:
IOException
-
readThenClose
public static String readThenClose(InputStream in) throws IOException
- 抛出:
IOException
-
read
public static String read(InputStream in, String charsetName) throws IOException
- 抛出:
IOException
-
read
public static String read(InputStream in, Charset charset) throws IOException
- 抛出:
IOException
-
readStream
public static ByteArrayOutputStream readStream(InputStream in) throws IOException
- 抛出:
IOException
-
readStreamThenClose
public static ByteArrayOutputStream readStreamThenClose(InputStream in) throws IOException
- 抛出:
IOException
-
readBytes
public static byte[] readBytes(File file) throws IOException
- 抛出:
IOException
-
readBytes
public static byte[] readBytes(InputStream in) throws IOException
- 抛出:
IOException
-
readBytesThenClose
public static byte[] readBytesThenClose(InputStream in) throws IOException
- 抛出:
IOException
-
-