/** * Write an entry's header information to a header buffer. * * @param outbuf The tar entry header buffer to fill in. */ public void writeEntryHeader(byte[] outbuf) { int offset = 0; offset = TarUtils.getNameBytes(this.name, outbuf, offset, NAMELEN); offset = TarUtils.getOctalBytes(this.mode, outbuf, offset, MODELEN); offset = TarUtils.getOctalBytes(this.userId, outbuf, offset, UIDLEN); offset = TarUtils.getOctalBytes(this.groupId, outbuf, offset, GIDLEN); offset = TarUtils.getLongOctalBytes(this.size, outbuf, offset, SIZELEN); offset = TarUtils.getLongOctalBytes(this.modTime, outbuf, offset, MODTIMELEN); int csOffset = offset; for (int c = 0; c < CHKSUMLEN; ++c) { outbuf[offset++] = (byte) ' '; } outbuf[offset++] = this.linkFlag; offset = TarUtils.getNameBytes(this.linkName, outbuf, offset, NAMELEN); offset = TarUtils.getNameBytes(this.magic, outbuf, offset, MAGICLEN); offset = TarUtils.getNameBytes(this.userName, outbuf, offset, UNAMELEN); offset = TarUtils.getNameBytes(this.groupName, outbuf, offset, GNAMELEN); offset = TarUtils.getOctalBytes(this.devMajor, outbuf, offset, DEVLEN); offset = TarUtils.getOctalBytes(this.devMinor, outbuf, offset, DEVLEN); while (offset < outbuf.length) { outbuf[offset++] = 0; } long checkSum = TarUtils.computeCheckSum(outbuf); TarUtils.getCheckSumOctalBytes(checkSum, outbuf, csOffset, CHKSUMLEN); }