/** * 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. * * @since 1.1 */ public void setLinkedFile(String name) { link = name; mode = getMode(mode); }
/** * File mode of this file. * @param mode the file mode * @since 1.1 */ public void setMode(int mode) { this.mode = getMode(mode); }
/** * Indicate whether this entry is a directory. * @param dirFlag if true, this entry is a directory * @since 1.1 */ public void setDirectory(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 * @since 1.1 */ public byte[] getLocalFileDataData() { // CRC will be added later byte[] data = new byte[getLocalFileDataLength().getValue() - WORD]; System.arraycopy(ZipShort.getBytes(getMode()), 0, data, 0, 2); 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); long checksum = crc.getValue(); 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; }