private Blob assembleBlob() throws IOException {
    if (packets.length == 0) {
      return new Blob();
    }

    if (packets.length == 1) {
      return packets[0].getContent();
    }

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    for (Data packet : packets) {
      stream.write(packet.getContent().getImmutableArray());
    }
    return new Blob(stream.toByteArray());
  }
private Blob assembleBlob ( ) throws IOException { if ( packets . length == 0 ) { return new Blob ( ) ; } if ( packets . length == 1 ) { return packets [ 0 ] . getContent ( ) ; } ByteArrayOutputStream stream = new ByteArrayOutputStream ( ) ; for ( Data packet : packets ) { stream . write ( packet . getContent ( ) . getImmutableArray ( ) ) ; } return new Blob ( stream . toByteArray ( ) ) ; }
@return the concatenated bytes
@throws IOException if a stream fails