// 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;
	void write(String name, String filename, String type, InputStream is) throws IOException {
		Assert.notNull(name);
		Assert.notNull(filename);
		Assert.notNull(type);
		Assert.notNull(is);

		writeBoundary();

		// header
		out.writeBytes(contentDisposition(name) + "; filename=\"" + filename + "\"");
		out.writeBytes(NEWLINE);
		if (type != null) {
			out.writeBytes("Content-Type: " + type);
			out.writeBytes(NEWLINE);
		}
		out.writeBytes(NEWLINE);

		// write data
		byte[] data = new byte[1024];
		int r = 0;
		while ((r = is.read(data, 0, data.length)) != -1) {
			out.write(data, 0, r);
		}
		is.close();
		out.writeBytes(NEWLINE);
		out.flush();
	}

	private void writeBoundary() throws IOException {
		out.writeBytes(PREFIX);
// 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;

	void write(String name, String filename, String type, InputStream is) throws IOException {
		Assert.notNull(name);
		Assert.notNull(filename);
		Assert.notNull(type);
		Assert.notNull(is);

		writeBoundary();

		// header
		out.writeBytes(contentDisposition(name) + "; filename=\"" + filename + "\"");
		out.writeBytes(NEWLINE);
		if (type != null) {
			out.writeBytes("Content-Type: " + type);
			out.writeBytes(NEWLINE);
		}
		out.writeBytes(NEWLINE);

		// write data
		byte[] data = new byte[1024];
		int r = 0;
		while ((r = is.read(data, 0, data.length)) != -1) {
			out.write(data, 0, r);
		}
		is.close();
		out.writeBytes(NEWLINE);
		out.flush();
	}

	private void writeBoundary() throws IOException {
		out.writeBytes(PREFIX);
		out.writeBytes(boundary);