http - How to read from CompositeChannelBuffer? -


during testing, loading jpg image browser netty based littleproxy sitting between server , client. while loading particular image. channel buffer of compositchannelbuffer. reading following way, not working.

if (chanbuff instanceof compositechannelbuffer) {      compositechannelbuffer compchanbuf = ((compositechannelbuffer) chanbuff);      int noofcomps = compchanbuf.numcomponents();     list<channelbuffer> bufflist = compchanbuf.decompose(0, noofcomps);      listiterator<channelbuffer> itr = bufflist.listiterator();     int offset = 0;     int bytesread = -1;      while (itr.hasnext()) {         channelbuffer buf = (channelbuffer) itr.next();         bytesread = buf.array().length;         outputstream.write(buf.array(), offset, bytesread);         offset += bytesread;     } } 

i tried below code, not able write file.

if (chanbuff instanceof compositechannelbuffer){      fileoutputstream outputstream = new fileoutputstream(outputfilename);      compositechannelbuffer compchanbuf = ((compositechannelbuffer) chanbuff);     int noofcomps = compchanbuf.numcomponents();      compchanbuf.getbytes(0, outputstream, noofcomps);      channelbuffer dynamicbuf = dynamicbuffer();     compchanbuf.getbytes(0, dynamicbuf);     array = dynamicbuf.array();      outputstream.write(array); } 

what correct way read compositchannelbuffer?

just other buffers like:

channelbuffer buf = ... outputstream out = ... buf.getbytes(0, out, buf.readablebytes()); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -