gpt4 book ai didi

org.apache.commons.compress.archivers.zip.ZipUtil.signedByteToUnsignedInt()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:50:36 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.commons.compress.archivers.zip.ZipUtil.signedByteToUnsignedInt()方法的一些代码示例,展示了ZipUtil.signedByteToUnsignedInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipUtil.signedByteToUnsignedInt()方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipUtil
类名称:ZipUtil
方法名:signedByteToUnsignedInt

ZipUtil.signedByteToUnsignedInt介绍

[英]Converts a signed byte into an unsigned integer representation (e.g., -1 becomes 255).
[中]将有符号字节转换为无符号整数表示(例如,-1变为255)。

代码示例

代码示例来源:origin: org.apache.commons/commons-compress

/**
 * Populate data from this array as if it was in local file data.
 *
 * @param data   an array of bytes
 * @param offset the start offset
 * @param length the number of bytes in the array from offset
 * @throws java.util.zip.ZipException on error
 */
@Override
public void parseFromLocalFileData(
    final byte[] data, int offset, final int length
) throws ZipException {
  reset();
  this.version = signedByteToUnsignedInt(data[offset++]);
  final int uidSize = signedByteToUnsignedInt(data[offset++]);
  final byte[] uidBytes = new byte[uidSize];
  System.arraycopy(data, offset, uidBytes, 0, uidSize);
  offset += uidSize;
  this.uid = new BigInteger(1, reverse(uidBytes)); // sign-bit forced positive
  final int gidSize = signedByteToUnsignedInt(data[offset++]);
  final byte[] gidBytes = new byte[gidSize];
  System.arraycopy(data, offset, gidBytes, 0, gidSize);
  this.gid = new BigInteger(1, reverse(gidBytes)); // sign-bit forced positive
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * Populate data from this array as if it was in local file data.
 *
 * @param data   an array of bytes
 * @param offset the start offset
 * @param length the number of bytes in the array from offset
 * @throws java.util.zip.ZipException on error
 */
@Override
public void parseFromLocalFileData(
    final byte[] data, int offset, final int length
) throws ZipException {
  reset();
  this.version = signedByteToUnsignedInt(data[offset++]);
  final int uidSize = signedByteToUnsignedInt(data[offset++]);
  final byte[] uidBytes = new byte[uidSize];
  System.arraycopy(data, offset, uidBytes, 0, uidSize);
  offset += uidSize;
  this.uid = new BigInteger(1, reverse(uidBytes)); // sign-bit forced positive
  final int gidSize = signedByteToUnsignedInt(data[offset++]);
  final byte[] gidBytes = new byte[gidSize];
  System.arraycopy(data, offset, gidBytes, 0, gidSize);
  this.gid = new BigInteger(1, reverse(gidBytes)); // sign-bit forced positive
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com