- 浏览: 999897 次
-
文章分类
- 全部博客 (428)
- Hadoop (2)
- HBase (1)
- ELK (1)
- ActiveMQ (13)
- Kafka (5)
- Redis (14)
- Dubbo (1)
- Memcached (5)
- Netty (56)
- Mina (34)
- NIO (51)
- JUC (53)
- Spring (13)
- Mybatis (17)
- MySQL (21)
- JDBC (12)
- C3P0 (5)
- Tomcat (13)
- SLF4J-log4j (9)
- P6Spy (4)
- Quartz (12)
- Zabbix (7)
- JAVA (9)
- Linux (15)
- HTML (9)
- Lucene (0)
- JS (2)
- WebService (1)
- Maven (4)
- Oracle&MSSQL (14)
- iText (11)
- Development Tools (8)
- UTILS (4)
- LIFE (8)
最新评论
-
Donald_Draper:
Donald_Draper 写道刘落落cici 写道能给我发一 ...
DatagramChannelImpl 解析三(多播) -
Donald_Draper:
刘落落cici 写道能给我发一份这个类的源码吗Datagram ...
DatagramChannelImpl 解析三(多播) -
lyfyouyun:
请问楼主,执行消息发送的时候,报错:Transport sch ...
ActiveMQ连接工厂、连接详解 -
ezlhq:
关于 PollArrayWrapper 状态含义猜测:参考 S ...
WindowsSelectorImpl解析一(FdMap,PollArrayWrapper) -
flyfeifei66:
打算使用xmemcache作为memcache的客户端,由于x ...
Memcached分布式客户端(Xmemcached)
ByteChannel,分散聚集通道接口的定义(SocketChannel):http://donald-draper.iteye.com/blog/2371065
package java.nio.channels; import java.nio.ByteBuffer; import java.io.IOException; /** * A byte channel that maintains a current <i>position</i> and allows the * position to be changed. *SeekableByteChannel维护是一个当前position,运行修改position。 * <p> A seekable byte channel is connected to an entity, typically a file, * that contains a variable-length sequence of bytes that can be read and * written. The current position can be {@link #position() <i>queried</i>} and * {@link #position(long) <i>modified</i>}. The channel also provides access to * the current <i>size</i> of the entity to which the channel is connected. The * size increases when bytes are written beyond its current size; the size * decreases when it is {@link #truncate <i>truncated</i>}. *SeekableByteChannel连接一个实体,典型为一个包含可变长度的字节序列文件,可以读取 和写。可通过#position方法获取当前位置,通过#position(long)修改当前position。通道 提供了访问通道连接实体的当前size。当字节序列被写到实体时,实体size增加;当压缩时, 实体size减少。 * <p> The {@link #position(long) position} and {@link #truncate truncate} methods * which do not otherwise have a value to return are specified to return the * channel upon which they are invoked. This allows method invocations to be * chained. Implementations of this interface should specialize the return type * so that method invocations on the implementation class can be chained. *#position(long)和#truncate方法,在调用时,返回的值是不确定。这些方法可以链式调用。 接口的实现,将该使这些方法返回一个精确的子,以便链式调用。 * @since 1.7 * @see java.nio.file.Files#newByteChannel */ public interface SeekableByteChannel extends ByteChannel { /** * Reads a sequence of bytes from this channel into the given buffer. *从通道读取字节序列,写到buffer中 * <p> Bytes are read starting at this channel's current position, and * then the position is updated with the number of bytes actually read. * Otherwise this method behaves exactly as specified in the {@link * ReadableByteChannel} interface. 从当前通道的postion位置开始读取字节,当实际字节被读取时,则更细positon。其他 的和ReadableByteChannel接口相同 */ @Override int read(ByteBuffer dst) throws IOException; /** * Writes a sequence of bytes to this channel from the given buffer. *从给定的buffer,读取字节序列写到通道中 * <p> Bytes are written starting at this channel's current position, unless * the channel is connected to an entity such as a file that is opened with * the {@link java.nio.file.StandardOpenOption#APPEND APPEND} option, in * which case the position is first advanced to the end. The entity to which * the channel is connected is grown, if necessary, to accommodate the * written bytes, and then the position is updated with the number of bytes * actually written. Otherwise this method behaves exactly as specified by * the {@link WritableByteChannel} interface. 从通道当前的位置写字节序列,除非通道连接一个实体,比如以StandardOpenOption#APPEND 配置选项打开的文件,在这种情况下,position首先定位到文件的尾部。通道连接的实际将会 增加,如果需要,计算写的字节数,更新position。其他方法与WritableByteChannel相同。 */ @Override int write(ByteBuffer src) throws IOException; /** * Returns this channel's position. *返回当前通道的位置 * @return This channel's position, * a non-negative integer counting the number of bytes * from the beginning of the entity to the current position * * @throws ClosedChannelException * If this channel is closed * @throws IOException * If some other I/O error occurs */ long position() throws IOException; /** * Sets this channel's position. *设置通道的位置 * <p> Setting the position to a value that is greater than the current size * is legal but does not change the size of the entity. A later attempt to * read bytes at such a position will immediately return an end-of-file * indication. A later attempt to write bytes at such a position will cause * the entity to grow to accommodate the new bytes; the values of any bytes * between the previous end-of-file and the newly-written bytes are * unspecified. *如果设置position大于当前实体size,是合法的,不会改变实体的size。尝试从设置后的 position位置读取字节,position将会立即定位到文件的末端。此时尝试写字节序列, 将会引起实体的增加。 * <p> Setting the channel's position is not recommended when connected to * an entity, typically a file, that is opened with the {@link * java.nio.file.StandardOpenOption#APPEND APPEND} option. When opened for * append, the position is first advanced to the end before writing. *当通道连接一个实体时,不建议设置通道的position,特别是一个以StandardOpenOption#APPEND 配置选项打开的文件,在这种情况下,在写之前,首先定位position的位置到文件的末尾。 * @param newPosition * The new position, a non-negative integer counting * the number of bytes from the beginning of the entity * * @return This channel * * @throws ClosedChannelException * If this channel is closed * @throws IllegalArgumentException * If the new position is negative * @throws IOException * If some other I/O error occurs */ SeekableByteChannel position(long newPosition) throws IOException; /** * Returns the current size of entity to which this channel is connected. *返回通道连接实体的size * @return The current size, measured in bytes * * @throws ClosedChannelException * If this channel is closed * @throws IOException * If some other I/O error occurs */ long size() throws IOException; /** * Truncates the entity, to which this channel is connected, to the given * size. *压缩通道连接的实体到指定的size * <p> If the given size is less than the current size then the entity is * truncated, discarding any bytes beyond the new end. If the given size is * greater than or equal to the current size then the entity is not modified. * In either case, if the current position is greater than the given size * then it is set to that size. *如果给定的size小于实体当前的size,将会压缩实体,丢弃超过新末端的字节。如果 给定的size大于或等于当前size,实际将不会修改。在其他一些情况下,如果当前的position 大于给定的size,那么将会设置position。 * <p> An implementation of this interface may prohibit truncation when * connected to an entity, typically a file, opened with the {@link * java.nio.file.StandardOpenOption#APPEND APPEND} option. *当连接一个实体时,具体接口的实现也许会禁止压缩实体,比如以StandardOpenOption#APPEND 配置选项打开的文件。 * @param size * The new size, a non-negative byte count * * @return This channel * * @throws NonWritableChannelException * If this channel was not opened for writing * @throws ClosedChannelException * If this channel is closed * @throws IllegalArgumentException * If the new size is negative * @throws IOException * If some other I/O error occurs */ SeekableByteChannel truncate(long size) throws IOException; }
发表评论
-
文件通道解析二(文件锁,关闭通道)
2017-05-16 23:17 1108文件通道解析一(读写操作,通道数据传输等):http://do ... -
文件通道解析一(读写操作,通道数据传输等)
2017-05-16 10:04 1205Reference定义(PhantomRefere ... -
文件通道创建方式综述
2017-05-15 17:39 1109Reference定义(PhantomReference,Cl ... -
文件读写方式简单综述后续(文件,流构造)
2017-05-14 23:04 1525Java Socket通信实例:http://donald-d ... -
文件读写方式简单综述
2017-05-14 11:13 1169Java Socket通信实例:http://donald-d ... -
FileChanne定义
2017-05-12 23:28 991文件读写方式简单综述:http://donald-draper ... -
FileChannel示例
2017-05-11 08:37 1027前面我们看过socket通道,datagram通道,以管道Pi ... -
PipeImpl解析
2017-05-11 08:41 974ServerSocketChannel定义:http://do ... -
Pipe定义
2017-05-10 09:07 958Channel接口定义:http://donald-drape ... -
NIO-Pipe示例
2017-05-10 08:47 951PipeImpl解析:http://donald-draper ... -
DatagramChannelImpl 解析四(地址绑定,关闭通道等)
2017-05-10 08:27 832DatagramChannelImpl 解析一(初始化):ht ... -
DatagramChannelImpl 解析三(多播)
2017-05-10 08:20 2002DatagramChannelImpl 解析一(初始化):ht ... -
NIO-UDP实例
2017-05-09 12:32 1628DatagramChannelImpl 解析一(初始化):ht ... -
DatagramChannelImpl 解析二(报文发送与接收)
2017-05-09 09:03 1453DatagramChannelImpl 解析一(初始化):ht ... -
DatagramChannelImpl 解析一(初始化)
2017-05-08 21:52 1471Channel接口定义:http://donald-drape ... -
MembershipKeyImpl 简介
2017-05-08 09:11 965MembershipKey定义:http://donald-d ... -
DatagramChannel定义
2017-05-07 23:13 1266Channel接口定义:http://donald-drape ... -
MulticastChanne接口定义
2017-05-07 13:45 1194NetworkChannel接口定义:ht ... -
MembershipKey定义
2017-05-06 16:20 966package java.nio.channels; i ... -
SocketChannelImpl 解析四(关闭通道等)
2017-05-05 08:38 2597SocketChannelImpl 解析一(通道连接,发送数据 ...
相关推荐
- **`SeekableByteChannel`**:新增的字节通道接口,支持随机读写操作。 - **`NetworkChannel`**:新的网络通道接口,提供了绑定通道套接字和设置套接字选项的能力。 - **`MulticastChannel`**:多播通道接口,支持 ...
在软件开发过程中,代码生成器是一种自动化工具,它可以自动生成特定类型的代码,如模板、接口实现、数据库访问层代码等,从而提高开发效率,减少人为错误。Java中,我们可以使用模板引擎(如FreeMarker或Thymeleaf...
内容概要:本文详细介绍了基于TMS320F系列芯片的C2000串口读写方案及其编程器——FlashPro2000的功能特点和支持的接口模式。文中不仅涵盖了硬件连接的具体步骤,还提供了代码实例来展示Flash擦除操作,并对比了JTAG和SCI-BOOT两种模式的优缺点。此外,针对不同型号的C2000系列芯片,给出了详细的适配指导以及避免烧录过程中可能出现的问题的方法。 适合人群:从事DSP开发的技术人员,尤其是对TI公司C2000系列芯片有一定了解并希望深入了解其编程和烧录细节的人群。 使用场景及目标:适用于实验室环境下的程序调试阶段,以及生产线上的批量烧录任务。主要目的是帮助开发者选择合适的编程工具和技术手段,提高工作效率,减少因误操作导致设备损坏的风险。 其他说明:文中提供的代码片段和命令行指令可以直接用于实际项目中,同时附带了一些实用技巧,如防止芯片变砖的小贴士和自动化重试脚本,有助于解决常见的烧录难题。
汉字字库存储芯片扩展实验 # 汉字字库存储芯片扩展实验 ## 实验目的 1. 了解汉字字库的存储原理和结构 2. 掌握存储芯片扩展技术 3. 学习如何通过硬件扩展实现大容量汉字字库存储 ## 实验原理 ### 汉字字库存储基础 - 汉字通常采用点阵方式存储(如16×16、24×24、32×32点阵) - 每个汉字需要占用32字节(16×16)到128字节(32×32)不等的存储空间 - 国标GB2312-80包含6763个汉字,需要较大存储容量 ### 存储芯片扩展方法 1. **位扩展**:增加数据总线宽度 2. **字扩展**:增加存储单元数量 3. **混合扩展**:同时进行位扩展和字扩展 ## 实验设备 - 单片机开发板(如STC89C52) - 存储芯片(如27C256、29C040等) - 逻辑门电路芯片(如74HC138、74HC373等) - 示波器、万用表等测试设备 - 连接线若干 ## 实验步骤 ### 1. 单芯片汉字存储实验 1. 连接27C256 EPROM芯片到单片机系统 2. 将16×16点阵汉字字库写入芯片 3. 编写程序读取并显示汉字 ### 2. 存储芯片字扩展实验 1. 使用地址译码器(如74HC138)扩展多片27C256 2. 将完整GB2312字库分布到各芯片中 3. 编写程序实现跨芯片汉字读取 ### 3. 存储芯片位扩展实验 1. 连接两片27C256实现16位数据总线扩展 2. 优化字库存储结构,提高读取速度 3. 测试并比较扩展前后的性能差异 ## 实验代码示例(单片机部分) ```c #include <reg52.h> #include <intrins.h> // 定义存储芯片控制引脚 sbit CE = P2^7; // 片选 sbit OE = P2^6; // 输出使能 sbit
测控装备干扰源快速侦测系统设计研究.pdf
嵌入式八股文面试题库资料知识宝典-【开发】嵌入式开源项目&库&资料.zip
嵌入式八股文面试题库资料知识宝典-百度2022年嵌入式面试题.zip
少儿编程scratch项目源代码文件案例素材-空间站.zip
基于关联规则的商业银行个性化产品推荐.pdf
嵌入式八股文面试题库资料知识宝典-Linux基础使用.zip
内容概要:本文详细介绍了利用MATLAB进行轴棱锥生成贝塞尔高斯光束及环形光束光强图像的仿真研究。首先阐述了实验的背景与目标,强调了MATLAB在光学和计算科学领域的广泛应用。接着,具体描述了实验的方法与步骤,包括材料准备、仿真过程中的参数设定和光束生成代码编写。最后,对实验结果进行了深入分析,展示了贝塞尔高斯光束和环形光束的光强分布特点,验证了其光学性能的预期表现。文章还对未来的研究方向和技术改进提出了展望。 适合人群:从事光学、物理学及相关领域研究的专业人士,特别是对光束生成和光学性能分析感兴趣的科研工作者。 使用场景及目标:适用于需要进行光束生成和性能分析的实验室环境,旨在帮助研究人员更好地理解和优化光束特性和传播行为。 其他说明:本文不仅提供了详细的实验方法和步骤,还附有丰富的实验结果和数据分析,为后续研究提供了宝贵的参考资料。
内容概要:本文探讨了三电平NPC型有源电力滤波器(APF)的模型预测控制(MPC)中存在的开关频率过高问题及其解决方案。传统MPC方法会导致极高的开关频率,增加了系统的能耗和热量。通过引入滞环控制模块,可以在不大幅牺牲性能的情况下有效降低开关频率。具体来说,滞环控制通过在价值函数计算后增加一个判断条件,对状态切换进行惩罚,从而减少不必要的开关动作。实验结果显示,开关频率从4392Hz降至3242Hz,降幅达26.2%,虽然电流总谐波畸变率(THD)略有上升,但仍符合国家标准。此外,文中还提出了动态调整滞环宽度的方法,以进一步优化不同负载条件下的表现。 适合人群:从事电力电子、电力系统控制领域的研究人员和技术人员,特别是关注APF和MPC技术的人群。 使用场景及目标:适用于需要优化APF系统开关频率的研究和工程项目,旨在提高系统效率并降低成本。目标是在不影响系统性能的前提下,显著降低开关频率,减少能量损失和热管理难度。 其他说明:文章不仅提供了理论分析,还包括具体的实现代码片段,有助于读者理解和实践。同时,强调了在实际应用中需要注意的问题,如中点电位漂移等。
内容概要:本文介绍了三维POD DMD程序在处理原网格数据方面的独特优势和技术细节。首先阐述了该程序能读取结构化和非结构化网格数据及其拓扑关系,在生成模态数据过程中保持原始网格形态而不需要进行网格插值操作。接着展示了简化版本的Python代码片段,揭示了读取网格数据和生成模态数据的核心逻辑。最后提到提供的辅助学习资料如代码、视频教程、Word教程和实例数据,帮助用户深入理解并掌握该程序的应用。 适合人群:从事计算流体力学领域的研究人员和技术爱好者,尤其是那些希望提高数据处理效率的人群。 使用场景及目标:适用于需要处理复杂网格数据的研究项目,旨在简化数据处理流程,提升工作效率,同时保持数据的原始特性。 其他说明:文中不仅提供了理论性的讲解,还有具体的代码示例和丰富的学习资源,使读者可以边学边练,快速上手。
融合双向路由注意力的多尺度X光违禁品检测.pdf
嵌入式八股文面试题库资料知识宝典-Linux_Shell基础使用.zip
嵌入式八股文面试题库资料知识宝典-联发科2021武汉嵌入式软件开发.zip
基于有限体积法Godunov格式的管道泄漏检测模型研究.pdf
嵌入式八股文面试题库资料知识宝典-ARM常见面试题目.zip
基于LWR问题的无证书全同态加密方案.pdf
嵌入式八股文面试题库资料知识宝典-符坤面试经验.zip