// Path: src/com/fieldexpert/fbapi4j/common/Assert.java
// public class Assert {
// 
// 	public static void notNull(Object object, String message) {
// 		if (object == null) {
// 			throw new IllegalArgumentException(message);
// 		}
// 	}
// 
// 	public static void notNull(Object object) {
// 		notNull(object, "[Assertion failed] - this argument is required; it must not be null");
// 	}
// }


import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.fieldexpert.fbapi4j.common.Assert;
package com.fieldexpert.fbapi4j.http;



class MultiPartOutputStream {

	private static final String NEWLINE = "\r\n";
	private static final String PREFIX = "--";

	private final DataOutputStream out;
	private final String boundary;

	MultiPartOutputStream(OutputStream os, String boundary) {
		if (os == null) {
			throw new IllegalArgumentException("Outputstream cannot be null.");
		}
		this.out = new DataOutputStream(os);
		this.boundary = boundary;
	}

	void writeEnd() throws IOException {
		out.writeBytes(PREFIX);
		out.writeBytes(boundary);
		out.writeBytes(PREFIX);
		out.writeBytes(NEWLINE);
		out.flush();
	}

	private String contentDisposition(String name) {
		return "Content-Disposition: form-data; name=\"" + name + "\"";
	}

	void write(String name, Object value) throws IOException {
// Path: src/com/fieldexpert/fbapi4j/common/Assert.java
// public class Assert {
// 
// 	public static void notNull(Object object, String message) {
// 		if (object == null) {
// 			throw new IllegalArgumentException(message);
// 		}
// 	}
// 
// 	public static void notNull(Object object) {
// 		notNull(object, "[Assertion failed] - this argument is required; it must not be null");
// 	}
// }


// Path: src/com/fieldexpert/fbapi4j/http/MultiPartOutputStream.java
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import com.fieldexpert.fbapi4j.common.Assert;

package com.fieldexpert.fbapi4j.http;



class MultiPartOutputStream {

	private static final String NEWLINE = "\r\n";
	private static final String PREFIX = "--";

	private final DataOutputStream out;
	private final String boundary;

	MultiPartOutputStream(OutputStream os, String boundary) {
		if (os == null) {
			throw new IllegalArgumentException("Outputstream cannot be null.");
		}
		this.out = new DataOutputStream(os);
		this.boundary = boundary;
	}

	void writeEnd() throws IOException {
		out.writeBytes(PREFIX);
		out.writeBytes(boundary);
		out.writeBytes(PREFIX);
		out.writeBytes(NEWLINE);
		out.flush();
	}

	private String contentDisposition(String name) {
		return "Content-Disposition: form-data; name=\"" + name + "\"";
	}

	void write(String name, Object value) throws IOException {
		Assert.notNull(name);