@@ -0,0 +1,2102 @@
+package jp.satorufujiwara.http.body;%0A%0Aimport android.text.TextUtils;%0A%0Aimport java.io.BufferedOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0Aimport java.io.UnsupportedEncodingException;%0Aimport java.net.URLEncoder;%0Aimport java.util.Map;%0A%0Aimport jp.satorufujiwara.http.RequestBody;%0A%0Apublic class UrlEncodedFormBody extends RequestBody %7B%0A%0A    private static final String DEFAULT_CHARSET = %22UTF-8%22;%0A    private final Map%3CString, String%3E params;%0A    private final String charSet;%0A%0A    public static UrlEncodedFormBody create(final Map%3CString, String%3E params) %7B%0A        return new UrlEncodedFormBody(params, DEFAULT_CHARSET);%0A    %7D%0A%0A    public static UrlEncodedFormBody create(final Map%3CString, String%3E params,%0A            final String charSet) %7B%0A        return new UrlEncodedFormBody(params, charSet);%0A    %7D%0A%0A    private UrlEncodedFormBody(final Map%3CString, String%3E params, String charSet) %7B%0A        this.params = params;%0A        this.charSet = charSet;%0A    %7D%0A%0A    @Override%0A    public String contentType() %7B%0A        return %22application/x-www-form-urlencoded; charset=%22 + charSet;%0A    %7D%0A%0A    @Override%0A    public void writeTo(BufferedOutputStream os) throws IOException %7B%0A        final PrintWriter writer = new PrintWriter(os);%0A        boolean isFirst = true;%0A        for (final Map.Entry%3CString, String%3E entry : params.entrySet()) %7B%0A            final String encodedName = encode(entry.getKey(), charSet);%0A            final String encodedValue = encode(entry.getValue(), charSet);%0A            if (!isFirst) %7B%0A                writer.append('&');%0A            %7D%0A            isFirst = false;%0A            writer.append(encodedName).append('=').append(encodedValue);%0A        %7D%0A        writer.flush();%0A    %7D%0A%0A    private static String encode(final String content, final String encoding) %7B%0A        if (TextUtils.isEmpty(content)) %7B%0A            return %22%22;%0A        %7D%0A        try %7B%0A            return URLEncoder.encode(content, encoding != null ? encoding : DEFAULT_CHARSET);%0A        %7D catch (UnsupportedEncodingException e) %7B%0A            throw new IllegalArgumentException(e);%0A        %7D%0A    %7D%0A%7D%0A

Add UrlEncodedFormBody