net.lingala.zip4j.util.Zip4jUtil.getEncodedStringLength()方法的使用及代码示例

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

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

Zip4jUtil.getEncodedStringLength介绍

[英]returns the length of the string by wrapping it in a byte buffer with the appropriate charset of the input string and returns the limit of the byte buffer
[中]通过使用输入字符串的适当字符集将字符串包装在字节缓冲区中,返回字符串的长度,并返回字节缓冲区的限制

代码示例

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

/**
 * returns the length of the string by wrapping it in a byte buffer with
 * the appropriate charset of the input string and returns the limit of the 
 * byte buffer
 * @param str
 * @return length of the string
 * @throws ZipException
 */
public static int getEncodedStringLength(String str) throws ZipException {
  if (!isStringNotNullAndNotEmpty(str)) {
    throw new ZipException("input string is null, cannot calculate encoded String length");
  }
  
  String charset = detectCharSet(str);
  return getEncodedStringLength(str, charset);
}

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

/**
 * returns the length of the string by wrapping it in a byte buffer with
 * the appropriate charset of the input string and returns the limit of the 
 * byte buffer
 * @param str
 * @return length of the string
 * @throws ZipException
 */
public static int getEncodedStringLength(String str) throws ZipException {
  if (!isStringNotNullAndNotEmpty(str)) {
    throw new ZipException("input string is null, cannot calculate encoded String length");
  }
  
  String charset = detectCharSet(str);
  return getEncodedStringLength(str, charset);
}

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

fileHeader.setFileNameLength(Zip4jUtil.getEncodedStringLength(fileName, 
      zipModel.getFileNameCharset()));
} else {
  fileHeader.setFileNameLength(Zip4jUtil.getEncodedStringLength(fileName));

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

fileHeader.setFileNameLength(Zip4jUtil.getEncodedStringLength(fileName, 
      zipModel.getFileNameCharset()));
} else {
  fileHeader.setFileNameLength(Zip4jUtil.getEncodedStringLength(fileName));

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

} else {
  copyByteArrayToArrayList(Zip4jUtil.convertCharset(fileHeader.getFileName()), headerBytesList);
  sizeOfFileHeader += Zip4jUtil.getEncodedStringLength(fileHeader.getFileName());

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

} else {
  copyByteArrayToArrayList(Zip4jUtil.convertCharset(fileHeader.getFileName()), headerBytesList);
  sizeOfFileHeader += Zip4jUtil.getEncodedStringLength(fileHeader.getFileName());

相关文章