Http: http get images

xiaoxiao2021-03-06  54

...... DataInputStream istrm = conn.opendatainputstream (); byte imagedata [];

// If the picture size IF (Length! = -1) {imagedata = new byte [length];

// Read image data to imagedata array istrm.readfully (imagedata);

// Picture size is unknown} else {byterrayoutputstream bstrm = new byterrayoutputstream (); int Ch; while ((ch = istrm.read ())! = -1) BSTRM.WRITE (CH); imagedata = BSTRM.TOBYTEARRAY (); Bstrm.close ();

// Create a picture image = image.createImage (imagedata, 0, imagedata.length); ......

转载请注明原文地址:https://www.9cbs.com/read-115170.html

New Post(0)