LockSupport简介
1月 11, 2023 |
Nix.Huang
LockSupport简介 java并发包中很多类都基于LockSupport实现锁,而Thread.susp […more]
LockSupport简介 java并发包中很多类都基于LockSupport实现锁,而Thread.susp […more]
java代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost post = new HttpPost(url); MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setBoundary("123456789"); builder.setCharset(java.nio.charset.Charset.forName("UTF-8")); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); // 文件流 builder.addBinaryBody("file", getInputStream(), ContentType.DEFAULT_BINARY, "xyz.txt"); builder.addPart("type", new StringBody("0", ContentType.TEXT_PLAIN)); //Finally post.setEntity(builder.build()); CloseableHttpResponse response = httpClient.execute(post); response.getEntity().writeTo(System.out); |
生成的报文 POST /ebo […more]
em相对于父级元素的排版大小,(typography,指定了font-size就以父元素的font-size为 […more]
使用axios发送Ajax理由 使用XMLHttpRequest 发送Ajax请求已经很简单,为啥很多工程使用 […more]
code=1009, reason=The decoded text message was too big […more]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
public static <T, U> BiConsumer<T, U> getSetter(Class<T> clazz, String fieldName, Class<U> fieldType) throws Throwable { MethodHandles.Lookup caller = MethodHandles.lookup(); MethodType setter = MethodType.methodType(void.class, fieldType); MethodHandle target = caller.findVirtual(clazz, computeSetterName(fieldName), setter); CallSite site = LambdaMetafactory.metafactory( caller, "accept", //interfaceMethodName MethodType.methodType(BiConsumer.class), //factoryType //interfaceMethodType,泛型一律使用Object.class MethodType.methodType(void.class, Object.class, Object.class), target, //implementation target.type() //dynamicMethodType, 泛型对应的具体类型 ); MethodHandle factory = site.getTarget(); return (BiConsumer<T, U>) factory.invokeExact(); } public static String computeSetterName(String fieldName) { return "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); } |
当获取的函数对象是泛型时,那么interfa […more]
CompletableFuture 介绍 自带线程池,拿来即用 可以手动完成 多个Future协同 常规使用 […more]
如果一个field 叫xAxis 那么最后序列化的结果是{“xaxis”:””} 而不是{“xAxis”:”” […more]
开始仿照官方离职按需导入echarts的各个组件, 结果我配置了折线图的markLine 属性, 没有导入Ma […more]