Again use a `ByteArrayOutputStream' again, do not use
`byte [] image_bytes = new byte[is.available]' !

THIS IS PURE PROTOTYPE, check the API

BufferedInputStream bis = new BufferedInputStream( <YOUR>-InputStream );
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte [] raw_data = null;
try {
    byte [] buffer = new byte[8192];    // 8K
    int nread;
    int total = 0;
    while (  (  nread = bis.read( buffer ) ) > 0 ) {
        baos.write( buffer, 0, nread );
        total += nread;
    }
    raw_data = baos.getBytes();
}
catch (IOException ioe) {
    System.err.println(ioe.getMessage());
    raw_data = null;
}

You guaranteed to have __all__ the raw data or none of it,
be it GIF/JPEG , or HTML or Java class file,
if following this idiom.

[EMAIL PROTECTED] wrote:

> hi,
>
>         i want to load a image into my applet application i used getimage
> to get a image in the init() and used drawimage to draw it in the paint
> and i gave the filename in the html file. But it is giving some
> nullpointer exception in the java console of the netscape. can anybody
> help me.
>
> thanx in advance,
>
> MUTHU.


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to