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

x33g5p2x  于2022-02-05 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(102)

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

ZipUtil.reverse介绍

[英]Reverses a byte[] array. Reverses in-place (thus provided array is mutated), but also returns same for convenience.
[中]反转字节[]数组。反转到位(因此提供的数组是变异的),但为了方便起见也返回相同的值。

代码示例

代码示例来源: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: org.apache.commons/commons-compress

reverse(uidBytes);
reverse(gidBytes);

代码示例来源: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
}

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

reverse(uidBytes);
reverse(gidBytes);

相关文章