本文整理了Java中org.apache.commons.compress.archivers.zip.ZipShort.putShort()
方法的一些代码示例,展示了ZipShort.putShort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipShort.putShort()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipShort
类名称:ZipShort
方法名:putShort
[英]put the value as two bytes in big endian byte order.
[中]
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Get value as two bytes in big endian byte order.
* @param value the Java int to convert to bytes
* @return the converted int as a byte array in big endian byte order
*/
public static byte[] getBytes(final int value) {
final byte[] result = new byte[2];
putShort(value, result, 0);
return result;
}
代码示例来源:origin: org.apache.commons/commons-compress
@Override
public byte[] getLocalFileDataData() {
byte[] content = new byte[BASE_SIZE + padding];
ZipShort.putShort(alignment | (allowMethodChange ? ALLOW_METHOD_MESSAGE_CHANGE_FLAG : 0),
content, 0);
return content;
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Encodes the set bits in a form suitable for ZIP archives.
*
* @param buf the output buffer
* @param offset
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-2</tt>
*/
public void encode(final byte[] buf, final int offset) {
ZipShort.putShort((dataDescriptorFlag ? DATA_DESCRIPTOR_FLAG : 0)
|
(languageEncodingFlag ? UFT8_NAMES_FLAG : 0)
|
(encryptionFlag ? ENCRYPTION_FLAG : 0)
|
(strongEncryptionFlag ? STRONG_ENCRYPTION_FLAG : 0)
, buf, offset);
}
代码示例来源:origin: org.apache.commons/commons-compress
putShort((ze.getPlatform() << 8) | (!hasUsedZip64 ? DATA_DESCRIPTOR_MIN_VERSION : ZIP64_MIN_VERSION),
buf, CFH_VERSION_MADE_BY_OFFSET);
putShort(versionNeededToExtract(zipMethod, needsZip64Extra, entryMetaData.usesDataDescriptor),
buf, CFH_VERSION_NEEDED_OFFSET);
getGeneralPurposeBits(!encodable && fallbackToUTF8, entryMetaData.usesDataDescriptor).encode(buf, CFH_GPB_OFFSET);
putShort(zipMethod, buf, CFH_METHOD_OFFSET);
putShort(nameLen, buf, CFH_FILENAME_LENGTH_OFFSET);
putShort(extra.length, buf, CFH_EXTRA_LENGTH_OFFSET);
putShort(commentLen, buf, CFH_COMMENT_LENGTH_OFFSET);
putShort(ze.getInternalAttributes(), buf, CFH_INTERNAL_ATTRIBUTES_OFFSET);
代码示例来源:origin: org.apache.commons/commons-compress
final boolean dataDescriptor = usesDataDescriptor(zipMethod, phased);
putShort(versionNeededToExtract(zipMethod, hasZip64Extra(ze), dataDescriptor), buf, LFH_VERSION_NEEDED_OFFSET);
putShort(zipMethod, buf, LFH_METHOD_OFFSET);
putShort(nameLen, buf, LFH_FILENAME_LENGTH_OFFSET);
putShort(extra.length, buf, LFH_EXTRA_LENGTH_OFFSET);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public byte[] getLocalFileDataData() {
byte[] content = new byte[BASE_SIZE + padding];
ZipShort.putShort(alignment | (allowMethodChange ? ALLOW_METHOD_MESSAGE_CHANGE_FLAG : 0),
content, 0);
return content;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Get value as two bytes in big endian byte order.
* @param value the Java int to convert to bytes
* @return the converted int as a byte array in big endian byte order
*/
public static byte[] getBytes(final int value) {
final byte[] result = new byte[2];
putShort(value, result, 0);
return result;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Encodes the set bits in a form suitable for ZIP archives.
*
* @param buf the output buffer
* @param offset
* The offset within the output buffer of the first byte to be written.
* must be non-negative and no larger than <tt>buf.length-2</tt>
*/
public void encode(final byte[] buf, final int offset) {
ZipShort.putShort((dataDescriptorFlag ? DATA_DESCRIPTOR_FLAG : 0)
|
(languageEncodingFlag ? UFT8_NAMES_FLAG : 0)
|
(encryptionFlag ? ENCRYPTION_FLAG : 0)
|
(strongEncryptionFlag ? STRONG_ENCRYPTION_FLAG : 0)
, buf, offset);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
putShort((ze.getPlatform() << 8) | (!hasUsedZip64 ? DATA_DESCRIPTOR_MIN_VERSION : ZIP64_MIN_VERSION),
buf, CFH_VERSION_MADE_BY_OFFSET);
putShort(versionNeededToExtract(zipMethod, needsZip64Extra, entryMetaData.usesDataDescriptor),
buf, CFH_VERSION_NEEDED_OFFSET);
getGeneralPurposeBits(!encodable && fallbackToUTF8, entryMetaData.usesDataDescriptor).encode(buf, CFH_GPB_OFFSET);
putShort(zipMethod, buf, CFH_METHOD_OFFSET);
putShort(nameLen, buf, CFH_FILENAME_LENGTH_OFFSET);
putShort(extra.length, buf, CFH_EXTRA_LENGTH_OFFSET);
putShort(commentLen, buf, CFH_COMMENT_LENGTH_OFFSET);
putShort(ze.getInternalAttributes(), buf, CFH_INTERNAL_ATTRIBUTES_OFFSET);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
final boolean dataDescriptor = usesDataDescriptor(zipMethod, phased);
putShort(versionNeededToExtract(zipMethod, hasZip64Extra(ze), dataDescriptor), buf, LFH_VERSION_NEEDED_OFFSET);
putShort(zipMethod, buf, LFH_METHOD_OFFSET);
putShort(nameLen, buf, LFH_FILENAME_LENGTH_OFFSET);
putShort(extra.length, buf, LFH_EXTRA_LENGTH_OFFSET);
内容来源于网络,如有侵权,请联系作者删除!