harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Deakin <oliver.dea...@googlemail.com>
Subject Re: svn commit: r662810 - in /harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200: BHSDCodec.java BandSet.java CPClass.java Codec.java CpBands.java PopulationCodec.java RunCodec.java Segment.java SegmentHeader.jav
Date Wed, 04 Jun 2008 09:58:45 GMT
Just rebuilt after your latest commit and it's completed successfully.

Regards,
Oliver

Sian January wrote:
> Actually ignore that - it looks like I have a later version of bcel in my
> workspace that has some extra classes in.  I'll check in a fix asap.
>
>
> On 04/06/2008, Sian January <sianjanuary@googlemail.com> wrote:
>   
>> Hi Nathan,
>>
>> It works for me, but I had to do a 'clean' first.  Would you mind trying
>> this?
>>
>> Thanks,
>>
>> Sian
>>
>>
>> On 04/06/2008, Nathan Beyer <ndbeyer@apache.org> wrote:
>>     
>>> This revision or one related to it broke something. I'm getting compile
>>> errors in Segment about unresolvable types.
>>>
>>> On Tue, Jun 3, 2008 at 9:17 AM, <sjanuary@apache.org> wrote:
>>>
>>>       
>>>> Author: sjanuary
>>>> Date: Tue Jun  3 07:17:00 2008
>>>> New Revision: 662810
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=662810&view=rev
>>>> Log:
>>>> Pack200 segment header and supporting encode methods
>>>>
>>>> Modified:
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
>>>>
>>>>         
>>>>  harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -308,6 +308,10 @@
>>>>         return bytes;
>>>>     }
>>>>
>>>> +    public byte[] encode(long value) throws Pack200Exception {
>>>> +        return encode(value, 0);
>>>> +    }
>>>> +
>>>>     /**
>>>>      * Returns true if this codec is a delta codec
>>>>      *
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -22,11 +22,14 @@
>>>>
>>>>  public abstract class BandSet {
>>>>
>>>> -    public abstract void pack(OutputStream out) throws IOException;
>>>> +    public abstract void pack(OutputStream out) throws IOException,
>>>> Pack200Exception;
>>>>
>>>> -    protected byte[] encodeScalar(int[] band) {
>>>> -        // TODO Auto-generated method stub
>>>> -        return null;
>>>> +    public byte[] encodeScalar(int[] band, BHSDCodec codec) throws
>>>> Pack200Exception {
>>>> +        return codec.encode(band);
>>>> +    }
>>>> +
>>>> +    public byte[] encodeScalar(int value, BHSDCodec codec) throws
>>>> Pack200Exception {
>>>> +        return codec.encode(value);
>>>>     }
>>>>
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -17,7 +17,7 @@
>>>>  package org.apache.harmony.pack200;
>>>>
>>>>
>>>> -public class CPClass {
>>>> +public class CPClass implements Comparable {
>>>>
>>>>
>>>>     private final String className;
>>>> @@ -26,4 +26,8 @@
>>>>         this.className = className;
>>>>     }
>>>>
>>>> +    public int compareTo(Object arg0) {
>>>> +        return className.compareTo(((CPClass)arg0).className);
>>>> +    }
>>>> +
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Codec.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -103,6 +103,30 @@
>>>>             Pack200Exception;
>>>>
>>>>     /**
>>>> +     * Encode a single value into a sequence of bytes.
>>>> +     *
>>>> +     * @param value
>>>> +     *            the value to encode
>>>> +     * @param last
>>>> +     *            the previous value encoded (for delta encodings)
>>>> +     * @return the encoded bytes
>>>> +     * @throws Pack200Exception
>>>> +     */
>>>> +    public abstract byte[] encode(long value, long last)
>>>> +            throws Pack200Exception;
>>>> +
>>>> +    /**
>>>> +     * Encode a single value into a sequence of bytes. Note that this
>>>> method can
>>>> +     * only be used for non-delta encodings.
>>>> +     *
>>>> +     * @param value
>>>> +     *            the value to encode
>>>> +     * @return the encoded bytes
>>>> +     * @throws Pack200Exception
>>>> +     */
>>>> +    public abstract byte[] encode(long value) throws Pack200Exception;
>>>> +
>>>> +    /**
>>>>      * Decode a sequence of bytes from the given input stream, returning
>>>> the
>>>>      * value as a long. If this encoding is a delta encoding (d=1) then
>>>>         
>>> the
>>>       
>>>>      * previous value must be passed in as a parameter. If it is a
>>>> non-delta
>>>> @@ -250,4 +274,29 @@
>>>>         }
>>>>         return result;
>>>>     }
>>>> +
>>>> +    /**
>>>> +     * Encode a sequence of integers into a byte array
>>>> +     *
>>>> +     * @param ints
>>>> +     *            the values to encode
>>>> +     * @return byte[] encoded bytes
>>>> +     * @throws Pack200Exception
>>>> +     *             if there is a problem encoding any of the values
>>>> +     */
>>>> +    public byte[] encode(int[] ints) throws Pack200Exception {
>>>> +        int total = 0;
>>>> +        byte[][] bytes = new byte[ints.length][];
>>>> +        for (int i = 0; i < ints.length; i++) {
>>>> +            bytes[i] = encode(ints[i]);
>>>> +            total += bytes[i].length;
>>>> +        }
>>>> +        byte[] encoded = new byte[total];
>>>> +        int index = 0;
>>>> +        for (int i = 0; i < bytes.length; i++) {
>>>> +            System.arraycopy(bytes[i], 0, encoded, index,
>>>> bytes[i].length);
>>>> +            index += bytes[i].length;
>>>> +        }
>>>> +        return encoded;
>>>> +    }
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -129,17 +129,21 @@
>>>>     public void addConstantNameAndType(ConstantNameAndType constant) {
>>>>         String name = constant.getName(currentConstantPool);
>>>>         String signature = constant.getSignature(currentConstantPool);
>>>> -        cp_Signature.add(signature);
>>>> -        CPNameAndType nameAndType = new CPNameAndType(name,
>>>> -                signature);
>>>> -        stringsToCpNameAndType.put(name + ":" + signature,
>>>>         
>>> nameAndType);
>>>       
>>>> -        cp_Descr.add(nameAndType);
>>>> +        String descr = name + ":" + signature;
>>>> +        if(stringsToCpNameAndType.get(descr) != null) {
>>>> +            cp_Signature.add(signature);
>>>> +            CPNameAndType nameAndType = new CPNameAndType(name,
>>>> +                    signature);
>>>> +            stringsToCpNameAndType.put(descr, nameAndType);
>>>> +            cp_Descr.add(nameAndType);
>>>> +        }
>>>>     }
>>>>
>>>>     public void addConstantString(ConstantString constant) {
>>>>         String string = constant.getBytes(currentConstantPool);
>>>> -        if(stringsToCpString.get(string) == null) {
>>>> -            CPString cpString = new CPString(string);
>>>> +        CPString cpString = (CPString) stringsToCpString.get(string);
>>>> +        if(cpString == null) {
>>>> +            cpString = new CPString(string);
>>>>             cp_String.add(cpString);
>>>>             stringsToCpString.put(string, cpString);
>>>>         }
>>>> @@ -159,18 +163,25 @@
>>>>     }
>>>>
>>>>     public CPClass getCPClass(String className) {
>>>> -        if(stringsToCpClass.get(className) == null) {
>>>> -            throw new RuntimeException("null");
>>>> +        CPClass cpClass = (CPClass) stringsToCpClass.get(className);
>>>> +        if(cpClass == null) {
>>>> +            cpClass = new CPClass(className);
>>>> +            cp_Class.add(cpClass);
>>>> +            stringsToCpClass.put(className, cpClass);
>>>>         }
>>>> -        return (CPClass) stringsToCpClass.get(className);
>>>> +        return cpClass;
>>>>     }
>>>>
>>>>     public CPNameAndType getCPNameAndType(String name, String signature)
>>>>         
>>> {
>>>       
>>>> -        String str = name + ":" + signature;
>>>> -        if(stringsToCpNameAndType.get(str) == null) {
>>>> -            throw new RuntimeException("null");
>>>> +        String descr = name + ":" + signature;
>>>> +        CPNameAndType nameAndType = (CPNameAndType)
>>>> stringsToCpNameAndType.get(descr);
>>>> +        if (nameAndType == null) {
>>>> +            cp_Signature.add(signature);
>>>> +            nameAndType = new CPNameAndType(name, signature);
>>>> +            stringsToCpNameAndType.put(descr, nameAndType);
>>>> +            cp_Descr.add(nameAndType);
>>>>         }
>>>> -        return (CPNameAndType) stringsToCpNameAndType.get(str);
>>>> +        return nameAndType;
>>>>     }
>>>>
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/PopulationCodec.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -137,4 +137,14 @@
>>>>     public Codec getUnvafouredCodec() {
>>>>         return unvafouredCodec;
>>>>     }
>>>> +
>>>> +    public byte[] encode(long value, long last) throws Pack200Exception
>>>>         
>>> {
>>>       
>>>> +        // TODO Auto-generated method stub
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    public byte[] encode(long value) throws Pack200Exception {
>>>> +        // TODO Auto-generated method stub
>>>> +        return null;
>>>> +    }
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/RunCodec.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -125,4 +125,14 @@
>>>>         return "RunCodec[k=" + k + ";aCodec=" + aCodec + "bCodec=" +
>>>>         
>>> bCodec
>>>       
>>>>                 + "]";
>>>>     }
>>>> +
>>>> +    public byte[] encode(long value, long last) throws Pack200Exception
>>>>         
>>> {
>>>       
>>>> +        // TODO Auto-generated method stub
>>>> +        return null;
>>>> +    }
>>>> +
>>>> +    public byte[] encode(long value) throws Pack200Exception {
>>>> +        // TODO Auto-generated method stub
>>>> +        return null;
>>>> +    }
>>>>  }
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -75,7 +75,7 @@
>>>>     private BcBands bcBands;
>>>>     private FileBands fileBands;
>>>>
>>>> -    public void pack(List classes, OutputStream out) throws IOException
>>>>         
>>> {
>>>       
>>>> +    public void pack(List classes, OutputStream out) throws
>>>>         
>>> IOException,
>>>       
>>>> Pack200Exception {
>>>>         segmentHeader = new SegmentHeader();
>>>>         cpBands = new CpBands();
>>>>         attributeDefinitionBands = new AttributeDefinitionBands();
>>>>
>>>> Modified:
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
>>>       
>>>> URL:
>>>>
>>>>         
>>> http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java?rev=662810&r1=662809&r2=662810&view=diff
>>>       
>>>>         
>>> ==============================================================================
>>>       
>>>> ---
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
>>>       
>>>> (original)
>>>> +++
>>>>
>>>>         
>>> harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
>>>       
>>>> Tue Jun  3 07:17:00 2008
>>>> @@ -19,79 +19,298 @@
>>>>  import java.io.IOException;
>>>>  import java.io.OutputStream;
>>>>
>>>> -
>>>> +/**
>>>> + * SegmentHeader is the header band of a {@link Segment}
>>>> + */
>>>>  public class SegmentHeader extends BandSet {
>>>>
>>>>     private static final int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D };
>>>> +    private static final int archive_minver = 7;
>>>> +    private static final int archive_majver = 150;
>>>> +
>>>> +    private int archive_options;
>>>> +
>>>> +    private int cp_Utf8_count;
>>>> +    private int cp_Int_count;
>>>> +    private int cp_Float_count;
>>>> +    private int cp_Long_count;
>>>> +    private int cp_Double_count;
>>>> +    private int cp_String_count;
>>>> +    private int cp_Class_count;
>>>> +    private int cp_Signature_count;
>>>> +    private int cp_Descr_count;
>>>> +    private int cp_Field_count;
>>>> +    private int cp_Method_count;
>>>> +    private int cp_Imethod_count;
>>>> +
>>>> +    private int attribute_definition_count;
>>>> +    private final byte[] band_headers = new byte[0];
>>>> +
>>>> +    private boolean have_all_code_flags;
>>>> +
>>>> +    private int archive_size_hi;
>>>> +    private int archive_size_lo;
>>>> +    private int archive_next_count;
>>>> +    private int archive_modtime;
>>>> +    private int file_count;
>>>> +
>>>> +    private boolean deflate_hint;
>>>> +    private boolean have_file_modtime;
>>>> +    private boolean  have_file_options;
>>>> +    private boolean  have_file_size_hi;
>>>> +    private boolean  have_class_flags_hi;
>>>> +    private boolean  have_field_flags_hi;
>>>> +    private boolean  have_method_flags_hi;
>>>> +    private boolean  have_code_flags_hi;
>>>> +
>>>> +    private int ic_count;
>>>> +    private int default_class_minver;
>>>> +    private int default_class_majver;
>>>> +    private int class_count;
>>>> +
>>>> +    /**
>>>> +     * Encode and write the SegmentHeader bands to the OutputStream
>>>> +     */
>>>> +    public void pack(OutputStream out) throws IOException,
>>>> Pack200Exception {
>>>> +        out.write(encodeScalar(magic, Codec.BYTE1));
>>>> +        out.write(encodeScalar(archive_minver, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(archive_majver, Codec.UNSIGNED5));
>>>> +        calculateArchiveOptions();
>>>> +        out.write(encodeScalar(archive_options, Codec.UNSIGNED5));
>>>> +        writeArchiveFileCounts(out);
>>>> +        writeArchiveSpecialCounts(out);
>>>> +        writeCpCounts(out);
>>>> +        writeClassCounts(out);
>>>> +        if (band_headers.length > 0) {
>>>> +            out.write(band_headers);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    private void calculateArchiveOptions() {
>>>> +        if(attribute_definition_count > 0 || band_headers.length >
0) {
>>>> +            archive_options |= 1;
>>>> +        }
>>>> +        if(cp_Int_count > 0 || cp_Float_count > 0 || cp_Long_count
> 0
>>>>         
>>> ||
>>>       
>>>> cp_Double_count > 0) {
>>>> +            archive_options |= (1 << 1);
>>>> +        }
>>>> +        if(have_all_code_flags) {
>>>> +            archive_options |= (1 << 2);
>>>> +        }
>>>> +        if(file_count > 0) {
>>>> +            archive_options |= (1 << 4);
>>>> +        }
>>>> +        if(deflate_hint) {
>>>> +            archive_options |= (1 << 5);
>>>> +        }
>>>> +        if(have_file_modtime) {
>>>> +            archive_options |= (1 << 6);
>>>> +        }
>>>> +        if(have_file_options) {
>>>> +            archive_options |= (1 << 7);
>>>> +        }
>>>> +        if(have_file_size_hi) {
>>>> +            archive_options |= (1 << 8);
>>>> +        }
>>>> +        if(have_class_flags_hi) {
>>>> +            archive_options |= (1 << 9);
>>>> +        }
>>>> +        if(have_field_flags_hi) {
>>>> +            archive_options |= (1 << 10);
>>>> +        }
>>>> +        if(have_method_flags_hi) {
>>>> +            archive_options |= (1 << 11);
>>>> +        }
>>>> +        if(have_code_flags_hi) {
>>>> +            archive_options |= (1 << 12);
>>>> +        }
>>>> +    }
>>>> +
>>>> +    public void setCp_Utf8_count(int count) {
>>>> +        cp_Utf8_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Int_count(int count) {
>>>> +        cp_Int_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Float_count(int count) {
>>>> +        cp_Float_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Long_count(int count) {
>>>> +        cp_Long_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Double_count(int count) {
>>>> +        cp_Double_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_String_count(int count) {
>>>> +        cp_String_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Class_count(int count) {
>>>> +        cp_Class_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Signature_count(int count) {
>>>> +        cp_Signature_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Descr_count(int count) {
>>>> +        cp_Descr_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Field_count(int count) {
>>>> +        cp_Field_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Method_count(int count) {
>>>> +        cp_Method_count = count;
>>>> +    }
>>>> +
>>>> +    public void setCp_Imethod_count(int count) {
>>>> +        cp_Imethod_count = count;
>>>> +    }
>>>> +
>>>> +    public void setAttributeDefinition_count(int count) {
>>>> +        attribute_definition_count = count;
>>>> +    }
>>>>
>>>> -    private int cpUtf8Count;
>>>> -    private int cpIntCount;
>>>> -    private int cpFloatCount;
>>>> -    private int cpLongCount;
>>>> -    private int cpDoubleCount;
>>>> -    private int cpStringCount;
>>>> -    private int cpClassCount;
>>>> -    private int cpSignatureCount;
>>>> -    private int cpDescrCount;
>>>> -    private int cpFieldCount;
>>>> -    private int cpMethodCount;
>>>> -    private int cpImethodCount;
>>>> -    private int attributeDefinitionCount;
>>>>
>>>> -    public void pack(OutputStream out) throws IOException {
>>>> -        out.write(encodeScalar(magic));
>>>> +    public void setAttribute_definition_count(int
>>>> attribute_definition_count) {
>>>> +        this.attribute_definition_count = attribute_definition_count;
>>>>     }
>>>>
>>>> -    public void setCpUtf8Count(int count) {
>>>> -        cpUtf8Count = count;
>>>> +
>>>> +    public void setHave_all_code_flags(boolean have_all_code_flags) {
>>>> +        this.have_all_code_flags = have_all_code_flags;
>>>>     }
>>>>
>>>> -    public void setCpIntCount(int count) {
>>>> -        cpIntCount = count;
>>>> +
>>>> +    public void setArchive_size_hi(int archive_size_hi) {
>>>> +        this.archive_size_hi = archive_size_hi;
>>>>     }
>>>>
>>>> -    public void setCpFloatCount(int count) {
>>>> -        cpFloatCount = count;
>>>> +
>>>> +    public void setArchive_size_lo(int archive_size_lo) {
>>>> +        this.archive_size_lo = archive_size_lo;
>>>>     }
>>>>
>>>> -    public void setCpLongCount(int count) {
>>>> -        cpLongCount = count;
>>>> +
>>>> +    public void setArchive_next_count(int archive_next_count) {
>>>> +        this.archive_next_count = archive_next_count;
>>>>     }
>>>>
>>>> -    public void setCpDoubleCount(int count) {
>>>> -        cpDoubleCount = count;
>>>> +
>>>> +    public void setArchive_modtime(int archive_modtime) {
>>>> +        this.archive_modtime = archive_modtime;
>>>>     }
>>>>
>>>> -    public void setCpStringCount(int count) {
>>>> -        cpStringCount = count;
>>>> +
>>>> +    public void setFile_count(int file_count) {
>>>> +        this.file_count = file_count;
>>>>     }
>>>>
>>>> -    public void setCpClassCount(int count) {
>>>> -        cpClassCount = count;
>>>> +
>>>> +    public void setDeflate_hint(boolean deflate_hint) {
>>>> +        this.deflate_hint = deflate_hint;
>>>>     }
>>>>
>>>> -    public void setCpSignatureCount(int count) {
>>>> -        cpSignatureCount = count;
>>>> +
>>>> +    public void setHave_file_modtime(boolean have_file_modtime) {
>>>> +        this.have_file_modtime = have_file_modtime;
>>>>     }
>>>>
>>>> -    public void setCpDescrCount(int count) {
>>>> -        cpDescrCount = count;
>>>> +
>>>> +    public void setHave_file_options(boolean have_file_options) {
>>>> +        this.have_file_options = have_file_options;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setHave_file_size_hi(boolean have_file_size_hi) {
>>>> +        this.have_file_size_hi = have_file_size_hi;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setHave_class_flags_hi(boolean have_class_flags_hi) {
>>>> +        this.have_class_flags_hi = have_class_flags_hi;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setHave_field_flags_hi(boolean have_field_flags_hi) {
>>>> +        this.have_field_flags_hi = have_field_flags_hi;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setHave_method_flags_hi(boolean have_method_flags_hi) {
>>>> +        this.have_method_flags_hi = have_method_flags_hi;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setHave_code_flags_hi(boolean have_code_flags_hi) {
>>>> +        this.have_code_flags_hi = have_code_flags_hi;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setIc_count(int ic_count) {
>>>> +        this.ic_count = ic_count;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setDefault_class_minver(int default_class_minver) {
>>>> +        this.default_class_minver = default_class_minver;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setDefault_class_majver(int default_class_majver) {
>>>> +        this.default_class_majver = default_class_majver;
>>>> +    }
>>>> +
>>>> +
>>>> +    public void setClass_count(int class_count) {
>>>> +        this.class_count = class_count;
>>>>     }
>>>>
>>>> -    public void setCpFieldCount(int count) {
>>>> -        cpFieldCount = count;
>>>> +    private void writeCpCounts(OutputStream out) throws IOException,
>>>> Pack200Exception {
>>>> +        out.write(encodeScalar(cp_Utf8_count, Codec.UNSIGNED5));
>>>> +        if((archive_options & (1 << 1)) != 0) { // have_cp_numbers
>>>> +            out.write(encodeScalar(cp_Int_count, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(cp_Float_count, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(cp_Long_count, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(cp_Double_count, Codec.UNSIGNED5));
>>>> +        }
>>>> +        out.write(encodeScalar(cp_String_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Class_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Signature_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Descr_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Field_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Method_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(cp_Imethod_count, Codec.UNSIGNED5));
>>>>     }
>>>>
>>>> -    public void setCpMethodCount(int count) {
>>>> -        cpMethodCount = count;
>>>> +    private void writeClassCounts(OutputStream out) throws IOException,
>>>> Pack200Exception {
>>>> +        out.write(encodeScalar(ic_count, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(default_class_minver, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(default_class_majver, Codec.UNSIGNED5));
>>>> +        out.write(encodeScalar(class_count, Codec.UNSIGNED5));
>>>>     }
>>>>
>>>> -    public void setCpImethodCount(int count) {
>>>> -        cpImethodCount = count;
>>>> +    private void writeArchiveSpecialCounts(OutputStream out) throws
>>>> IOException, Pack200Exception {
>>>> +        if((archive_options & 1) > 0) { // have_special_formats
>>>> +            out.write(encodeScalar(band_headers.length,
>>>>         
>>> Codec.UNSIGNED5));
>>>       
>>>> +            out.write(encodeScalar(attribute_definition_count,
>>>> Codec.UNSIGNED5));
>>>> +        }
>>>>     }
>>>>
>>>> -    public void setAttributeDefinitionCount(int count) {
>>>> -        attributeDefinitionCount = count;
>>>> +    private void writeArchiveFileCounts(OutputStream out) throws
>>>> IOException, Pack200Exception {
>>>> +        if((archive_options & (1 << 4)) > 0) { // have_file_headers
>>>> +            out.write(encodeScalar(archive_size_hi, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(archive_size_lo, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(archive_next_count,
>>>>         
>>> Codec.UNSIGNED5));
>>>       
>>>> +            out.write(encodeScalar(archive_modtime, Codec.UNSIGNED5));
>>>> +            out.write(encodeScalar(file_count, Codec.UNSIGNED5));
>>>> +        }
>>>>     }
>>>>
>>>> -}
>>>> +}
>>>> \ No newline at end of file
>>>>
>>>>
>>>>
>>>>         
>>
>> --
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with number
>> 741598.
>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>>     
>
>
>
>
>   

-- 
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


Mime
View raw message