本文整理了Java中org.apache.commons.compress.archivers.zip.ZipShort.getBytes()
方法的一些代码示例,展示了ZipShort.getBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipShort.getBytes()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipShort
类名称:ZipShort
方法名:getBytes
[英]Get value as two bytes in big endian byte order.
[中]以大端字节顺序获取两个字节的值。
代码示例来源:origin: org.apache.commons/commons-compress
@Override
public byte[] getCentralDirectoryData() {
return ZipShort.getBytes(alignment | (allowMethodChange ? ALLOW_METHOD_MESSAGE_CHANGE_FLAG : 0));
}
代码示例来源: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
/**
* The actual data to put into local file data - without Header-ID
* or length specifier.
* @return get the data
*/
@Override
public byte[] getLocalFileDataData() {
// CRC will be added later
final byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
final byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
// CheckStyle:MagicNumber OFF
System.arraycopy(ZipLong.getBytes(linkArray.length),
0, data, 2, WORD);
System.arraycopy(ZipShort.getBytes(getUserId()),
0, data, 6, 2);
System.arraycopy(ZipShort.getBytes(getGroupId()),
0, data, 8, 2);
System.arraycopy(linkArray, 0, data, 10, linkArray.length);
// CheckStyle:MagicNumber ON
crc.reset();
crc.update(data);
final long checksum = crc.getValue();
final byte[] result = new byte[data.length + WORD];
System.arraycopy(ZipLong.getBytes(checksum), 0, result, 0, WORD);
System.arraycopy(data, 0, result, WORD, data.length);
return result;
}
代码示例来源:origin: org.apache.commons/commons-compress
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getCentralDirectoryLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
代码示例来源:origin: org.apache.commons/commons-compress
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
代码示例来源:origin: org.apache.commons/commons-compress
final byte[] num = ZipShort.getBytes(Math.min(numberOfEntries,
ZIP64_MAGIC_SHORT));
writeCounted(num);
writeCounted(ZipShort.getBytes(dataLen));
streamCompressor.writeCounted(data.array(), data.arrayOffset(), dataLen);
代码示例来源:origin: org.apache.commons/commons-compress
writeOut(ZipShort.getBytes(ZIP64_MIN_VERSION));
writeOut(ZipShort.getBytes(ZIP64_MIN_VERSION));
代码示例来源:origin: org.apache.commons/commons-compress
writeOut(ZipShort.getBytes(versionNeededToExtract(entry.entry.getMethod(), false, false)));
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
@Override
public byte[] getCentralDirectoryData() {
return ZipShort.getBytes(alignment | (allowMethodChange ? ALLOW_METHOD_MESSAGE_CHANGE_FLAG : 0));
}
代码示例来源: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
/**
* The actual data to put into local file data - without Header-ID
* or length specifier.
* @return get the data
*/
@Override
public byte[] getLocalFileDataData() {
// CRC will be added later
final byte[] data = new byte[getLocalFileDataLength().getValue() - WORD];
System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2);
final byte[] linkArray = getLinkedFile().getBytes(); // Uses default charset - see class Javadoc
// CheckStyle:MagicNumber OFF
System.arraycopy(ZipLong.getBytes(linkArray.length),
0, data, 2, WORD);
System.arraycopy(ZipShort.getBytes(getUserId()),
0, data, 6, 2);
System.arraycopy(ZipShort.getBytes(getGroupId()),
0, data, 8, 2);
System.arraycopy(linkArray, 0, data, 10, linkArray.length);
// CheckStyle:MagicNumber ON
crc.reset();
crc.update(data);
final long checksum = crc.getValue();
final byte[] result = new byte[data.length + WORD];
System.arraycopy(ZipLong.getBytes(checksum), 0, result, 0, WORD);
System.arraycopy(data, 0, result, WORD, data.length);
return result;
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getLocalFileDataLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
int start = 0;
for (int i = 0; i < regularExtraFieldCount; i++) {
System.arraycopy(data[i].getHeaderId().getBytes(),
0, result, start, 2);
System.arraycopy(data[i].getCentralDirectoryLength().getBytes(),
0, result, start + 2, 2);
start += WORD;
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
final byte[] num = ZipShort.getBytes(Math.min(numberOfEntries,
ZIP64_MAGIC_SHORT));
writeCounted(num);
writeCounted(ZipShort.getBytes(dataLen));
streamCompressor.writeCounted(data.array(), data.arrayOffset(), dataLen);
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
writeOut(ZipShort.getBytes(ZIP64_MIN_VERSION));
writeOut(ZipShort.getBytes(ZIP64_MIN_VERSION));
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
writeOut(ZipShort.getBytes(versionNeededToExtract(entry.entry.getMethod(), false, false)));
内容来源于网络,如有侵权,请联系作者删除!