2.4 Scattering Reads

简介: 2.4 Scattering Reads

分散读取,有一个文本文件 3parts.txt

onetwothree

使用如下方式读取,可以将数据填充至多个 buffer

try (RandomAccessFile file = new RandomAccessFile("helloword/3parts.txt", "rw")) { FileChannel channel = file.getChannel(); ByteBuffer a = ByteBuffer.allocate(3); ByteBuffer b = ByteBuffer.allocate(3); ByteBuffer c = ByteBuffer.allocate(5); channel.read(new ByteBuffer[]{a, b, c}); a.flip(); b.flip(); c.flip(); debug(a); debug(b); debug(c); } catch (IOException e) { e.printStackTrace(); }


目录
相关文章
|
6月前
PGA memory operation
PGA memory operation
72 1
2.5 Gathering Writes
2.5 Gathering Writes
66 0
|
存储 缓存 分布式计算
译|Eventually Consistent
译|Eventually Consistent
55 0
|
关系型数据库 MySQL
Consistent Nonlocking Reads,Locking Reads 和Phantom Rows
以Consistent Nonlocking Reads,Locking Reads为突破点,用简单的例子来说明mysql常用的事务隔离级别(READ COMMITTED, REPEATABLE READ)和lock(record lock,gap lock,next-key lock, Insert Intention Lock)的关系
Consistent Nonlocking Reads,Locking Reads 和Phantom Rows
|
SQL 关系型数据库 Oracle
|
SQL 关系型数据库 索引
ORA-19566 exceeded limit of 0 corrupt blocks数据坏块处理
    问题描述 RMAN备份失败,报错如下:   channel ch1: starting piece 1 at 02-NOV-12 released channel: ch1 RMAN-00571: R...
2033 0
|
SQL 索引
解决Logical Reads高的方法和实验
之前介绍了CBC,就是cache buffer chains这个等待事件的影响,《缓解latch: cache buffers chains的案例》,解决逻辑读过高的SQL语句,是优化方向。
1292 0
is not eligible for getting processed by all BeanPostProcessors
BeanPostProcessor是控制Bean初始化开始和初始化结束的接口。换句话说实现BeanPostProcessor的bean会在其他bean初始化之前完成,BeanPostProcessor会通过接口方法检查其他类型的Bean并做处理。
8774 0