Index: /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java =================================================================== --- /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java (revision 502800) +++ /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/test/java/org/apache/harmony/pack200/tests/SegmentTest.java (working copy) @@ -15,9 +15,11 @@ * limitations under the License. */ package org.apache.harmony.pack200.tests; -//NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5 -//NOTE: Do not extract strings as messages; this code is still a work-in-progress -//NOTE: Also, don't get rid of 'else' statements for the hell of it ... + +// NOTE: Do not use generics in this code; it needs to run on JVMs < 1.5 +// NOTE: Do not extract strings as messages; this code is still a +// work-in-progress +// NOTE: Also, don't get rid of 'else' statements for the hell of it ... import org.apache.harmony.pack200.Segment; import junit.framework.TestCase; @@ -27,10 +29,6 @@ * @version $Revision: $ */ public class SegmentTest extends TestCase { - /** - * @param args - * @throws Exception - */ // Commented on request in HARMONY-2246 // Will be uncommented later // public void testHelloWorld() throws Exception { @@ -38,12 +36,20 @@ // .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack"))); // } /** - * @param args * @throws Exception */ public void testJustResources() throws Exception { - assertNotNull(Segment.parse(Segment.class - .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack"))); + assertNotNull(Segment + .parse(Segment.class + .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack"))); } + /** + * @throws Exception + */ + public void testJustResourcesGZip() throws Exception { + assertNotNull(Segment + .parse(Segment.class + .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack.gz"))); + } } Index: /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/JustResources.pack.gz =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/test/resources/org/apache/harmony/pack200/tests/JustResources.pack.gz ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream Index: /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java =================================================================== --- /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (revision 502800) +++ /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/src/main/java/org/apache/harmony/pack200/Segment.java (working copy) @@ -146,6 +146,17 @@ public static Segment parse(InputStream in) throws IOException, Pack200Exception { Segment segment = new Segment(); + // See if file is GZip compressed + if (in.markSupported()) { + in.mark(2); + if (((in.read() & 0xFF) | (in.read() & 0xFF) << 8) == GZIPInputStream.GZIP_MAGIC) { + in.reset(); + in = new GZIPInputStream(in); + } else { + in.reset(); + } + + } segment.parseSegment(in); return segment; } @@ -796,18 +807,19 @@ // look through each method int codeBands = 0; AttributeLayout layout = attributeDefinitionMap.getAttributeLayout( - AttributeLayout.ATTRIBUTE_CODE, - AttributeLayout.CONTEXT_METHOD); + AttributeLayout.ATTRIBUTE_CODE, AttributeLayout.CONTEXT_METHOD); for (int i = 0; i < classCount; i++) { for (int j = 0; j < methodFlags[i].length; j++) { long flag = methodFlags[i][j]; - if (layout.matches(flag)) + if (layout.matches(flag)) codeBands++; } } if (codeBands > 0) - throw new Error("Can't handle non-abstract, non-native methods/initializers at the moment (found " + codeBands + " code bands)"); + throw new Error( + "Can't handle non-abstract, non-native methods/initializers at the moment (found " + + codeBands + " code bands)"); debug("unimplemented code_headers"); debug("unimplemented code_max_stack"); debug("unimplemented code_max_na_locals"); Index: /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/.settings/org.eclipse.jdt.ui.prefs (revision 0) +++ /Users/alex/Documents/Harmony/Workspace/Harmony/trunk/modules/pack200/.settings/org.eclipse.jdt.ui.prefs (revision 0) @@ -0,0 +1,50 @@ +#Sun Feb 11 23:16:33 GMT 2007 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=false +sp_cleanup.remove_trailing_whitespaces_ignore_empty=true +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=true +sp_cleanup.sort_members_all=true +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true