net/src/main/java/com/stanfy/enroscar/rest/request/net/multipart/Part.java
public static long getLengthOfParts(final Part[] parts, final byte[] partBoundary) throws IOException {
    if (DEBUG) { Log.v(TAG, "getLengthOfParts(Parts[])"); }
    if (parts == null) {
      throw new IllegalArgumentException("Parts may not be null");
    }
    long total = 0;
    for (int i = 0; i < parts.length; i++) {
      // set the part boundary before we calculate the part's length
      parts[i].setPartBoundary(partBoundary);
      final long l = parts[i].length();
      if (l < 0) {
        return -1;
      }
      total += l;
    }
    total += EXTRA_BYTES.length;
    total += partBoundary.length;
    total += EXTRA_BYTES.length;
    total += CRLF_BYTES.length;
    return total;
  }
public static long getLengthOfParts(final Part[] parts, final byte[] partBoundary) throws IOException {
    if (DEBUG) { Log.v(TAG, "getLengthOfParts(Parts[])"); }
    if (parts == null) {
      throw new IllegalArgumentException("Parts may not be null");
    }
    long total = 0;
    for (int i = 0; i < parts.length; i++) {
      // set the part boundary before we calculate the part's length
      parts[i].setPartBoundary(partBoundary);
      final long l = parts[i].length();
      if (l < 0) {
        return -1;
      }
      total += l;
    }
    total += EXTRA_BYTES.length;
    total += partBoundary.length;
    total += EXTRA_BYTES.length;
    total += CRLF_BYTES.length;
    return total;
  }
public static long getLengthOfParts ( final Part [ ] parts , final byte [ ] partBoundary ) throws IOException { if ( DEBUG ) { Log . v ( TAG , "getLengthOfParts(Parts[])" ) ; } if ( parts == null ) { throw new IllegalArgumentException ( "Parts may not be null" ) ; } long total = 0 ; for ( int i = 0 ; i < parts . length ; i ++ ) { // set the part boundary before we calculate the part's length parts [ i ] . setPartBoundary ( partBoundary ) ; final long l = parts [ i ] . length ( ) ; if ( l < 0 ) { return - 1 ; } total += l ; } total += EXTRA_BYTES . length ; total += partBoundary . length ; total += EXTRA_BYTES . length ; total += CRLF_BYTES . length ; return total ; }
Gets the length of the multipart message including the given parts.

@param parts The parts.
@param partBoundary The ASCII bytes to use as the part boundary.
@return The total length

@throws IOException If an I/O error occurs while writing the parts.

@since 3.0
Gets the length of the multipart message including the given parts .