private static String [ ] splitMultipartHeaderValues ( String svalue ) { List < String > values = InternalThreadLocalMap . get ( ) . arrayList ( 1 ) ; boolean inQuote = false ; boolean escapeNext = false ; int start = 0 ; for ( int i = 0 ; i < svalue . length ( ) ; i ++ ) { char c = svalue . charAt ( i ) ; if ( inQuote ) { if ( escapeNext ) { escapeNext = false ; } else { if ( c == ' ' ) { escapeNext = true ; } else if ( c == ' ' ) { inQuote = false ; } } } else { if ( c == ' ' ) { inQuote = true ; } else if ( c == ' ' ) { values . add ( svalue . substring ( start , i ) ) ; start = i + 1 ; } } } values . add ( svalue . substring ( start ) ) ; return values . toArray ( new String [ 0 ] ) ; }
Split one header value in Multipart