harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r721077 [8/12] - in /harmony/enhanced/classlib/branches/java6: ./ depends/files/ depends/jars/ depends/manifests/asm-3.1/ depends/manifests/asm-3.1/META-INF/ depends/manifests/bcel-5.2/ make/ modules/accessibility/ modules/accessibility/src...
Date Thu, 27 Nov 2008 05:10:42 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1025.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1025.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1025.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1025.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1025 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -151,7 +152,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -344,4 +345,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1097.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1097.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1097.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1097.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1097 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -151,7 +152,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -378,4 +379,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,-1,-1,3,-1,-1,4,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1098.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1098.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1098.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1098.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1098 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -164,7 +165,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -408,4 +409,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,-1,-1,4,-1,-1,5,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1112.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1112.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1112.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1112.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1112 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -151,7 +152,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -344,4 +345,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1122.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1122.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1122.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1122.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1122 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -151,7 +152,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -327,4 +328,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1123.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1123.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1123.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1123.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1123 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -151,7 +152,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -344,4 +345,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1124.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1124.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1124.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM1124.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM1124 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -131,7 +132,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -324,4 +325,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM737.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM737.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM737.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM737.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM737 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -148,7 +149,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -375,4 +376,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM856.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM856.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM856.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM856.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM856 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -164,7 +165,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -374,4 +375,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM874.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM874.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM874.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM874.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM874 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -164,7 +165,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -340,4 +341,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM875.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM875.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM875.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM875.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM875 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -167,7 +168,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -360,4 +361,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM922.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM922.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM922.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_IBM922.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_IBM922 extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -125,7 +126,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -301,4 +302,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MS950_HKSCS.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MS950_HKSCS.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MS950_HKSCS.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MS950_HKSCS.java Wed Nov 26 21:10:32 2008
@@ -17,13 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
+
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_MS950_HKSCS extends Charset {
 
@@ -54,7 +56,7 @@
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                     int cbRemaining = cb.remaining();
-                    if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+                    if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
                         int cbPos = cb.position();
                         int bbPos = bb.position();
                         int[] res = {bb.remaining(), cbRemaining, 0, 0};
@@ -304,7 +306,7 @@
 
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                   int bbRemaining = bb.remaining();
-                  if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                  if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
                       int toProceed = (bbRemaining < cb.remaining()) ? bbRemaining : cb.remaining();
                       int cbPos = cb.position();
                       int bbPos = bb.position();
@@ -604,4 +606,4 @@
         };
 
 	}
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacCyrillic.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacCyrillic.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacCyrillic.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacCyrillic.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_MacCyrillic extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -135,7 +136,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -379,4 +380,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacGreek.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacGreek.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacGreek.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacGreek.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_MacGreek extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -135,7 +136,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -396,4 +397,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacTurkish.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacTurkish.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacTurkish.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_MacTurkish.java Wed Nov 26 21:10:32 2008
@@ -17,14 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
 
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_MacTurkish extends Charset {
 
@@ -50,12 +51,12 @@
 
 		}
 
-		public native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
+		private native int nDecode(char[] array, int arrPosition, int remaining, long outAddr, int absolutePos);
 
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                         int cbRemaining = cb.remaining();
-		        if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+		        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
 		            int toProceed = bb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -135,7 +136,7 @@
                                                                                                                           
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                         int bbRemaining = bb.remaining();
-                        if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                        if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
 		            int toProceed = cb.remaining();
 		            int cbPos = cb.position();
 		            int bbPos = bb.position();
@@ -430,4 +431,4 @@
                  -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,-1,-1,-1,-1,-1,-1,-1
                 };
 	}         
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/charset/additional/x_windows_949.java Wed Nov 26 21:10:32 2008
@@ -17,13 +17,15 @@
 
 package org.apache.harmony.niochar.charset.additional;
 
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
 import java.nio.charset.Charset;
-import java.nio.charset.CoderResult;
 import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
-import java.nio.CharBuffer;
-import java.nio.ByteBuffer;
+import java.nio.charset.CoderResult;
+
 import org.apache.harmony.nio.AddressUtil;
+import org.apache.harmony.niochar.CharsetProviderImpl;
 
 public class x_windows_949 extends Charset {
 
@@ -54,7 +56,7 @@
 
 		protected CoderResult decodeLoop(ByteBuffer bb, CharBuffer cb){
                     int cbRemaining = cb.remaining();
-                    if(bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
+                    if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && bb.hasRemaining() && cb.hasArray()){
                         int cbPos = cb.position();
                         int bbPos = bb.position();
                         int[] res = {bb.remaining(), cbRemaining, 0, 0};
@@ -311,7 +313,7 @@
 
 		protected CoderResult encodeLoop(CharBuffer cb, ByteBuffer bb){
                   int bbRemaining = bb.remaining();
-                  if(bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
+                  if(CharsetProviderImpl.hasLoadedNatives() && bb.isDirect() && cb.hasRemaining() && cb.hasArray()){
                       int toProceed = (bbRemaining < cb.remaining()) ? bbRemaining : cb.remaining();
                       int cbPos = cb.position();
                       int bbPos = bb.position();
@@ -608,4 +610,4 @@
         };
 
 	}
-}
\ No newline at end of file
+}

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/java.nio.charset.spi.CharsetProvider
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/java.nio.charset.spi.CharsetProvider?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/java.nio.charset.spi.CharsetProvider (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/java.nio.charset.spi.CharsetProvider Wed Nov 26 21:10:32 2008
@@ -1,2 +1,2 @@
 # NIO charset SPI extended charset provider
-com.ibm.icu.charset.CharsetProviderICU
+org.apache.harmony.niochar.CharsetProviderImpl

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/java/org/apache/harmony/niochar/java.nio.charset.spi.CharsetProvider
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Nov 26 21:10:32 2008
@@ -2,4 +2,4 @@
 *.map
 *.pdb
 *.manifest
-libhycharset.so
+libhyniochar.so

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/shared/additional/GB18030.c Wed Nov 26 21:10:32 2008
@@ -17,11 +17,12 @@
 
 #include "GB18030.h"
 #include "hycomp.h"
+#include "vmi.h"
 
 #define linear(b1, b2, b3, b4) ((((b1)*10+(b2))*126L+(b3))*10L+(b4))
-static jbyte * unLinear(jint lin) {
-                jbyte arr[] = {0, 0, 0, 0};
-	        jbyte *result = arr;
+static jbyte* unLinear(JNIEnv *env, jint lin) {
+            PORT_ACCESS_FROM_ENV(env);
+	        jbyte *result = hymem_allocate_memory(sizeof(jbyte)*4);
 	        lin-=linear((jbyte)0x81, (jbyte)0x30, (jbyte)0x81, (jbyte)0x30); 
 	        result[3]=(jbyte)(0x30+lin%10);  lin/=10;
 	        result[2]=(jbyte)(0x81+lin%126); lin/=126;
@@ -1158,14 +1159,14 @@
 	        return -1;
 }
 
-static jbyte * getBytesFromUnicode(jint charValue) {
+static jbyte* getBytesFromUnicode(JNIEnv *env, jint charValue) {
 	        int rangeCounter = 0;
 	        while(rangeCounter < sizeof(ranges)){
 	        	int startBytes = ranges[rangeCounter++];
 	        	int length = ranges[rangeCounter++];
 	        	int startChar = charValues[rangeCounter/2-1];
 	            if(startChar<=charValue && charValue<=startChar+length) {
-	                return unLinear(startBytes+(charValue-startChar));
+	                return unLinear(env, startBytes+(charValue-startChar));
 	            }
 	        }
 	        return NULL;
@@ -1182,9 +1183,9 @@
    jchar *out = (*env)->GetCharArrayElements(env, outArr, NULL);
 
    jint *res = (*env)->GetIntArrayElements(env, result, NULL);
-   jint position = absolutePos;	
+   jint resultChar, position = absolutePos;	
    int i, variable; 
-   jchar input,  resultChar; 
+   jchar input; 
    jbyte b1, b2, b3, b4;
    for(i=0; i < bbremaining; i++) {
         if(res[1]==0) {
@@ -1245,7 +1246,7 @@
                break;
             }
             if (resultChar != 0) {
-                out[arrPosition++] = resultChar; res[1] -= 1;
+                out[arrPosition++] = (jchar)resultChar; res[1] -= 1;
             } else {
                	if(!( (126 >= b2 && b2 >= 64) || (-2 >= b2 && b2 >= -128) || (57 >= b2 && b2 >= 48)) ) {
                	       res[0] = res[0]+2; 
@@ -1280,7 +1281,7 @@
                         resultChar = getUnicodeFromBytes(b1, b2, b3, b4);
                 	if(resultChar != -1) {
                 	        res[0] -=4;
-                                out[arrPosition++] = resultChar; res[1] -= 1;
+                                out[arrPosition++] = (jchar)resultChar; res[1] -= 1;
                 	} else {
                         	res[2] = 4; res[3] = -1;
                                 (*env)->ReleaseCharArrayElements(env, outArr, out, 0); 
@@ -1324,7 +1325,7 @@
              index = (int)input >> 8;
              index = encodeIndex[index];
              while(index < 0) {
-               jbyte *arr = getBytesFromUnicode(in[arrayOffset+i]);
+               jbyte *arr = getBytesFromUnicode(env, in[arrayOffset+i]);
                if(arr!= NULL) {
                	if(res[0]>=4) {
                     *(jlong2addr(jbyte, outAddr) + position++) = (jbyte)arr[0];
@@ -1391,7 +1392,7 @@
                  }
                  *(jlong2addr(jbyte, outAddr) + position++) = (jbyte)(resultChar & 0xFF);  res[0] -= 1;
              } else {
-               jbyte *arr = getBytesFromUnicode(in[arrayOffset+i]);
+               jbyte *arr = getBytesFromUnicode(env, in[arrayOffset+i]);
                if(arr!= NULL) {
                	if(res[0]>=4) {
                     *(jlong2addr(jbyte, outAddr) + position++) = arr[0];

Propchange: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Nov 26 21:10:32 2008
@@ -1 +1 @@
-libhycharset.exp
+libhyniochar.exp

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/unix/makefile Wed Nov 26 21:10:32 2008
@@ -115,6 +115,8 @@
   ../shared/additional/x_windows_949.o 
 
 
-DLLNAME = ../libhycharset.so
+DLLNAME = ../libhyniochar.so
+
+MDLLIBFILES += $(LIBPATH)libvmi$(HY_LINKLIB_SUFFIX)
 
 include $(HY_HDK)/build/make/rules.mk

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/hynio_char.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/hynio_char.rc?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/hynio_char.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/hynio_char.rc Wed Nov 26 21:10:32 2008
@@ -32,11 +32,11 @@
 		BLOCK "040904b0"
 		BEGIN
 			VALUE "CompanyName", "The Apache Software Foundation.\0"
-			VALUE "FileDescription", "Charsets native code\0"
+			VALUE "FileDescription", "NIO charsets native code\0"
 			VALUE "FileVersion", "0.1\0"
 			VALUE "InternalName", "nio_char\0"
-			VALUE "LegalCopyright", "(c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.\0"
-			VALUE "OriginalFilename", "hycharset.dll\0"
+			VALUE "LegalCopyright", "(c) Copyright 1991, 2008 The Apache Software Foundation or its licensors, as applicable.\0"
+			VALUE "OriginalFilename", "hyniochar.dll\0"
 			VALUE "ProductName", "Apache Harmony\0"
 			VALUE "ProductVersion", "0.1\0"
 		END

Modified: harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/nio_char/src/main/native/niochar/windows/makefile Wed Nov 26 21:10:32 2008
@@ -19,7 +19,7 @@
 
 !include <$(HY_HDK)\build\make\defines.mak>
 
-LIBBASE=hycharset
+LIBBASE=hyniochar
 DLLNAME=..\$(LIBBASE).dll
 LIBNAME=$(LIBPATH)$(LIBBASE).lib
 HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB) /I$(SHARED)common /I$(SHARED)fdlibm
@@ -121,6 +121,6 @@
 
   
 DLLBASE=0x13200000
-COMMENT=/comment:"nio_char component native code. (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable."
+COMMENT=/comment:"nio_char component native code. (c) Copyright 1991, 2008 The Apache Software Foundation or its licensors, as applicable."
 
 !include <$(HY_HDK)\build\make\rules.mak>

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/.classpath
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/.classpath?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/.classpath (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/.classpath Wed Nov 26 21:10:32 2008
@@ -4,7 +4,7 @@
 	<classpathentry kind="src" output="bin/test" path="src/test/java"/>
 	<classpathentry kind="src" output="bin/test" path="src/test/resources"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-	<classpathentry kind="var" path="JUNIT_HOME/junit.jar" sourcepath="JUNIT_SRC_HOME/junitsrc.zip"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
 	<classpathentry kind="output" path="bin/main"/>
 </classpath>

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/META-INF/MANIFEST.MF?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/META-INF/MANIFEST.MF Wed Nov 26 21:10:32 2008
@@ -13,11 +13,9 @@
 Eclipse-JREBundle: true
 Import-Package: java.io;resolution:=optional,
  java.lang;resolution:=optional,
- java.nio,
  java.util;resolution:=optional,
  java.util.jar;resolution:=optional,
- org.apache.bcel,
- org.apache.bcel.classfile
+ org.objectweb.asm
 Export-Package: org.apache.harmony.pack200,
  org.apache.harmony.pack200.bytecode,
  org.apache.harmony.unpack200,

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/Archive.java Wed Nov 26 21:10:32 2008
@@ -16,7 +16,9 @@
  */
 package org.apache.harmony.pack200;
 
+import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -26,9 +28,10 @@
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarInputStream;
+import java.util.jar.Manifest;
+import java.util.zip.GZIPOutputStream;
 
-import org.apache.bcel.classfile.ClassParser;
-import org.apache.bcel.classfile.JavaClass;
+import org.objectweb.asm.ClassReader;
 
 
 /**
@@ -40,8 +43,11 @@
     private final OutputStream outputStream;
     private JarFile jarFile;
 
-    public Archive(JarInputStream inputStream, OutputStream outputStream) {
+    public Archive(JarInputStream inputStream, OutputStream outputStream, boolean gzip) throws IOException {
         this.inputStream = inputStream;
+        if(gzip) {
+            outputStream = new GZIPOutputStream(outputStream);
+        }
         this.outputStream = new BufferedOutputStream(outputStream);
     }
 
@@ -54,31 +60,73 @@
     public void pack() throws Pack200Exception, IOException {
         List classes = new ArrayList();
         List files = new ArrayList();
+        List classNames = new ArrayList();
+        List classModtimes = new ArrayList();
+        Manifest manifest = jarFile != null ? jarFile.getManifest() : inputStream.getManifest();
+        if(manifest!= null) {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            manifest.write(baos);
+            files.add(new File("META-INF/MANIFEST.MF", baos.toByteArray(), 0));
+        }
         if(inputStream != null) {
             while(inputStream.available() > 0) {
                 JarEntry jarEntry = inputStream.getNextJarEntry();
                 if(jarEntry != null) {
-                    addJarEntry(jarEntry, inputStream, classes, files);
+                    addJarEntry(jarEntry, new BufferedInputStream(inputStream), classes, files);
                 }
             }
         } else {
             Enumeration jarEntries = jarFile.entries();
             while(jarEntries.hasMoreElements()) {
                 JarEntry jarEntry = (JarEntry) jarEntries.nextElement();
-                addJarEntry(jarEntry, jarFile.getInputStream(jarEntry), classes, files);
+                addJarEntry(jarEntry, new BufferedInputStream(jarFile.getInputStream(jarEntry)), classes, files);
             }
         }
         new Segment().pack(classes, files, outputStream);  // TODO: Multiple segments
+        outputStream.close();
     }
 
     private void addJarEntry(JarEntry jarEntry, InputStream stream, List javaClasses, List files) throws IOException, Pack200Exception {
         String name = jarEntry.getName();
+        long size = jarEntry.getSize();
+        if (size > Integer.MAX_VALUE) {
+            throw new RuntimeException("Large Class!");
+        }
+        byte[] bytes = new byte[(int)size];
+        int read = stream.read(bytes);
+        if(read != size) {
+            throw new RuntimeException("Error reading from stream");
+        }
         if(name.endsWith(".class")) {
-            ClassParser classParser = new ClassParser(stream, name);
-            JavaClass javaClass = classParser.parse();
-            javaClasses.add(javaClass);
-        } else {
-            // TODO: it's a file...
+            ClassReader classParser = new Pack200ClassReader(bytes);
+            javaClasses.add(classParser);
+            bytes = new byte[0];
+        }
+        files.add(new File(name, bytes, jarEntry.getTime()));
+    }
+
+    static class File {
+
+        private final String name;
+        private final byte[] contents;
+        private final long modtime;
+
+        public File(String name, byte[] contents, long modtime) {
+            this.name = name;
+            this.contents = contents;
+            this.modtime = modtime;
+        }
+
+        public byte[] getContents() {
+            return contents;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public long getModtime() {
+            return modtime;
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/AttributeDefinitionBands.java Wed Nov 26 21:10:32 2008
@@ -24,11 +24,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.bcel.classfile.Field;
-import org.apache.bcel.classfile.JavaClass;
-import org.apache.bcel.classfile.Method;
-import org.apache.bcel.classfile.Unknown;
-
 /**
  * Attribute Definition bands define how any unknown attributes should be
  * read by the decompressor.
@@ -105,9 +100,9 @@
             attributeDefinitionLayout[i] = cpBands.getCPUtf8(def.layout).getIndex();
         }
 
-        out.write(encodeBandInt(attributeDefinitionHeader, Codec.BYTE1));
-        out.write(encodeBandInt(attributeDefinitionName, Codec.UNSIGNED5));
-        out.write(encodeBandInt(attributeDefinitionLayout, Codec.UNSIGNED5));
+        out.write(encodeBandInt("attributeDefinitionHeader", attributeDefinitionHeader, Codec.BYTE1));
+        out.write(encodeBandInt("attributeDefinitionName", attributeDefinitionName, Codec.UNSIGNED5));
+        out.write(encodeBandInt("attributeDefinitionLayout", attributeDefinitionLayout, Codec.UNSIGNED5));
     }
 
     private int[] addHighIndices(int[] availableIndices) {
@@ -138,26 +133,6 @@
         layouts.put(name, layout);
     }
 
-    public void addUnknownAttribute(Unknown attribute, Object parent) {
-        Map map;
-        if(parent instanceof JavaClass) {
-            map = classAttributes;
-        } else if (parent instanceof Method) {
-            map = methodAttributes;
-        } else if (parent instanceof Field) {
-            map = fieldAttributes;
-        } else {
-            map = codeAttributes;
-        }
-        String name = attribute.getName();
-        List attributes = (List) map.get(name);
-        if(attributes == null) {
-            attributes = new ArrayList();
-            map.put(name, attributes);
-        }
-        attributes.add(attribute);
-    }
-
     private static class AttributeDefinition {
 
         public int index;
@@ -174,10 +149,4 @@
         }
 
     }
-
-    public int getIndex(Unknown attr) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BHSDCodec.java Wed Nov 26 21:10:32 2008
@@ -115,7 +115,7 @@
     /**
      * radix^i powers
      */
-    private long[] powers;
+    private final long[] powers;
 
     /**
      * Constructs an unsigned, non-delta Codec with the given B and H values.
@@ -276,10 +276,11 @@
         if (isDelta()) {
             value -= last;
         }
-        if (!encodes(value)) {
-            throw new Pack200Exception("The codec " + toString()
-                    + " does not encode the value " + value);
-        }
+        // TODO: Do we need this?  this implementation isn't right because of integer overflow...
+//        if (!encodes(value)) {
+//            throw new Pack200Exception("The codec " + toString()
+//                   + " does not encode the value " + value);
+//        }
         long z = value;
         if (isSigned()) {
             if (z < 0) {
@@ -440,4 +441,16 @@
     public int getL() {
         return l;
     }
+
+    public boolean equals(Object o) {
+        if(!(o instanceof BHSDCodec)) {
+            return false;
+        }
+        BHSDCodec codec = (BHSDCodec) o;
+        return codec.b == b && codec.h == h && codec.s == s && codec.d == d;
+    }
+
+    public int hashCode() {
+        return ((b* 37 + h) * 37 + s) * 37 + d;
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java?rev=721077&r1=721076&r2=721077&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/pack200/src/main/java/org/apache/harmony/pack200/BandSet.java Wed Nov 26 21:10:32 2008
@@ -33,30 +33,55 @@
         return codec.encode(value);
     }
 
-    public byte[] encodeBandInt(int[] ints, Codec defaultCodec) throws Pack200Exception {
+    public byte[] encodeBandInt(String name, int[] ints, BHSDCodec defaultCodec) throws Pack200Exception {
         // TODO non-default codecs
-        return defaultCodec.encode(ints);
+        if(ints.length > 0) {
+//            System.out.println("encoding " + name + ", size = " + ints.length);
+            int first = ints[0];
+            if(defaultCodec.getB() != 1) {
+                if (defaultCodec.isSigned() && first >= -256 && first <= -1) {
+                    int specifier = -1 - CodecEncoding.getSpecifierForDefaultCodec(defaultCodec);
+                    byte[] specifierEncoded = defaultCodec.encode(new int[] {specifier});
+                    byte[] rest = defaultCodec.encode(ints);
+                    byte[] band = new byte[specifierEncoded.length + rest.length];
+                    System.arraycopy(specifierEncoded, 0, band, 0, specifierEncoded.length);
+                    System.arraycopy(rest, 0, band, specifierEncoded.length, rest.length);
+                    return band;
+                } else if (!defaultCodec.isSigned() && first >= defaultCodec.getL()
+                        && first <= defaultCodec.getL() + 255) {
+                    int specifier = CodecEncoding.getSpecifierForDefaultCodec(defaultCodec) + defaultCodec.getL();
+                    byte[] specifierEncoded = defaultCodec.encode(new int[] {specifier});
+                    byte[] rest = defaultCodec.encode(ints);
+                    byte[] band = new byte[specifierEncoded.length + rest.length];
+                    System.arraycopy(specifierEncoded, 0, band, 0, specifierEncoded.length);
+                    System.arraycopy(rest, 0, band, specifierEncoded.length, rest.length);
+                    return band;
+                }
+            }
+            return defaultCodec.encode(ints);
+        }
+        return new byte[0];
     }
 
     public boolean isPredictableSourceFileName(String className, String sourceFileName) {
-        if (className.indexOf(".") != -1) {
-            className = className.substring(className.lastIndexOf(".") + 1);
+        if (className.indexOf('.') != -1) {
+            className = className.substring(className.lastIndexOf('.') + 1);
         }
-        if (className.indexOf("$") != -1) {
-            className = className.substring(0, className.indexOf("$"));
+        if (className.indexOf('$') != -1) {
+            className = className.substring(0, className.indexOf('$'));
         }
         className += ".java";
         return className.equals(sourceFileName);
     }
 
-    protected byte[] encodeFlags(long[] flags, BHSDCodec loCodec, BHSDCodec hiCodec,
+    protected byte[] encodeFlags(String name, long[] flags, BHSDCodec loCodec, BHSDCodec hiCodec,
             boolean haveHiFlags) throws Pack200Exception {
         if(!haveHiFlags) {
             int[] loBits = new int[flags.length];
             for (int i = 0; i < flags.length; i++) {
                 loBits[i] = (int) flags[i];
             }
-            return encodeBandInt(loBits, loCodec);
+            return encodeBandInt(name, loBits, loCodec);
         } else {
 
             int[] hiBits = new int[flags.length];
@@ -66,8 +91,8 @@
                 hiBits[i] = (int) (l >> 32);
                 loBits[i] = (int) l;
             }
-            byte[] hi = encodeBandInt(hiBits, hiCodec);
-            byte[] lo = encodeBandInt(loBits, loCodec);
+            byte[] hi = encodeBandInt(name, hiBits, hiCodec);
+            byte[] lo = encodeBandInt(name, loBits, loCodec);
             byte[] total = new byte[hi.length + lo.length];
             System.arraycopy(hi, 0, total, 0, hi.length);
             System.arraycopy(lo, 0, total, hi.length + 1, lo.length);
@@ -95,6 +120,9 @@
         int[] array = new int[list.size()];
         for (int i = 0; i < array.length; i++) {
             array[i] = ((ConstantPoolEntry)list.get(i)).getIndex();
+            if(array[i] < 0) {
+                throw new RuntimeException("Index should be > 0");
+            }
         }
         return array;
     }
@@ -104,8 +132,32 @@
         for (int j = 0; j < array.length; j++) {
             ConstantPoolEntry cpEntry = (ConstantPoolEntry) theList.get(j);
             array[j] = cpEntry == null ? 0 : cpEntry.getIndex() + 1;
+            if(cpEntry != null && cpEntry.getIndex() < 0) {
+                throw new RuntimeException("Index should be > 0");
+            }
         }
         return array;
     }
 
+    protected byte[] encodeFlags(String name, long[][] flags, BHSDCodec loCodec, BHSDCodec hiCodec,
+            boolean haveHiFlags) throws Pack200Exception {
+        return encodeFlags(name, flatten(flags), loCodec, hiCodec, haveHiFlags);
+   }
+
+    private long[] flatten(long[][] flags) {
+        int totalSize = 0;
+        for (int i = 0; i < flags.length; i++) {
+            totalSize += flags[i].length;
+        }
+        long[] flatArray = new long[totalSize];
+        int index = 0;
+        for (int i = 0; i < flags.length; i++) {
+            for (int j = 0; j < flags[i].length; j++) {
+                flatArray[index] = flags[i][j];
+                index++;
+            }
+        }
+        return flatArray;
+    }
+
 }



Mime
View raw message