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

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

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

ZipEightByteInteger.<init>介绍

[英]Create instance from a number.
[中]从一个数字创建一个实例。

代码示例

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

private static ZipEightByteInteger dateToZip(final Date d) {
  if (d == null) { return null; }
  return new ZipEightByteInteger((d.getTime() * 10000L) - EPOCH_OFFSET);
}

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

private void readTimeAttr(final byte[] data, int offset, final int length) {
  if (length >= 2 + 3 * 8) {
    final ZipShort tagValueLength = new ZipShort(data, offset);
    if (TIME_ATTR_SIZE.equals(tagValueLength)) {
      offset += 2;
      modifyTime = new ZipEightByteInteger(data, offset);
      offset += 8;
      accessTime = new ZipEightByteInteger(data, offset);
      offset += 8;
      createTime = new ZipEightByteInteger(data, offset);
    }
  }
}

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

@Override
public void parseFromCentralDirectoryData(final byte[] buffer, int offset,
                     final int length)
  throws ZipException {
  // store for processing in reparseCentralDirectoryData
  rawCentralDirectoryData = new byte[length];
  System.arraycopy(buffer, offset, rawCentralDirectoryData, 0, length);
  // if there is no size information in here, we are screwed and
  // can only hope things will get resolved by LFH data later
  // But there are some cases that can be detected
  // * all data is there
  // * length == 24 -> both sizes and offset
  // * length % 8 == 4 -> at least we can identify the diskStart field
  if (length >= 3 * DWORD + WORD) {
    parseFromLocalFileData(buffer, offset, length);
  } else if (length == 3 * DWORD) {
    size = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    compressedSize = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    relativeHeaderOffset = new ZipEightByteInteger(buffer, offset);
  } else if (length % DWORD == WORD) {
    diskStart = new ZipLong(buffer, offset + length - WORD);
  }
}

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

@Override
public void parseFromLocalFileData(final byte[] buffer, int offset, final int length)
  throws ZipException {
  if (length == 0) {
    // no local file data at all, may happen if an archive
    // only holds a ZIP64 extended information extra field
    // inside the central directory but not inside the local
    // file header
    return;
  }
  if (length < 2 * DWORD) {
    throw new ZipException(LFH_MUST_HAVE_BOTH_SIZES_MSG);
  }
  size = new ZipEightByteInteger(buffer, offset);
  offset += DWORD;
  compressedSize = new ZipEightByteInteger(buffer, offset);
  offset += DWORD;
  int remaining = length - 2 * DWORD;
  if (remaining >= DWORD) {
    relativeHeaderOffset = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    remaining -= DWORD;
  }
  if (remaining >= WORD) {
    diskStart = new ZipLong(buffer, offset);
    offset += WORD; // NOSONAR - assignment as documentation
    remaining -= WORD; // NOSONAR - assignment as documentation
  }
}

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

size = new ZipEightByteInteger(rawCentralDirectoryData, offset);
offset += DWORD;
compressedSize = new ZipEightByteInteger(rawCentralDirectoryData,
                     offset);
offset += DWORD;
  new ZipEightByteInteger(rawCentralDirectoryData, offset);
offset += DWORD;

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

/**
 * If the entry needs Zip64 extra information inside the central
 * directory then configure its data.
 */
private void handleZip64Extra(final ZipArchiveEntry ze, final long lfhOffset,
               final boolean needsZip64Extra) {
  if (needsZip64Extra) {
    final Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
    if (ze.getCompressedSize() >= ZIP64_MAGIC
      || ze.getSize() >= ZIP64_MAGIC
      || zip64Mode == Zip64Mode.Always) {
      z64.setCompressedSize(new ZipEightByteInteger(ze.getCompressedSize()));
      z64.setSize(new ZipEightByteInteger(ze.getSize()));
    } else {
      // reset value that may have been set for LFH
      z64.setCompressedSize(null);
      z64.setSize(null);
    }
    if (lfhOffset >= ZIP64_MAGIC || zip64Mode == Zip64Mode.Always) {
      z64.setRelativeHeaderOffset(new ZipEightByteInteger(lfhOffset));
    }
    ze.setExtra();
  }
}

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

if (phased) {
  size = new ZipEightByteInteger(entry.entry.getSize());
  compressedSize = new ZipEightByteInteger(entry.entry.getCompressedSize());
} else if (entry.entry.getMethod() == STORED
    && entry.entry.getSize() != ArchiveEntry.SIZE_UNKNOWN) {
  compressedSize = size = new ZipEightByteInteger(entry.entry.getSize());
} else {

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

ze.setSize(z64.getSize().getLongValue());
} else if (hasCompressedSize) {
  z64.setSize(new ZipEightByteInteger(ze.getSize()));
  ze.setCompressedSize(z64.getCompressedSize().getLongValue());
} else if (hasUncompressedSize) {
  z64.setCompressedSize(new ZipEightByteInteger(ze.getCompressedSize()));

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

private static ZipEightByteInteger dateToZip(final Date d) {
  if (d == null) { return null; }
  return new ZipEightByteInteger((d.getTime() * 10000L) - EPOCH_OFFSET);
}

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

private void readTimeAttr(final byte[] data, int offset, final int length) {
  if (length >= 2 + 3 * 8) {
    final ZipShort tagValueLength = new ZipShort(data, offset);
    if (TIME_ATTR_SIZE.equals(tagValueLength)) {
      offset += 2;
      modifyTime = new ZipEightByteInteger(data, offset);
      offset += 8;
      accessTime = new ZipEightByteInteger(data, offset);
      offset += 8;
      createTime = new ZipEightByteInteger(data, offset);
    }
  }
}

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

@Override
public void parseFromCentralDirectoryData(final byte[] buffer, int offset,
                     final int length)
  throws ZipException {
  // store for processing in reparseCentralDirectoryData
  rawCentralDirectoryData = new byte[length];
  System.arraycopy(buffer, offset, rawCentralDirectoryData, 0, length);
  // if there is no size information in here, we are screwed and
  // can only hope things will get resolved by LFH data later
  // But there are some cases that can be detected
  // * all data is there
  // * length == 24 -> both sizes and offset
  // * length % 8 == 4 -> at least we can identify the diskStart field
  if (length >= 3 * DWORD + WORD) {
    parseFromLocalFileData(buffer, offset, length);
  } else if (length == 3 * DWORD) {
    size = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    compressedSize = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    relativeHeaderOffset = new ZipEightByteInteger(buffer, offset);
  } else if (length % DWORD == WORD) {
    diskStart = new ZipLong(buffer, offset + length - WORD);
  }
}

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

@Override
public void parseFromLocalFileData(final byte[] buffer, int offset, final int length)
  throws ZipException {
  if (length == 0) {
    // no local file data at all, may happen if an archive
    // only holds a ZIP64 extended information extra field
    // inside the central directory but not inside the local
    // file header
    return;
  }
  if (length < 2 * DWORD) {
    throw new ZipException(LFH_MUST_HAVE_BOTH_SIZES_MSG);
  }
  size = new ZipEightByteInteger(buffer, offset);
  offset += DWORD;
  compressedSize = new ZipEightByteInteger(buffer, offset);
  offset += DWORD;
  int remaining = length - 2 * DWORD;
  if (remaining >= DWORD) {
    relativeHeaderOffset = new ZipEightByteInteger(buffer, offset);
    offset += DWORD;
    remaining -= DWORD;
  }
  if (remaining >= WORD) {
    diskStart = new ZipLong(buffer, offset);
    offset += WORD; // NOSONAR - assignment as documentation
    remaining -= WORD; // NOSONAR - assignment as documentation
  }
}

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

size = new ZipEightByteInteger(rawCentralDirectoryData, offset);
offset += DWORD;
compressedSize = new ZipEightByteInteger(rawCentralDirectoryData,
                     offset);
offset += DWORD;
  new ZipEightByteInteger(rawCentralDirectoryData, offset);
offset += DWORD;

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

/**
 * If the entry needs Zip64 extra information inside the central
 * directory then configure its data.
 */
private void handleZip64Extra(final ZipArchiveEntry ze, final long lfhOffset,
               final boolean needsZip64Extra) {
  if (needsZip64Extra) {
    final Zip64ExtendedInformationExtraField z64 = getZip64Extra(ze);
    if (ze.getCompressedSize() >= ZIP64_MAGIC
      || ze.getSize() >= ZIP64_MAGIC
      || zip64Mode == Zip64Mode.Always) {
      z64.setCompressedSize(new ZipEightByteInteger(ze.getCompressedSize()));
      z64.setSize(new ZipEightByteInteger(ze.getSize()));
    } else {
      // reset value that may have been set for LFH
      z64.setCompressedSize(null);
      z64.setSize(null);
    }
    if (lfhOffset >= ZIP64_MAGIC || zip64Mode == Zip64Mode.Always) {
      z64.setRelativeHeaderOffset(new ZipEightByteInteger(lfhOffset));
    }
    ze.setExtra();
  }
}

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

if (phased) {
  size = new ZipEightByteInteger(entry.entry.getSize());
  compressedSize = new ZipEightByteInteger(entry.entry.getCompressedSize());
} else if (entry.entry.getMethod() == STORED
    && entry.entry.getSize() != ArchiveEntry.SIZE_UNKNOWN) {
  compressedSize = size = new ZipEightByteInteger(entry.entry.getSize());
} else {

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

ze.setSize(z64.getSize().getLongValue());
} else if (hasCompressedSize) {
  z64.setSize(new ZipEightByteInteger(ze.getSize()));
  ze.setCompressedSize(z64.getCompressedSize().getLongValue());
} else if (hasUncompressedSize) {
  z64.setCompressedSize(new ZipEightByteInteger(ze.getCompressedSize()));

相关文章