Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-104

ByteSourceInputStream not starting at byte 0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 0.97
    • 1.0-alpha1
    • Format: JPEG
    • None

    Description

      Following code results in a
      org.apache.sanselan.ImageReadException: Not a Valid JPEG File: doesn't begin with 0xffd8

      File file = new File(image.jpg);
      InputStream is = new FileInputStream(file);
      JpegImageParser parser = new JpegImageParser();
      ByteSource byteSource = new ByteSourceInputStream(is, "image.jpg");
      ArrayList<?> segments = parser.readSegments(byteSource, new int[]

      {0xffee}, true);

      But when I use the File instead of the InputStream:

      File file = new File(image.jpg);
      JpegImageParser parser = new JpegImageParser();
      ByteSource byteSource = new ByteSourceFile(file);
      ArrayList<?> segments = parser.readSegments(byteSource, new int[] {0xffee}

      , true);

      it works.

      When I look into the exception, the process starts to read from byte 1024 instead of byte 0 when checking the filetype.

      Attachments

        Activity

          People

            Unassigned Unassigned
            campforts Marc Campforts
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: