gpt4 book ai didi

net.lingala.zip4j.model.ZipParameters.isEncryptFiles()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 16:40:40 29 4
gpt4 key购买 nike

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

ZipParameters.isEncryptFiles介绍

暂无

代码示例

代码示例来源:origin: net.lingala.zip4j/zip4j

public void write(byte[] b, int off, int len) throws IOException {
  if (len == 0) return;
  
  if (zipParameters.isEncryptFiles() && 
      zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
    if (pendingBufferLength != 0) {
      if (len >= (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength)) {
        System.arraycopy(b, off, pendingBuffer, pendingBufferLength,
                (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength));
        encryptAndWrite(pendingBuffer, 0, pendingBuffer.length);
        off = (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength);
        len = len - off;
        pendingBufferLength = 0;
      } else {
        System.arraycopy(b, off, pendingBuffer, pendingBufferLength,
            len);
        pendingBufferLength += len;
        return;
      }
    }
    if (len != 0 && len % 16 != 0) {
      System.arraycopy(b, (len + off) - (len % 16), pendingBuffer, 0, len % 16);
      pendingBufferLength = len % 16;
      len = len - pendingBufferLength; 
    }
  }
  if (len != 0)
    encryptAndWrite(b, off, len);
}

代码示例来源:origin: com.github.axet/zip4j

public void write(byte[] b, int off, int len) throws IOException {
  if (len == 0) return;
  
  if (zipParameters.isEncryptFiles() && 
      zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
    if (pendingBufferLength != 0) {
      if (len >= (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength)) {
        System.arraycopy(b, off, pendingBuffer, pendingBufferLength,
                (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength));
        encryptAndWrite(pendingBuffer, 0, pendingBuffer.length);
        off = (InternalZipConstants.AES_BLOCK_SIZE - pendingBufferLength);
        len = len - off;
        pendingBufferLength = 0;
      } else {
        System.arraycopy(b, off, pendingBuffer, pendingBufferLength,
            len);
        pendingBufferLength += len;
        return;
      }
    }
    if (len != 0 && len % 16 != 0) {
      System.arraycopy(b, (len + off) - (len % 16), pendingBuffer, 0, len % 16);
      pendingBufferLength = len % 16;
      len = len - pendingBufferLength; 
    }
  }
  if (len != 0)
    encryptAndWrite(b, off, len);
}

代码示例来源:origin: net.lingala.zip4j/zip4j

if(fileList.get(i) instanceof File) {
  if (((File)fileList.get(i)).exists()) {
    if (parameters.isEncryptFiles() && 
        parameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
      totalWork += (Zip4jUtil.getFileLengh((File)fileList.get(i)) * 2);

代码示例来源:origin: com.github.axet/zip4j

if(fileList.get(i) instanceof File) {
  if (((File)fileList.get(i)).exists()) {
    if (parameters.isEncryptFiles() && 
        parameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
      totalWork += (Zip4jUtil.getFileLengh((File)fileList.get(i)) * 2);

代码示例来源:origin: net.lingala.zip4j/zip4j

if (this.zipParameters.isEncryptFiles() && 
    this.zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  if (encrypter instanceof AESEncrpyter) {
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  fileHeader.setCrc32(0);

代码示例来源:origin: net.lingala.zip4j/zip4j

private void initEncrypter() throws ZipException {
  if (!zipParameters.isEncryptFiles()) {
    encrypter = null;
    return;
  }
  
  switch (zipParameters.getEncryptionMethod()) {
  case Zip4jConstants.ENC_METHOD_STANDARD:
    // Since we do not know the crc here, we use the modification time for encrypting.
    encrypter = new StandardEncrypter(zipParameters.getPassword(), (localFileHeader.getLastModFileTime() & 0x0000ffff) << 16);
    break;
  case Zip4jConstants.ENC_METHOD_AES:
    encrypter = new AESEncrpyter(zipParameters.getPassword(), zipParameters.getAesKeyStrength());
    break;
  default:
    throw new ZipException("invalid encprytion method");
  }
}

代码示例来源:origin: com.github.axet/zip4j

private void initEncrypter() throws ZipException {
  if (!zipParameters.isEncryptFiles()) {
    encrypter = null;
    return;
  }
  
  switch (zipParameters.getEncryptionMethod()) {
  case Zip4jConstants.ENC_METHOD_STANDARD:
    // Since we do not know the crc here, we use the modification time for encrypting.
    encrypter = new StandardEncrypter(zipParameters.getPassword(), (localFileHeader.getLastModFileTime() & 0x0000ffff) << 16);
    break;
  case Zip4jConstants.ENC_METHOD_AES:
    encrypter = new AESEncrpyter(zipParameters.getPassword(), zipParameters.getAesKeyStrength());
    break;
  default:
    throw new ZipException("invalid encprytion method");
  }
}

代码示例来源:origin: com.github.axet/zip4j

if (this.zipParameters.isEncryptFiles() && 
    this.zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  if (encrypter instanceof AESEncrpyter) {
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  fileHeader.setCrc32(0);

代码示例来源:origin: net.lingala.zip4j/zip4j

if (fileParameters.isEncryptFiles() && fileParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
  progressMonitor.setCurrentOperation(ProgressMonitor.OPERATION_CALC_CRC);
  fileParameters.setSourceFileCRC((int)CRCUtil.computeFileCRC(((File)fileList.get(i)).getAbsolutePath(), progressMonitor));

代码示例来源:origin: com.github.axet/zip4j

if (fileParameters.isEncryptFiles() && fileParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
  progressMonitor.setCurrentOperation(ProgressMonitor.OPERATION_CALC_CRC);
  fileParameters.setSourceFileCRC((int)CRCUtil.computeFileCRC((NativeStorage)fileList.get(i), progressMonitor));

代码示例来源:origin: net.lingala.zip4j/zip4j

totalBytesWritten += headerWriter.writeLocalFileHeader(zipModel, localFileHeader, outputStream);
if (this.zipParameters.isEncryptFiles()) {
  initEncrypter();
  if (encrypter != null) {

代码示例来源:origin: com.github.axet/zip4j

if (parameters.isEncryptFiles()) {
  if (parameters.getEncryptionMethod() != Zip4jConstants.ENC_METHOD_STANDARD && 
      parameters.getEncryptionMethod() != Zip4jConstants.ENC_METHOD_AES) {

代码示例来源:origin: net.lingala.zip4j/zip4j

if (parameters.isEncryptFiles()) {
  if (parameters.getEncryptionMethod() != Zip4jConstants.ENC_METHOD_STANDARD && 
      parameters.getEncryptionMethod() != Zip4jConstants.ENC_METHOD_AES) {

代码示例来源:origin: net.lingala.zip4j/zip4j

fileHeader.setVersionMadeBy(20);
fileHeader.setVersionNeededToExtract(20);
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  fileHeader.setCompressionMethod(Zip4jConstants.ENC_METHOD_AES);
  fileHeader.setCompressionMethod(zipParameters.getCompressionMethod());
if (zipParameters.isEncryptFiles()) {
  fileHeader.setEncrypted(true);
  fileHeader.setEncryptionMethod(zipParameters.getEncryptionMethod());
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
  fileHeader.setCrc32(zipParameters.getSourceFileCRC());

代码示例来源:origin: com.github.axet/zip4j

fileHeader.setVersionMadeBy(20);
fileHeader.setVersionNeededToExtract(20);
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_AES) {
  fileHeader.setCompressionMethod(Zip4jConstants.ENC_METHOD_AES);
  fileHeader.setCompressionMethod(zipParameters.getCompressionMethod());
if (zipParameters.isEncryptFiles()) {
  fileHeader.setEncrypted(true);
  fileHeader.setEncryptionMethod(zipParameters.getEncryptionMethod());
if (zipParameters.isEncryptFiles() && 
    zipParameters.getEncryptionMethod() == Zip4jConstants.ENC_METHOD_STANDARD) {
  fileHeader.setCrc32(zipParameters.getSourceFileCRC());

代码示例来源:origin: com.github.axet/zip4j

totalBytesWritten += headerWriter.writeLocalFileHeader(zipModel, localFileHeader, outputStream);
if (this.zipParameters.isEncryptFiles()) {
  initEncrypter();
  if (encrypter != null) {

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