public void pack()

in src/main/java/org/apache/commons/compress/harmony/pack200/ClassBands.java [948:1022]


    public void pack(final OutputStream out) throws IOException, Pack200Exception {
        PackingUtils.log("Writing class bands...");

        byte[] encodedBand = encodeBandInt("class_this", getInts(class_this), Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_this[" + class_this.length + "]");

        encodedBand = encodeBandInt("class_super", getInts(class_super), Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_super[" + class_super.length + "]");

        encodedBand = encodeBandInt("class_interface_count", class_interface_count, Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_interface_count[" + class_interface_count.length + "]");

        final int totalInterfaces = sum(class_interface_count);
        final int[] classInterface = new int[totalInterfaces];
        int k = 0;
        for (final CPClass[] element : class_interface) {
            if (element != null) {
                for (final CPClass cpClass : element) {
                    classInterface[k] = cpClass.getIndex();
                    k++;
                }
            }
        }

        encodedBand = encodeBandInt("class_interface", classInterface, Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_interface[" + classInterface.length + "]");

        encodedBand = encodeBandInt("class_field_count", class_field_count, Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_field_count[" + class_field_count.length + "]");

        encodedBand = encodeBandInt("class_method_count", class_method_count, Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from class_method_count[" + class_method_count.length + "]");

        final int totalFields = sum(class_field_count);
        final int[] fieldDescr = new int[totalFields];
        k = 0;
        for (int i = 0; i < index; i++) {
            for (int j = 0; j < field_descr[i].length; j++) {
                final CPNameAndType descr = field_descr[i][j];
                fieldDescr[k] = descr.getIndex();
                k++;
            }
        }

        encodedBand = encodeBandInt("field_descr", fieldDescr, Codec.DELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from field_descr[" + fieldDescr.length + "]");

        writeFieldAttributeBands(out);

        final int totalMethods = sum(class_method_count);
        final int[] methodDescr = new int[totalMethods];
        k = 0;
        for (int i = 0; i < index; i++) {
            for (int j = 0; j < method_descr[i].length; j++) {
                final CPNameAndType descr = method_descr[i][j];
                methodDescr[k] = descr.getIndex();
                k++;
            }
        }

        encodedBand = encodeBandInt("method_descr", methodDescr, Codec.MDELTA5);
        out.write(encodedBand);
        PackingUtils.log("Wrote " + encodedBand.length + " bytes from method_descr[" + methodDescr.length + "]");

        writeMethodAttributeBands(out);
        writeClassAttributeBands(out);
        writeCodeBands(out);
    }