Results 1 to 5 of 5
Thread: Image reading from URL problem
- 04-18-2009, 03:55 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 8
- Rep Power
- 0
Image reading from URL problem
I have an image that I need to read from a URL.
However, I want to make it so that this can be interrupted anytime I want, even if it's in the middle of reading an image, for performance reasons.
I am using ImageIO.read(), which seems to be a blocking operation.
Is there any solution that can fix this problem?
thank you
-paras
- 04-18-2009, 04:46 AM #2
Do you want to be able to interrupt the download or the conversion?
For the former you can first read the data into a ByteBuffer or similar in chunks, then call ImageIO.read() on a stream from the buffer once all the data has been downloaded.Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-18-2009, 04:55 AM #3
Member
- Join Date
- Apr 2009
- Posts
- 8
- Rep Power
- 0
yep, it's a download
thank you :)
I will try this solution.
Just 1 question, though
How would I get a stream from the buffer?
- 04-18-2009, 06:44 AM #4
ByteArrayInputStream and ByteArrayOutputStream can be used with just a regular byte[].
Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
How To Ask Questions The Smart Way
- 04-18-2009, 07:26 AM #5
Member
- Join Date
- Apr 2009
- Posts
- 8
- Rep Power
- 0
Similar Threads
-
[SOLVED] Image reading from URL problem
By paras in forum New To JavaReplies: 3Last Post: 04-18-2009, 05:11 AM -
Weird path problem when reading properties file
By jerry_popperq in forum New To JavaReplies: 0Last Post: 03-18-2009, 03:32 PM -
Problem with reading text from a .txt file
By Gigi in forum New To JavaReplies: 40Last Post: 01-22-2009, 03:22 AM -
reading textfile from java problem
By saytri in forum New To JavaReplies: 1Last Post: 01-17-2008, 02:13 AM -
Problem reading an xml file with AJAX
By Fiona80 in forum XMLReplies: 0Last Post: 12-17-2007, 08:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks