ImageIO, Can I read images upper of 100KByte ?

M

Max

Hello ,
I have i byte[] of 120KByte ;

this byte[] is an Image in JPEG format .
I want to display this image on the video but I can't convert the byte[] in
BufferedImage :-(

I have try in this way :

// get the 100KByte of image as byte[]
byte[] message = this.returnMyImageAsByte();

long size = 100*1024;

// create new FileInputStream
FileInputStream myI = new FileInputStream (new FileDescriptor());

// popolate the byte[] , 100*1024byte is the size of image !
myI.read(message,0, size);

// create bufferedImage
BufferedImage myBI = ImageIO.read(myI);
=======================================

the crash is that myI.read() accept

(byte[] , int , int) // RIGHT !

but 100*1024 is a long

(byte[], int , long) // WRONG !

In witch way i can show the image ??!

best regard,
max
 
D

David Zimmerman

Max said:
but 100*1024 is a long

You may be thinking of the old C int which was 16 bits ( on some
platforms), or -32768 to +32767. The java int type is 32 bits long, or
about -2 billion to +2 billion. Some what larger than 102,400. The long
type is 64 bits, which is much, much bigger, about -8E18 to +8E18
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top