Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4416800

ImageInputStreamImpl.readBits sets bitOffset incorrectly on exit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • beta
    • generic
    • solaris_7

      .The followuing progam should print:

      1
      0

      but instead it prints

      1
      64

      import java.io.*;
      import javax.imageio.stream.*;

      public class Test
      {
          public static void main(String[] args) throws IOException
          {
              byte[] buffer=new byte[] {(byte)0, (byte)128};
              InputStream ins=new ByteArrayInputStream(buffer);
              ImageInputStream in=new FileCacheImageInputStream(ins,null);
              System.out.println(in.readBits(9));
              System.out.println(in.readBits(7));
              in.close();
          }
      }

      The test program was contributed by Martin Desruisseaux on the
      java-imageio-interest mailing list.

      A standard regression test will be placed in test/javax/imageio/ReadBitsTest.java.

            dricesunw Daniel Rice (Inactive)
            dricesunw Daniel Rice (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: