Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8386961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:05:11+00:00 2026-06-09T18:05:11+00:00

Has anyone ever had an issue with Loading JPEG files in java? One of

  • 0

Has anyone ever had an issue with Loading JPEG files in java? One of our clients is sending files that cannot be resolved, but these same files can be opened in windows. (the other 99% of jpeg files we recieve, process without any problems)

I have tried a couple of libraries to read these:

itextpdf : com.itextpdf.text.Jpeg (getInstance(imageData) - gives  "java.io.IOException: Premature EOF while reading JPG."
sanselan : org.apache.sanselan.ImageInfo ( Sanselan.getImageInfo(imageData) gives "java.io.IOException: Invalid Segment: insufficient data")
where imageData is a byte[]

The errors here suggest to me that the jpegs are broken, however, this does not explain why they are still viewable.

If anyone has any suggestions, I would be most grateful

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:05:12+00:00Added an answer on June 9, 2026 at 6:05 pm

    The “solution” I have gone for is to run the byte array we recieve through our current process which identifies type. If this can’t identify the type, then I take the byte array and forcably save it to a JPEG. This can then be re read and pushed back through the current process.

    Bit hacky, but its just a work around for a couple of months.

    Thanks for everyone’s help here!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone ever heard of overriding too many classes in Java? Perhaps this issue
Has anyone ever had an issue with iPhone settings icons not updating with new
Has anyone ever used the hidden class PackageParser in Android source code with java
Has anyone ever run into this issue before? Sometimes the string displays, sometimes half
Has anyone ever tried sending emails using 1&1 smtp host? I tried the following?
I'm wondering if anyone has ever come across a plug-in for mootools that will
Has anyone ever had an incidence of downloading software from a genuine site, where
Has anyone ever had this happen? It appears to lock the browser up until
Has anyone ever had any luck figuring out how to add a comment to
Has anyone ever had experience embedding a field editor (for a NSTextField) inside a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.