public NetworkRequest build ( ) { if ( parts . isEmpty ( ) ) { throw new IllegalStateException ( "Multipart body must have at least one part." ) ; } MultipartRequest mrb = new MultipartRequest ( type , boundary , parts ) ; Buffer bb = new Buffer ( ) ; try { mrb . writeOrCountBytes ( bb , false ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return new NetworkRequest . Builder ( ) . setContentType ( mrb . contentType ( ) ) . setBody ( bb . readByteArray ( ) ) . build ( ) ; }
Assemble the specified parts into a request body .