Java读写YAML文件并转为对象

YAML具体语法定义可参考官网:https://yaml.org/ Java实现的相关库有: - JvYaml # Java port of RbYaml - SnakeYAML # Java 5 / YAML 1.1 - YamlBeans # To/from JavaBeans - JYaml # Original Java Implementation - Camel [Read more...]

JAVA将字符串变为输入流

关于字符串转化为输入流,我找到2种方法: 1. 用StringReader将字符串转化为Reader2. 用ByteArrayInputStream将字符串转化为InputStream. 还有一个类StringBufferInputStream也可以将String转化为InputStream,但是由于它只支持字符串中每个字符的低八位,所以已经被遗弃了。 PS: java.io.Reader 和 java.io.InputStream 组成了 Java 输入类。Reader [Read more...]

HTTP长连接

What is HTTP Persistent Connections?HTTP persistent connections, also called HTTP keep-alive, or HTTP connection reuse, is the idea of using the same TCP connection to send and receive multiple HTTP requests/responses, as opposed to opening a new one for [Read more...]

Java中如何“sublist”一个List

在实际开发过程,我经常用到java.util.List这个类里的一个subList方法,但是使用过程中(web开发),却发现这样一个问题:分割list没有达到我的预期,示例代码如下: public static void main(String[] args) { List<Person> listA = new ArrayList<Person>(); for (int i = 0; i < 6; i++) { Person p = new [Read more...]