You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sj...@apache.org on 2008/06/03 12:11:22 UTC
svn commit: r662730 - in /harmony/enhanced/classlib/trunk/modules/pack200:
META-INF/ src/main/java/org/apache/harmony/pack200/
Author: sjanuary
Date: Tue Jun 3 03:11:22 2008
New Revision: 662730
URL: http://svn.apache.org/viewvc?rev=662730&view=rev
Log:
Pack200 - some initial pack code and manifest file changes so that bcel can be used
Added:
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (with props)
harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java (with props)
Modified:
harmony/enhanced/classlib/trunk/modules/pack200/META-INF/MANIFEST.MF
Modified: harmony/enhanced/classlib/trunk/modules/pack200/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/META-INF/MANIFEST.MF?rev=662730&r1=662729&r2=662730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/trunk/modules/pack200/META-INF/MANIFEST.MF Tue Jun 3 03:11:22 2008
@@ -15,9 +15,13 @@
java.lang;resolution:=optional,
java.nio,
java.util;resolution:=optional,
- java.util.jar;resolution:=optional
-Export-Package: org.apache.harmony.unpack200,
- org.apache.harmony.unpack200.bytecode
+ java.util.jar;resolution:=optional,
+ org.apache.bcel,
+ org.apache.bcel.classfile
+Export-Package: org.apache.harmony.pack200,
+ org.apache.harmony.unpack200,
+ org.apache.harmony.unpack200.bytecode,
+ org.apache.harmony.unpack200.bytecode.forms
Bundle-RequiredExecutionEnvironment: J2SE-1.4,
J2SE-1.5
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarInputStream;
+
+import org.apache.bcel.classfile.ClassParser;
+import org.apache.bcel.classfile.JavaClass;
+
+
+/**
+ *
+ */
+public class Archive {
+
+ private final JarInputStream inputStream;
+ private final OutputStream outputStream;
+ private JarFile jarFile;
+
+ public Archive(JarInputStream inputStream, OutputStream outputStream) {
+ this.inputStream = inputStream;
+ this.outputStream = outputStream;
+ }
+
+ public Archive(JarFile jarFile, OutputStream outputStream) {
+ this.outputStream = outputStream;
+ this.jarFile = jarFile;
+ inputStream = null;
+ }
+
+ public void pack() throws Pack200Exception, IOException {
+ List classes = new ArrayList();
+ if(inputStream != null) {
+ while(inputStream.available() > 0) {
+ JarEntry jarEntry = inputStream.getNextJarEntry();
+ if(jarEntry != null) {
+ addJarEntry(jarEntry, inputStream, classes);
+ }
+ }
+ } else {
+ Enumeration jarEntries = jarFile.entries();
+ while(jarEntries.hasMoreElements()) {
+ JarEntry jarEntry = (JarEntry) jarEntries.nextElement();
+ addJarEntry(jarEntry, jarFile.getInputStream(jarEntry), classes);
+ }
+ }
+ new Segment().pack(classes, outputStream); // TODO: Multiple segments
+ }
+
+ private void addJarEntry(JarEntry jarEntry, InputStream stream, List javaClasses) throws IOException, Pack200Exception {
+ String name = jarEntry.getName();
+// long size = jarEntry.getSize();
+// long compressedSize = jarEntry.getCompressedSize();
+// char[] bytes = new char[(int)size];
+// int bytesRead = new InputStreamReader(stream).read(bytes);
+// if(bytesRead != size) {
+// throw new Pack200Exception("An error occurred reading from the Jar file");
+// }
+ if(name.endsWith(".class")) {
+ ClassParser classParser = new ClassParser(stream, name);
+ JavaClass javaClass = classParser.parse();
+ javaClasses.add(javaClass);
+ } else {
+ // TODO: it's a file...
+ }
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+
+import org.apache.bcel.classfile.Unknown;
+
+
+public class AttributeDefinitionBands extends BandSet {
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addUnknownAttribute(Unknown obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+public abstract class BandSet {
+
+ public abstract void pack(OutputStream out) throws IOException;
+
+ protected byte[] encodeScalar(int[] band) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+
+import org.apache.bcel.classfile.Code;
+
+
+public class BcBands extends BandSet {
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addCode(Code obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/BcBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+
+public class CPClass {
+
+
+ private final String className;
+
+ public CPClass(String className) {
+ this.className = className;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPClass.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+public class CPNameAndType implements Comparable {
+
+ private final String name;
+ private final String signature;
+
+ public CPNameAndType(String name, String signature) {
+ this.name = name;
+ this.signature = signature;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof CPNameAndType)) {
+ return false;
+ }
+ return ((CPNameAndType) obj).name.equals(name)
+ && ((CPNameAndType) obj).signature.equals(signature);
+ }
+
+ public int hashCode() {
+ return name.hashCode() + signature.hashCode();
+ }
+
+ public String toString() {
+ return name + ":" + signature;
+ }
+
+ public int compareTo(Object obj) {
+ if (obj instanceof CPNameAndType) {
+ CPNameAndType nat = (CPNameAndType) obj;
+ int compareName = name.compareTo(nat.name);
+ if (compareName == 0) {
+ return signature.compareTo(nat.signature);
+ } else {
+ return compareName;
+ }
+ }
+ return 0;
+ }
+
+}
\ No newline at end of file
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPNameAndType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+
+public class CPString {
+
+
+ private final String string;
+
+ public CPString(String string) {
+ this.string = string;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CPString.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+
+import org.apache.bcel.classfile.Field;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+
+
+public class ClassBands extends BandSet {
+
+ private final CpBands cpBands;
+
+ public ClassBands(CpBands cpBands, int numClasses) {
+ this.cpBands = cpBands;
+ class_this = new CPClass[numClasses];
+ class_super = new CPClass[numClasses];
+ class_interface_count = new int[numClasses];
+ class_interface = new CPClass[numClasses][];
+ class_field_count = new int[numClasses];
+ class_method_count = new int[numClasses];
+ field_descr = new CPNameAndType[numClasses][];
+ method_descr = new CPNameAndType[numClasses][];
+ }
+
+ private int index = 0;
+
+ private final CPClass[] class_this;
+ private final CPClass[] class_super;
+ private final int[] class_interface_count;
+ private final CPClass[][] class_interface;
+ private final int[] class_field_count;
+ private final int[] class_method_count;
+ private final CPNameAndType[][] field_descr;
+ private final CPNameAndType[][] method_descr;
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addClass(JavaClass obj) {
+ class_this[index] = cpBands.getCPClass(obj.getClassName());
+ class_super[index] = cpBands.getCPClass(obj.getSuperclassName());
+ String[] interfaces = obj.getInterfaceNames();
+ class_interface_count[index] = interfaces.length;
+ for (int i = 0; i < interfaces.length; i++) {
+ class_interface[index][i] = cpBands.getCPClass(interfaces[i]);
+ }
+
+
+ Field[] fields = obj.getFields();
+ class_field_count[index] = fields.length;
+ field_descr[index] = new CPNameAndType[fields.length];
+ for (int i = 0; i < fields.length; i++) {
+ field_descr[index][i] = cpBands.getCPNameAndType(fields[i].getName(), fields[i].getSignature());
+ }
+
+ Method[] methods = obj.getMethods();
+ class_method_count[index] = methods.length;
+ method_descr[index] = new CPNameAndType[methods.length];
+ for (int i = 0; i < methods.length; i++) {
+ method_descr[index][i] = cpBands.getCPNameAndType(methods[i].getName(), methods[i].getSignature());
+ }
+
+ index++;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/ClassBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.bcel.classfile.ConstantClass;
+import org.apache.bcel.classfile.ConstantDouble;
+import org.apache.bcel.classfile.ConstantFieldref;
+import org.apache.bcel.classfile.ConstantFloat;
+import org.apache.bcel.classfile.ConstantInteger;
+import org.apache.bcel.classfile.ConstantInterfaceMethodref;
+import org.apache.bcel.classfile.ConstantLong;
+import org.apache.bcel.classfile.ConstantMethodref;
+import org.apache.bcel.classfile.ConstantNameAndType;
+import org.apache.bcel.classfile.ConstantPool;
+import org.apache.bcel.classfile.ConstantString;
+import org.apache.bcel.classfile.ConstantUtf8;
+
+public class CpBands extends BandSet {
+
+ private final Set cp_Utf8 = new TreeSet();
+ private final Set cp_Int = new TreeSet();
+ private final Set cp_Float = new TreeSet();
+ private final Set cp_Long = new TreeSet();
+ private final Set cp_Double = new TreeSet();
+ private final Set cp_String = new TreeSet();
+ private final Set cp_Class = new TreeSet();
+ private final Set cp_Signature = new TreeSet();
+ private final Set cp_Descr = new TreeSet();
+ private final Set cp_Field = new TreeSet();
+ private final Set cp_Method = new TreeSet();
+ private final Set cp_Imethod = new TreeSet();
+
+ private ConstantPool currentConstantPool;
+ private final Map stringsToCpClass = new HashMap();
+ private final Map stringsToCpNameAndType = new HashMap();
+ private final Map stringsToCpString = new HashMap();
+ private final Map stringsToCpSignature = new HashMap();
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setCurrentConstantPool(ConstantPool cp) {
+ this.currentConstantPool = cp;
+ }
+
+ public void sortPool() {
+
+ System.out.println("pool");
+ }
+
+ public void addConstantClass(ConstantClass constant) {
+ String className = constant.getBytes(currentConstantPool);
+ if(stringsToCpClass.get(className) == null) {
+ CPClass cpClass = new CPClass(className);
+ cp_Class.add(cpClass);
+ stringsToCpClass.put(className, cpClass);
+ }
+ }
+
+ public void addConstantDouble(ConstantDouble constant) {
+ cp_Double.add(new Double((constant).getBytes()));
+ }
+
+ public void addConstantFieldref(ConstantFieldref constant) {
+ ConstantFieldref cf = constant;
+ ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
+ .getConstant(cf.getNameAndTypeIndex());
+ CPNameAndType nat = new CPNameAndType(cnat.getName(currentConstantPool),
+ cnat.getSignature(currentConstantPool));
+ cp_Signature.add(cnat.getSignature(currentConstantPool));
+ cp_Field.add(new MethodOrField(cf.getClass(currentConstantPool), nat));
+ }
+
+ public void addConstantFloat(ConstantFloat constant) {
+ cp_Float.add(new Float((constant).getBytes()));
+ }
+
+ public void addConstantInteger(ConstantInteger constant) {
+ cp_Int.add(new Integer((constant).getBytes()));
+ }
+
+ public void addConstantInterfaceMethodref(
+ ConstantInterfaceMethodref constant) {
+ ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
+ .getConstant(constant.getNameAndTypeIndex());
+ String signature = cnat.getSignature(currentConstantPool);
+ cp_Signature.add(signature);
+ CPNameAndType nat = new CPNameAndType(cnat.getName(currentConstantPool), signature);
+ cp_Imethod.add(new MethodOrField(constant.getClass(currentConstantPool), nat));
+ }
+
+ public void addConstantLong(ConstantLong constant) {
+ cp_Long.add(new Long((constant).getBytes()));
+ }
+
+ public void addConstantMethodref(ConstantMethodref constant) {
+ ConstantNameAndType cnat = (ConstantNameAndType) currentConstantPool
+ .getConstant(constant.getNameAndTypeIndex());
+ String signature = cnat.getSignature(currentConstantPool);
+ cp_Signature.add(signature);
+ CPNameAndType nat = new CPNameAndType(cnat.getName(currentConstantPool),
+ signature);
+ cp_Method.add(new MethodOrField(constant.getClass(currentConstantPool),
+ nat));
+ }
+
+ 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);
+ }
+
+ public void addConstantString(ConstantString constant) {
+ String string = constant.getBytes(currentConstantPool);
+ if(stringsToCpString.get(string) == null) {
+ CPString cpString = new CPString(string);
+ cp_String.add(cpString);
+ stringsToCpString.put(string, cpString);
+ }
+ }
+
+ public void addConstantUtf8(ConstantUtf8 constant) {
+ cp_Utf8.add((constant).getBytes());
+ }
+
+ public void addDesc(String name, String signature) {
+ cp_Signature.add(signature);
+ cp_Descr.add(new CPNameAndType(name, signature));
+ }
+
+ public void addSignature(String signature) {
+ cp_Signature.add(signature);
+ }
+
+ public CPClass getCPClass(String className) {
+ if(stringsToCpClass.get(className) == null) {
+ throw new RuntimeException("null");
+ }
+ return (CPClass) stringsToCpClass.get(className);
+ }
+
+ public CPNameAndType getCPNameAndType(String name, String signature) {
+ String str = name + ":" + signature;
+ if(stringsToCpNameAndType.get(str) == null) {
+ throw new RuntimeException("null");
+ }
+ return (CPNameAndType) stringsToCpNameAndType.get(str);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/CpBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+
+
+public class FileBands extends BandSet {
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/FileBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.bcel.classfile.InnerClasses;
+
+
+public class IcBands extends BandSet {
+
+ private final List innerClasses = new ArrayList();
+
+ public void pack(OutputStream out) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addInnerClasses(InnerClasses obj) {
+ innerClasses.add(obj);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/IcBands.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java?rev=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+public class MethodOrField implements Comparable {
+
+ private final String className;
+ private final CPNameAndType nameAndType;
+
+ public MethodOrField(String className, CPNameAndType nameAndType) {
+ this.className = className;
+ this.nameAndType = nameAndType;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj == null || !(obj instanceof MethodOrField)) {
+ return false;
+ }
+ return ((MethodOrField) obj).className.equals(className)
+ && ((MethodOrField) obj).nameAndType.equals(nameAndType);
+ }
+
+ public int hashCode() {
+ return className.hashCode() + nameAndType.hashCode();
+ }
+
+ public String toString() {
+ return className + ": " + nameAndType;
+ }
+
+ public int compareTo(Object obj) {
+ if (obj instanceof MethodOrField) {
+ MethodOrField mof = (MethodOrField) obj;
+ int compareName = className.compareTo(mof.className);
+ if (compareName == 0) {
+ return nameAndType.compareTo(mof.nameAndType);
+ } else {
+ return compareName;
+ }
+ }
+ return 0;
+ }
+}
\ No newline at end of file
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/MethodOrField.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,286 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.bcel.classfile.AnnotationDefault;
+import org.apache.bcel.classfile.AnnotationEntry;
+import org.apache.bcel.classfile.Annotations;
+import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.CodeException;
+import org.apache.bcel.classfile.ConstantClass;
+import org.apache.bcel.classfile.ConstantDouble;
+import org.apache.bcel.classfile.ConstantFieldref;
+import org.apache.bcel.classfile.ConstantFloat;
+import org.apache.bcel.classfile.ConstantInteger;
+import org.apache.bcel.classfile.ConstantInterfaceMethodref;
+import org.apache.bcel.classfile.ConstantLong;
+import org.apache.bcel.classfile.ConstantMethodref;
+import org.apache.bcel.classfile.ConstantNameAndType;
+import org.apache.bcel.classfile.ConstantPool;
+import org.apache.bcel.classfile.ConstantString;
+import org.apache.bcel.classfile.ConstantUtf8;
+import org.apache.bcel.classfile.ConstantValue;
+import org.apache.bcel.classfile.Deprecated;
+import org.apache.bcel.classfile.DescendingVisitor;
+import org.apache.bcel.classfile.EnclosingMethod;
+import org.apache.bcel.classfile.ExceptionTable;
+import org.apache.bcel.classfile.Field;
+import org.apache.bcel.classfile.InnerClass;
+import org.apache.bcel.classfile.InnerClasses;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.LineNumber;
+import org.apache.bcel.classfile.LineNumberTable;
+import org.apache.bcel.classfile.LocalVariable;
+import org.apache.bcel.classfile.LocalVariableTable;
+import org.apache.bcel.classfile.LocalVariableTypeTable;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.classfile.ParameterAnnotations;
+import org.apache.bcel.classfile.Signature;
+import org.apache.bcel.classfile.SourceFile;
+import org.apache.bcel.classfile.StackMap;
+import org.apache.bcel.classfile.StackMapEntry;
+import org.apache.bcel.classfile.StackMapTable;
+import org.apache.bcel.classfile.StackMapTableEntry;
+import org.apache.bcel.classfile.Synthetic;
+import org.apache.bcel.classfile.Unknown;
+import org.apache.bcel.classfile.Visitor;
+
+
+public class Segment implements Visitor {
+
+ private BandSet segmentHeader;
+ private CpBands cpBands;
+ private AttributeDefinitionBands attributeDefinitionBands;
+ private IcBands icBands;
+ private ClassBands classBands;
+ private BcBands bcBands;
+ private FileBands fileBands;
+
+ public void pack(List classes, OutputStream out) throws IOException {
+ segmentHeader = new SegmentHeader();
+ cpBands = new CpBands();
+ attributeDefinitionBands = new AttributeDefinitionBands();
+ icBands = new IcBands();
+ classBands = new ClassBands(cpBands, classes.size());
+ bcBands = new BcBands();
+ fileBands = new FileBands();
+
+ processClasses(classes);
+
+ segmentHeader.pack(out);
+ cpBands.pack(out);
+ attributeDefinitionBands.pack(out);
+ icBands.pack(out);
+ classBands.pack(out);
+ bcBands.pack(out);
+ fileBands.pack(out);
+ }
+
+ private void processClasses(List classes) {
+ for (Iterator iterator = classes.iterator(); iterator.hasNext();) {
+ JavaClass javaClass = (JavaClass) iterator.next();
+ new DescendingVisitor(javaClass, this).visit();
+ }
+ cpBands.sortPool();
+ }
+
+ public void visitAnnotation(Annotations obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitAnnotationDefault(AnnotationDefault obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitAnnotationEntry(AnnotationEntry obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitCode(Code obj) {
+ bcBands.addCode(obj);
+ }
+
+ public void visitCodeException(CodeException obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitConstantClass(ConstantClass obj) {
+ cpBands.addConstantClass(obj);
+ }
+
+ public void visitConstantDouble(ConstantDouble obj) {
+ cpBands.addConstantDouble(obj);
+
+ }
+
+ public void visitConstantFieldref(ConstantFieldref obj) {
+ cpBands.addConstantFieldref(obj);
+ }
+
+ public void visitConstantFloat(ConstantFloat obj) {
+ cpBands.addConstantFloat(obj);
+ }
+
+ public void visitConstantInteger(ConstantInteger obj) {
+ cpBands.addConstantInteger(obj);
+ }
+
+ public void visitConstantInterfaceMethodref(ConstantInterfaceMethodref obj) {
+ cpBands.addConstantInterfaceMethodref(obj);
+ }
+
+ public void visitConstantLong(ConstantLong obj) {
+ cpBands.addConstantLong(obj);
+ }
+
+ public void visitConstantMethodref(ConstantMethodref obj) {
+ cpBands.addConstantMethodref(obj);
+ }
+
+ public void visitConstantNameAndType(ConstantNameAndType obj) {
+ cpBands.addConstantNameAndType(obj);
+ }
+
+ public void visitConstantPool(ConstantPool obj) {
+ cpBands.setCurrentConstantPool(obj);
+ }
+
+ public void visitConstantString(ConstantString obj) {
+ cpBands.addConstantString(obj);
+ }
+
+ public void visitConstantUtf8(ConstantUtf8 obj) {
+ cpBands.addConstantUtf8(obj);
+ }
+
+ public void visitConstantValue(ConstantValue obj) {
+
+ }
+
+ public void visitDeprecated(Deprecated obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitEnclosingMethod(EnclosingMethod obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitExceptionTable(ExceptionTable obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitField(Field obj) {
+ cpBands.addDesc(obj.getName(), obj.getSignature());
+ }
+
+ public void visitInnerClass(InnerClass obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitInnerClasses(InnerClasses obj) {
+ icBands.addInnerClasses(obj);
+ }
+
+ public void visitJavaClass(JavaClass obj) {
+ classBands.addClass(obj);
+ }
+
+ public void visitLineNumber(LineNumber obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitLineNumberTable(LineNumberTable obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitLocalVariable(LocalVariable obj) {
+ cpBands.addSignature(obj.getSignature());
+ }
+
+ public void visitLocalVariableTable(LocalVariableTable obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitLocalVariableTypeTable(LocalVariableTypeTable obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitMethod(Method obj) {
+ cpBands.addDesc(obj.getName(), obj.getSignature());
+ }
+
+ public void visitParameterAnnotation(ParameterAnnotations obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitSignature(Signature obj) {
+
+ }
+
+ public void visitSourceFile(SourceFile obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitStackMap(StackMap obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitStackMapEntry(StackMapEntry obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitStackMapTable(StackMapTable obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitStackMapTableEntry(StackMapTableEntry obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitSynthetic(Synthetic obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void visitUnknown(Unknown obj) {
+ attributeDefinitionBands.addUnknownAttribute(obj);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=662730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java (added)
+++ harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java Tue Jun 3 03:11:22 2008
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.harmony.pack200;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+public class SegmentHeader extends BandSet {
+
+ private static final int[] magic = { 0xCA, 0xFE, 0xD0, 0x0D };
+
+ 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 setCpUtf8Count(int count) {
+ cpUtf8Count = count;
+ }
+
+ public void setCpIntCount(int count) {
+ cpIntCount = count;
+ }
+
+ public void setCpFloatCount(int count) {
+ cpFloatCount = count;
+ }
+
+ public void setCpLongCount(int count) {
+ cpLongCount = count;
+ }
+
+ public void setCpDoubleCount(int count) {
+ cpDoubleCount = count;
+ }
+
+ public void setCpStringCount(int count) {
+ cpStringCount = count;
+ }
+
+ public void setCpClassCount(int count) {
+ cpClassCount = count;
+ }
+
+ public void setCpSignatureCount(int count) {
+ cpSignatureCount = count;
+ }
+
+ public void setCpDescrCount(int count) {
+ cpDescrCount = count;
+ }
+
+ public void setCpFieldCount(int count) {
+ cpFieldCount = count;
+ }
+
+ public void setCpMethodCount(int count) {
+ cpMethodCount = count;
+ }
+
+ public void setCpImethodCount(int count) {
+ cpImethodCount = count;
+ }
+
+ public void setAttributeDefinitionCount(int count) {
+ attributeDefinitionCount = count;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/classlib/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/SegmentHeader.java
------------------------------------------------------------------------------
svn:mime-type = text/plain