ImageIO, Can I read images upper of 100KByte ?

Discussion in 'Java' started by Max, Mar 5, 2004.

  1. Max

    Max Guest

    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
    Max, Mar 5, 2004
    #1
    1. Advertising

  2. Max wrote:
    >
    > 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
    David Zimmerman, Mar 7, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. F C
    Replies:
    2
    Views:
    5,133
  2. Davidski
    Replies:
    0
    Views:
    3,870
    Davidski
    Nov 5, 2004
  3. Enric Tordera
    Replies:
    0
    Views:
    544
    Enric Tordera
    Oct 13, 2006
  4. Subha
    Replies:
    2
    Views:
    1,929
  5. BlackHelicopter
    Replies:
    0
    Views:
    502
    BlackHelicopter
    Jan 31, 2013
Loading...

Share This Page