jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java
changeset 3012 1420628f14e4
parent 2 90ce3da70b43
child 5506 202f599c92aa
--- a/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Thu Jun 11 13:47:42 2009 +0400
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Thu Jun 11 14:22:33 2009 +0400
@@ -45,6 +45,7 @@
 import java.util.Iterator;
 
 import com.sun.imageio.plugins.common.I18N;
+import com.sun.imageio.plugins.common.ReaderUtil;
 
 /** This class is the Java Image IO plugin reader for WBMP images.
  *  It may subsample the image, clip the image,
@@ -141,11 +142,11 @@
         metadata.wbmpType = wbmpType;
 
         // Read image width
-        width = readMultiByteInteger();
+        width = ReaderUtil.readMultiByteInteger(iis);
         metadata.width = width;
 
         // Read image height
-        height = readMultiByteInteger();
+        height = ReaderUtil.readMultiByteInteger(iis);
         metadata.height = height;
 
         gotHeader = true;
@@ -311,17 +312,6 @@
         gotHeader = false;
     }
 
-    private int readMultiByteInteger() throws IOException {
-        int value = iis.readByte();
-        int result = value & 0x7f;
-        while((value & 0x80) == 0x80) {
-            result <<= 7;
-            value = iis.readByte();
-            result |= (value & 0x7f);
-        }
-        return result;
-    }
-
     /*
      * This method verifies that given byte is valid wbmp type marker.
      * At the moment only 0x0 marker is described by wbmp spec.