// Path: ADNLibModule/src/main/java/com/alwaysallthetime/adnlib/QueryParameters.java
// public class QueryParameters extends HashMap<String, String> {
//     // very unlikely you'd ever need more than 4 query parameters on one request
//     private static final int INITIAL_CAPACITY = 4;
//     private static final float LOAD_FACTOR = 1.0f;
// 
//     /**
//      * Get a new QueryParameters that consists of two sets of QueryParamters combined.
//      *
//      * Since it is possible that there will be conflicting parameters, the second set will be applied
//      * "on top of" the first set, i.e. the topParameters can override the bottomParameters
//      *
//      * @param bottomParameters
//      * @param topParameters
//      * @return a new QueryParamters consisting of the values form both specified QueryParameters objects.
//      */
//     public static QueryParameters getCombinedParameters(QueryParameters bottomParameters, QueryParameters topParameters) {
//         QueryParameters newParams = new QueryParameters();
//         newParams.putAll(bottomParameters);
//         newParams.putAll(topParameters);
//         return newParams;
//     }
// 
//     public QueryParameters() {
//         this(INITIAL_CAPACITY, LOAD_FACTOR);
//     }
// 
//     protected QueryParameters(int capacity, float loadFactor) {
//         super(capacity, loadFactor);
//     }
// 
//     public QueryParameters(IQueryParameter... queryParameters) {
//         super(INITIAL_CAPACITY + queryParameters.length, LOAD_FACTOR);
//         put(queryParameters);
//     }
// 
//     public void put(IQueryParameter... queryParameters) {
//         for (IQueryParameter queryParameter : queryParameters) {
//             put(queryParameter.getName(), queryParameter.getValue());
//         }
//     }
// 
//     protected String getCommaDelimitedString(List<String> strings, int bestGuessMaxLength) {
//         final StringBuilder buffer = new StringBuilder(strings.size() * bestGuessMaxLength);
//         for(final String str : strings) {
//             buffer.append(str);
//             buffer.append(',');
//         }
// 
//         return buffer.substring(0, buffer.length() - 1);
//     }
// }
// 
// Path: ADNLibModule/src/main/java/com/alwaysallthetime/adnlib/response/AppDotNetResponseHandler.java
// public abstract class AppDotNetResponseHandler<T extends IAppDotNetObject> {
//     private static final String TAG = "AppDotNetResponseHandler";
// 
//     private final Gson gson;
//     private final Type responseType;
// 
//     // subclasses must call this constructor and initialize responseType since there is no default constructor
//     protected AppDotNetResponseHandler(TypeToken typeToken) {
//         gson = AppDotNetGson.getInstance();
//         responseType = typeToken.getType();
//     }
// 
//     protected <T> T parseResponse(Reader reader) {
//         return gson.fromJson(reader, responseType);
//     }
// 
//     public abstract void handleResponse(Reader reader);
// 
//     public abstract void onSuccess(T responseData);
// 
//     public void onError(Exception error) {
//         Log.e(TAG, error.getMessage(), error);
//     }
// }


import com.alwaysallthetime.adnlib.QueryParameters;
import com.alwaysallthetime.adnlib.response.AppDotNetResponseHandler;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
package com.alwaysallthetime.adnlib.request;



public class AppDotNetApiImageUploadRequest extends AppDotNetApiUploadRequest {
    public AppDotNetApiImageUploadRequest(AppDotNetResponseHandler handler, String filename, byte[] image, int offset,
                                          int count, QueryParameters queryParameters, String... pathComponents) {
        super(handler, filename, image, offset, count, queryParameters, pathComponents);
    }
    public AppDotNetApiImageUploadRequest(AppDotNetResponseHandler handler, String filename, byte[] image,
                                          QueryParameters queryParameters, String... pathComponents) {
        super(handler, filename, image, 0, image.length, queryParameters, pathComponents);
    }

    @Override
    public void writeBody(HttpURLConnection connection) throws IOException {
        connection.setRequestProperty(HEADER_CONTENT_TYPE, CONTENT_TYPE);
        connection.setChunkedStreamingMode(0);

        final OutputStream outputStream = connection.getOutputStream();
        final OutputStreamWriter streamWriter = new OutputStreamWriter(outputStream);

        writeBoundary(streamWriter);
        streamWriter.write(String.format(CONTENT_DISPOSITION_HEADER_WITH_FILENAME, bodyFilename, bodyFilename));
        streamWriter.write("\r\n");
// Path: ADNLibModule/src/main/java/com/alwaysallthetime/adnlib/QueryParameters.java
// public class QueryParameters extends HashMap<String, String> {
//     // very unlikely you'd ever need more than 4 query parameters on one request
//     private static final int INITIAL_CAPACITY = 4;
//     private static final float LOAD_FACTOR = 1.0f;
// 
//     /**
//      * Get a new QueryParameters that consists of two sets of QueryParamters combined.
//      *
//      * Since it is possible that there will be conflicting parameters, the second set will be applied
//      * "on top of" the first set, i.e. the topParameters can override the bottomParameters
//      *
//      * @param bottomParameters
//      * @param topParameters
//      * @return a new QueryParamters consisting of the values form both specified QueryParameters objects.
//      */
//     public static QueryParameters getCombinedParameters(QueryParameters bottomParameters, QueryParameters topParameters) {
//         QueryParameters newParams = new QueryParameters();
//         newParams.putAll(bottomParameters);
//         newParams.putAll(topParameters);
//         return newParams;
//     }
// 
//     public QueryParameters() {
//         this(INITIAL_CAPACITY, LOAD_FACTOR);
//     }
// 
//     protected QueryParameters(int capacity, float loadFactor) {
//         super(capacity, loadFactor);
//     }
// 
//     public QueryParameters(IQueryParameter... queryParameters) {
//         super(INITIAL_CAPACITY + queryParameters.length, LOAD_FACTOR);
//         put(queryParameters);
//     }
// 
//     public void put(IQueryParameter... queryParameters) {
//         for (IQueryParameter queryParameter : queryParameters) {
//             put(queryParameter.getName(), queryParameter.getValue());
//         }
//     }
// 
//     protected String getCommaDelimitedString(List<String> strings, int bestGuessMaxLength) {
//         final StringBuilder buffer = new StringBuilder(strings.size() * bestGuessMaxLength);
//         for(final String str : strings) {
//             buffer.append(str);
//             buffer.append(',');
//         }
// 
//         return buffer.substring(0, buffer.length() - 1);
//     }
// }
// 
// Path: ADNLibModule/src/main/java/com/alwaysallthetime/adnlib/response/AppDotNetResponseHandler.java
// public abstract class AppDotNetResponseHandler<T extends IAppDotNetObject> {
//     private static final String TAG = "AppDotNetResponseHandler";
// 
//     private final Gson gson;
//     private final Type responseType;
// 
//     // subclasses must call this constructor and initialize responseType since there is no default constructor
//     protected AppDotNetResponseHandler(TypeToken typeToken) {
//         gson = AppDotNetGson.getInstance();
//         responseType = typeToken.getType();
//     }
// 
//     protected <T> T parseResponse(Reader reader) {
//         return gson.fromJson(reader, responseType);
//     }
// 
//     public abstract void handleResponse(Reader reader);
// 
//     public abstract void onSuccess(T responseData);
// 
//     public void onError(Exception error) {
//         Log.e(TAG, error.getMessage(), error);
//     }
// }


// Path: ADNLibModule/src/main/java/com/alwaysallthetime/adnlib/request/AppDotNetApiImageUploadRequest.java
import com.alwaysallthetime.adnlib.QueryParameters;
import com.alwaysallthetime.adnlib.response.AppDotNetResponseHandler;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;

package com.alwaysallthetime.adnlib.request;



public class AppDotNetApiImageUploadRequest extends AppDotNetApiUploadRequest {
    public AppDotNetApiImageUploadRequest(AppDotNetResponseHandler handler, String filename, byte[] image, int offset,
                                          int count, QueryParameters queryParameters, String... pathComponents) {
        super(handler, filename, image, offset, count, queryParameters, pathComponents);
    }
    public AppDotNetApiImageUploadRequest(AppDotNetResponseHandler handler, String filename, byte[] image,
                                          QueryParameters queryParameters, String... pathComponents) {
        super(handler, filename, image, 0, image.length, queryParameters, pathComponents);
    }

    @Override
    public void writeBody(HttpURLConnection connection) throws IOException {
        connection.setRequestProperty(HEADER_CONTENT_TYPE, CONTENT_TYPE);
        connection.setChunkedStreamingMode(0);

        final OutputStream outputStream = connection.getOutputStream();
        final OutputStreamWriter streamWriter = new OutputStreamWriter(outputStream);

        writeBoundary(streamWriter);
        streamWriter.write(String.format(CONTENT_DISPOSITION_HEADER_WITH_FILENAME, bodyFilename, bodyFilename));
        streamWriter.write("\r\n");
        streamWriter.flush();