我们知道ByteBuf通过读写两个索引分离,避免了NIO中ByteBuffer中读写模式切换时,需要flip等繁琐的操作. 今天就通过一段测试代码以及图例来直观的了解下ByteBuf中的readIndex, writeIndex以及capacity的概念. 先贴出测试代码: public class ByteBuffTest { public static void main(String[] args){ /*******************初始阶段********************
下面1-4的内容是网上收集的相关知识,总结来说,就是如下几个知识点: 最常用读取properties文件的方法 InputStream in = getClass().getResourceAsStream("资源Name");这种方式要求properties文件和当前类在同一文件夹下面.如果在不同的包中,必须使用: InputStream ins = this.getClass().getResourceAsStream("/cn/zhao/properties/testP