public byte[] pack() throws IOException {        
        byte[] footer = new byte[activeEntries * 10 + cSize + 2];
        footer[0] = (byte) (activeEntries >> 8);
        footer[1] = (byte)  activeEntries;
        int informationOffset = 2;
        for(int i = 0; i < amountEntries; i++) {
            if(archivePayloads[i] != null) {
                footer[informationOffset++] = (byte) (nameHashes[i] >> 24);
                footer[informationOffset++] = (byte) (nameHashes[i] >> 16);
                footer[informationOffset++] = (byte) (nameHashes[i] >> 8);
                footer[informationOffset++] = (byte)  nameHashes[i];
                footer[informationOffset++] = (byte) (uSizes[i] >> 16);
                footer[informationOffset++] = (byte) (uSizes[i] >> 8);
                footer[informationOffset++] = (byte)  uSizes[i];
                footer[informationOffset++] = (byte) (cSizes[i] >> 16);
                footer[informationOffset++] = (byte) (cSizes[i] >> 8);
                footer[informationOffset++] = (byte)  cSizes[i];
            }
        }
        for(int i = 0; i < amountEntries; i++) {
            if(archivePayloads[i] != null) {
                System.arraycopy(archivePayloads[i], 0, footer, informationOffset, cSizes[i]);
                informationOffset += cSizes[i];
            }
        }
        byte[] header = new byte[3 + 3];      
        int usize = footer.length;
        header[0] = (byte) (usize >> 16);
        header[1] = (byte) (usize >> 8);
        header[2] = (byte)  usize;
        if(isCompressed) {
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            BZip2CompressorOutputStream bz2os = new BZip2CompressorOutputStream(os);
            bz2os.write(footer);
            footer = os.toByteArray();    
        }
        int csize = footer.length;
        header[3] = (byte) (csize >> 16);
        header[4] = (byte) (csize >> 8);
        header[5] = (byte)  csize;
        byte[] payload = new byte[header.length + csize];
        System.arraycopy(header, 0, payload, 0, payload.length);
        System.arraycopy(footer, 0, payload, header.length, footer.length);
        return payload;
    }