zoukankan      html  css  js  c++  java
  • buf.readIntBE()

    buf.readIntBE(offset, byteLength[, noAssert])
    buf.readIntLE(offset, byteLength[, noAssert])

    • offset {Number} 0 <= offset <= buf.length - byteLength
    • byteLength {Number} 0 < byteLength <= 6
    • noAssert {Boolean} 默认:false
    • 返回:{Number}

    从该 Buffer 指定的 offset 位置开始读取 byteLength 字节数,并将结果解释执行为一个有符号的2的补码值。支持多达48位精度的值。例如:

    const buf = Buffer.allocUnsafe(6);
    buf.writeUInt16LE(0x90ab, 0);
    buf.writeUInt32LE(0x12345678, 2);
    buf.readIntLE(0, 6).toString(16); // Specify 6 bytes (48 bits)
    // Returns: '1234567890ab'
    
    buf.readIntBE(0, 6).toString(16);
    // Returns: -546f87a9cbee
    

    设置 noAssert 为 true ,将跳过对 offset 的验证。这将允许 offset 超出缓冲区的末尾。

  • 相关阅读:
    dubbo
    maven
    vue
    SSM框架整合
    MyBatis数据表注解开发
    MyBatis多表操作xml方式
    MyBatis映射配置文件
    Mybatis核心配置文件,传统开发和代理开发(主流)
    SpringMVC高级
    SpringMVC基础
  • 原文地址:https://www.cnblogs.com/lalalagq/p/9908633.html
Copyright © 2011-2022 走看看