/** * Indicate that this entry is a symbolic link to the given filename. * * @param name Name of the file this entry links to, empty String * if it is not a symbolic link. */ public void setLinkedFile(final String name) { link = name; mode = getMode(mode); }
/** * File mode of this file. * @param mode the file mode */ public void setMode(final int mode) { this.mode = getMode(mode); }
/** * Indicate whether this entry is a directory. * @param dirFlag if true, this entry is a directory */ public void setDirectory(final boolean dirFlag) { this.dirFlag = dirFlag; mode = getMode(mode); }
/** * 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; }
/** * File mode of this file. * @param mode the file mode */ public void setMode(final int mode) { this.mode = getMode(mode); }
/** * Indicate whether this entry is a directory. * @param dirFlag if true, this entry is a directory */ public void setDirectory(final boolean dirFlag) { this.dirFlag = dirFlag; mode = getMode(mode); }
/** * Indicate that this entry is a symbolic link to the given filename. * * @param name Name of the file this entry links to, empty String * if it is not a symbolic link. */ public void setLinkedFile(final String name) { link = name; mode = getMode(mode); }
@Override protected int permissionsMode(ArchiveEntry archiveEntry) { if (archiveEntry instanceof ZipArchiveEntry) { ZipArchiveEntry zipArchiveEntry = (ZipArchiveEntry) archiveEntry; ZipExtraField[] extraFields = zipArchiveEntry.getExtraFields(); for (ZipExtraField zipExtraField : extraFields) { if (zipExtraField instanceof AsiExtraField) { AsiExtraField asiExtraField = (AsiExtraField) zipExtraField; return asiExtraField.getMode(); } } } else { throw new ExecutionException("No ZipEntry has been passed to a Unzip method."); } return 0; } }
/** * 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; }