// Path: src/com/fieldexpert/fbapi4j/common/Attachment.java
// public class Attachment {
// 
// 	static {
// 		registerMimeDetector(ExtensionMimeDetector.class.getName());
// 		registerMimeDetector(MagicMimeMimeDetector.class.getName());
// 	}
// 
// 	public static String getType(File file) {
// 		Collection<?> types = getMimeTypes(file);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	public static String getType(InputStream is) {
// 		Collection<?> types = getMimeTypes(is);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	public static String getType(byte[] bytes) {
// 		Collection<?> types = getMimeTypes(bytes);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	private String filename;
// 	private String type;
// 	private InputStream content;
// 
// 	// not for you
// 	protected Attachment(String name) {
// 		this.filename = name;
// 	}
// 
// 	public Attachment(String filename, String type, byte[] content) {
// 		this(filename, type, new ByteArrayInputStream(content));
// 	}
// 
// 	public Attachment(String filename, String type, String content) {
// 		this(filename, type, content.getBytes(Charset.forName("UTF-8")));
// 	}
// 
// 	public Attachment(String filename, String type, InputStream content) {
// 		this.filename = filename;
// 		this.type = type;
// 		this.content = content;
// 	}
// 
// 	// can't chain this constructor call, because we need to try/catch
// 	public Attachment(File file) {
// 		Assert.notNull(file);
// 
// 		this.filename = file.getName();
// 		this.type = getType(file);
// 		try {
// 			this.content = new FileInputStream(file);
// 		} catch (Exception e) {
// 			throw new RuntimeException("Error reading file: '" + file.getName() + "'");
// 		}
// 	}
// 
// 	public InputStream getContent() {
// 		return content;
// 	}
// 
// 	public String getFilename() {
// 		return filename;
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// }


import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
import com.fieldexpert.fbapi4j.common.Attachment;
package com.fieldexpert.fbapi4j.http;



public class Http {
	public static final String GET = "GET";
	public static final String POST = "POST";

	public static InputStream get(URL url, Map<String, String> parameters) {
		return req(GET, url, parameters);
	}

	public static InputStream post(URL url, Map<String, String> parameters) {
		return req(POST, url, parameters);
	}

	public static InputStream post(URL url, Map<String, String> parameters, List<Attachment> attachments) {
		return req(POST, url, parameters, attachments);
	}

	public static InputStream req(String method, URL url, Map<String, String> parameters) {
		return req(method, url, parameters, null);
	}

// Path: src/com/fieldexpert/fbapi4j/common/Attachment.java
// public class Attachment {
// 
// 	static {
// 		registerMimeDetector(ExtensionMimeDetector.class.getName());
// 		registerMimeDetector(MagicMimeMimeDetector.class.getName());
// 	}
// 
// 	public static String getType(File file) {
// 		Collection<?> types = getMimeTypes(file);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	public static String getType(InputStream is) {
// 		Collection<?> types = getMimeTypes(is);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	public static String getType(byte[] bytes) {
// 		Collection<?> types = getMimeTypes(bytes);
// 		return getMostSpecificMimeType(types).toString();
// 	}
// 
// 	private String filename;
// 	private String type;
// 	private InputStream content;
// 
// 	// not for you
// 	protected Attachment(String name) {
// 		this.filename = name;
// 	}
// 
// 	public Attachment(String filename, String type, byte[] content) {
// 		this(filename, type, new ByteArrayInputStream(content));
// 	}
// 
// 	public Attachment(String filename, String type, String content) {
// 		this(filename, type, content.getBytes(Charset.forName("UTF-8")));
// 	}
// 
// 	public Attachment(String filename, String type, InputStream content) {
// 		this.filename = filename;
// 		this.type = type;
// 		this.content = content;
// 	}
// 
// 	// can't chain this constructor call, because we need to try/catch
// 	public Attachment(File file) {
// 		Assert.notNull(file);
// 
// 		this.filename = file.getName();
// 		this.type = getType(file);
// 		try {
// 			this.content = new FileInputStream(file);
// 		} catch (Exception e) {
// 			throw new RuntimeException("Error reading file: '" + file.getName() + "'");
// 		}
// 	}
// 
// 	public InputStream getContent() {
// 		return content;
// 	}
// 
// 	public String getFilename() {
// 		return filename;
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// }


// Path: src/com/fieldexpert/fbapi4j/http/Http.java
import java.io.InputStream;
import java.net.URL;
import java.util.List;
import java.util.Map;
import com.fieldexpert.fbapi4j.common.Attachment;

package com.fieldexpert.fbapi4j.http;



public class Http {
	public static final String GET = "GET";
	public static final String POST = "POST";

	public static InputStream get(URL url, Map<String, String> parameters) {
		return req(GET, url, parameters);
	}

	public static InputStream post(URL url, Map<String, String> parameters) {
		return req(POST, url, parameters);
	}

	public static InputStream post(URL url, Map<String, String> parameters, List<Attachment> attachments) {
		return req(POST, url, parameters, attachments);
	}

	public static InputStream req(String method, URL url, Map<String, String> parameters) {
		return req(method, url, parameters, null);
	}

	public static InputStream req(String method, URL url, Map<String, String> parameters, List<Attachment> attachments) {