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

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

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

ZipEightByteInteger.getBytes介绍

[英]Get value as eight bytes in big endian byte order.
[中]以大端字节顺序获取八个字节的值。

代码示例

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

/**
 * Get value as eight bytes in big endian byte order.
 * @return value as eight bytes in big endian order
 */
public byte[] getBytes() {
  return ZipEightByteInteger.getBytes(value);
}

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

/**
 * Get value as eight bytes in big endian byte order.
 * @param value the value to convert
 * @return value as eight bytes in big endian byte order
 */
public static byte[] getBytes(final long value) {
  return getBytes(BigInteger.valueOf(value));
}

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

private int addSizes(final byte[] data) {
    int off = 0;
    if (size != null) {
      System.arraycopy(size.getBytes(), 0, data, 0, DWORD);
      off += DWORD;
    }
    if (compressedSize != null) {
      System.arraycopy(compressedSize.getBytes(), 0, data, off, DWORD);
      off += DWORD;
    }
    return off;
  }
}

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

/**
 * The actual data to put into local file data - without Header-ID
 * or length specifier.
 *
 * @return get the data
 */
@Override
public byte[] getLocalFileDataData() {
  final byte[] data = new byte[getLocalFileDataLength().getValue()];
  int pos = 4;
  System.arraycopy(TIME_ATTR_TAG.getBytes(), 0, data, pos, 2);
  pos += 2;
  System.arraycopy(TIME_ATTR_SIZE.getBytes(), 0, data, pos, 2);
  pos += 2;
  System.arraycopy(modifyTime.getBytes(), 0, data, pos, 8);
  pos += 8;
  System.arraycopy(accessTime.getBytes(), 0, data, pos, 8);
  pos += 8;
  System.arraycopy(createTime.getBytes(), 0, data, pos, 8);
  return data;
}

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

@Override
public byte[] getCentralDirectoryData() {
  final byte[] data = new byte[getCentralDirectoryLength().getValue()];
  int off = addSizes(data);
  if (relativeHeaderOffset != null) {
    System.arraycopy(relativeHeaderOffset.getBytes(), 0, data, off, DWORD);
    off += DWORD;
  }
  if (diskStart != null) {
    System.arraycopy(diskStart.getBytes(), 0, data, off, WORD);
    off += WORD; // NOSONAR - assignment as documentation
  }
  return data;
}

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

.getBytes(SHORT   /* version made by */
final byte[] num = ZipEightByteInteger.getBytes(entries.size());
writeOut(num);
writeOut(num);
writeOut(ZipEightByteInteger.getBytes(cdLength));
writeOut(ZipEightByteInteger.getBytes(cdOffset));
writeOut(ZipEightByteInteger.getBytes(offset));

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

/**
 * Writes the data descriptor entry.
 * @param ze the entry to write
 * @throws IOException on error
 */
protected void writeDataDescriptor(final ZipArchiveEntry ze) throws IOException {
  if (!usesDataDescriptor(ze.getMethod(), false)) {
    return;
  }
  writeCounted(DD_SIG);
  writeCounted(ZipLong.getBytes(ze.getCrc()));
  if (!hasZip64Extra(ze)) {
    writeCounted(ZipLong.getBytes(ze.getCompressedSize()));
    writeCounted(ZipLong.getBytes(ze.getSize()));
  } else {
    writeCounted(ZipEightByteInteger.getBytes(ze.getCompressedSize()));
    writeCounted(ZipEightByteInteger.getBytes(ze.getSize()));
  }
}

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

writeOut(ZipEightByteInteger.getBytes(entry.entry.getSize()));
writeOut(ZipEightByteInteger.getBytes(entry.entry.getCompressedSize()));

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

/**
 * Get value as eight bytes in big endian byte order.
 * @return value as eight bytes in big endian order
 */
public byte[] getBytes() {
  return ZipEightByteInteger.getBytes(value);
}

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

/**
 * Get value as eight bytes in big endian byte order.
 * @param value the value to convert
 * @return value as eight bytes in big endian byte order
 */
public static byte[] getBytes(final long value) {
  return getBytes(BigInteger.valueOf(value));
}

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

private int addSizes(final byte[] data) {
    int off = 0;
    if (size != null) {
      System.arraycopy(size.getBytes(), 0, data, 0, DWORD);
      off += DWORD;
    }
    if (compressedSize != null) {
      System.arraycopy(compressedSize.getBytes(), 0, data, off, DWORD);
      off += DWORD;
    }
    return off;
  }
}

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

/**
 * The actual data to put into local file data - without Header-ID
 * or length specifier.
 *
 * @return get the data
 */
@Override
public byte[] getLocalFileDataData() {
  final byte[] data = new byte[getLocalFileDataLength().getValue()];
  int pos = 4;
  System.arraycopy(TIME_ATTR_TAG.getBytes(), 0, data, pos, 2);
  pos += 2;
  System.arraycopy(TIME_ATTR_SIZE.getBytes(), 0, data, pos, 2);
  pos += 2;
  System.arraycopy(modifyTime.getBytes(), 0, data, pos, 8);
  pos += 8;
  System.arraycopy(accessTime.getBytes(), 0, data, pos, 8);
  pos += 8;
  System.arraycopy(createTime.getBytes(), 0, data, pos, 8);
  return data;
}

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

@Override
public byte[] getCentralDirectoryData() {
  final byte[] data = new byte[getCentralDirectoryLength().getValue()];
  int off = addSizes(data);
  if (relativeHeaderOffset != null) {
    System.arraycopy(relativeHeaderOffset.getBytes(), 0, data, off, DWORD);
    off += DWORD;
  }
  if (diskStart != null) {
    System.arraycopy(diskStart.getBytes(), 0, data, off, WORD);
    off += WORD; // NOSONAR - assignment as documentation
  }
  return data;
}

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

.getBytes(SHORT   /* version made by */
final byte[] num = ZipEightByteInteger.getBytes(entries.size());
writeOut(num);
writeOut(num);
writeOut(ZipEightByteInteger.getBytes(cdLength));
writeOut(ZipEightByteInteger.getBytes(cdOffset));
writeOut(ZipEightByteInteger.getBytes(offset));

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

/**
 * Writes the data descriptor entry.
 * @param ze the entry to write
 * @throws IOException on error
 */
protected void writeDataDescriptor(final ZipArchiveEntry ze) throws IOException {
  if (!usesDataDescriptor(ze.getMethod(), false)) {
    return;
  }
  writeCounted(DD_SIG);
  writeCounted(ZipLong.getBytes(ze.getCrc()));
  if (!hasZip64Extra(ze)) {
    writeCounted(ZipLong.getBytes(ze.getCompressedSize()));
    writeCounted(ZipLong.getBytes(ze.getSize()));
  } else {
    writeCounted(ZipEightByteInteger.getBytes(ze.getCompressedSize()));
    writeCounted(ZipEightByteInteger.getBytes(ze.getSize()));
  }
}

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

writeOut(ZipEightByteInteger.getBytes(entry.entry.getSize()));
writeOut(ZipEightByteInteger.getBytes(entry.entry.getCompressedSize()));

相关文章