// Path: app/src/main/java/javax/microedition/io/Connection.java
// public interface Connection
// {
// 	public void close() throws IOException;
// }
// 
// Path: app/src/main/java/javax/microedition/io/ConnectionProvider.java
// public interface ConnectionProvider
// {
// 	public Connection open(String name, int mode) throws IOException;
// }
// 
// Path: app/src/main/java/javax/microedition/io/Connector.java
// public class Connector
// {
// 	public static final int READ = 1;
// 	public static final int READ_WRITE = 3;
// 	public static final int WRITE = 2;
// 	
// 	private static HashMap<String, ConnectionProvider> providers;
// 	
// 	static
// 	{
// 		registerConnectionProvider("file", new FileSystemRegistry());
// 		registerConnectionProvider("http", new HttpConnectionProvider());
// 		registerConnectionProvider("btl2cap", new BTL2CAPConnectionProvider());
// 	}
// 	
// 	public static void registerConnectionProvider(String protocol, ConnectionProvider provider)
// 	{
// 		if(providers == null)
// 		{
// 			providers = new HashMap();
// 		}
// 		
// 		providers.put(protocol.toLowerCase(), provider);
// 	}
// 	
// 	public static Connection open(String name) throws IOException
// 	{
// 		return open(name, READ_WRITE);
// 	}
// 	
// 	public static Connection open(String name, int mode) throws IOException
// 	{
// 		if(providers == null || providers.isEmpty())
// 		{
// 			throw new ConnectionNotFoundException("no registered connection providers");
// 		}
// 		
// 		int index = name.indexOf("://");
// 		
// 		if(index >= 0)
// 		{
// 			String protocol = name.substring(0, index).toLowerCase();
// 			ConnectionProvider provider = providers.get(protocol);
// 			
// 			if(provider != null)
// 			{
// 				return provider.open(name.substring(index + 3), mode);
// 			}
// 			else
// 			{
// 				throw new ConnectionNotFoundException("'" + protocol + "' connections are not supported");
// 			}
// 		}
// 		else
// 		{
// 			throw new IllegalArgumentException("malformed URL: " + name);
// 		}
// 	}
// 	
// 	public static InputStream openInputStream(String name) throws IOException
// 	{
// 		Connection conn = open(name, READ);
// 		
// 		if(conn instanceof StreamConnection)
// 		{
// 			return new ImmediateInputStream((StreamConnection)conn);
// 		}
// 		else
// 		{
// 			throw new IOException("cannot open stream on a non-stream connection");
// 		}
// 	}
// 	
// 	public static OutputStream openOutputStream(String name) throws IOException
// 	{
// 		Connection conn = open(name, WRITE);
// 		
// 		if(conn instanceof StreamConnection)
// 		{
// 			return new ImmediateOutputStream((StreamConnection)conn);
// 		}
// 		else
// 		{
// 			throw new IOException("cannot open stream on a non-stream connection");
// 		}
// 	}
// }


import java.io.File;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.Connection;
import javax.microedition.io.ConnectionProvider;
import javax.microedition.io.Connector;
import android.os.Environment;

		{
			name = getExternalStoragePath() + name.substring(EXTERNAL_DISK.length());
		}
		
		return "/" + name;
	}
	
	public static String androidFileToMIDP(String name)
	{
		if(name.startsWith("/"))
		{
			name = name.substring(1);
		}
		
		String sdcard = getExternalStoragePath();
		
		if(name.startsWith(sdcard))
		{
			name = EXTERNAL_DISK + name.substring(sdcard.length());
		}
		else
		{
			name = INTERNAL_DISK + name;
		}
		
		return "/" + name;
	}
	
	public Connection open(String name, int mode)
	{

// Path: app/src/main/java/javax/microedition/io/Connection.java
// public interface Connection
// {
// 	public void close() throws IOException;
// }
// 
// Path: app/src/main/java/javax/microedition/io/ConnectionProvider.java
// public interface ConnectionProvider
// {
// 	public Connection open(String name, int mode) throws IOException;
// }
// 
// Path: app/src/main/java/javax/microedition/io/Connector.java
// public class Connector
// {
// 	public static final int READ = 1;
// 	public static final int READ_WRITE = 3;
// 	public static final int WRITE = 2;
// 	
// 	private static HashMap<String, ConnectionProvider> providers;
// 	
// 	static
// 	{
// 		registerConnectionProvider("file", new FileSystemRegistry());
// 		registerConnectionProvider("http", new HttpConnectionProvider());
// 		registerConnectionProvider("btl2cap", new BTL2CAPConnectionProvider());
// 	}
// 	
// 	public static void registerConnectionProvider(String protocol, ConnectionProvider provider)
// 	{
// 		if(providers == null)
// 		{
// 			providers = new HashMap();
// 		}
// 		
// 		providers.put(protocol.toLowerCase(), provider);
// 	}
// 	
// 	public static Connection open(String name) throws IOException
// 	{
// 		return open(name, READ_WRITE);
// 	}
// 	
// 	public static Connection open(String name, int mode) throws IOException
// 	{
// 		if(providers == null || providers.isEmpty())
// 		{
// 			throw new ConnectionNotFoundException("no registered connection providers");
// 		}
// 		
// 		int index = name.indexOf("://");
// 		
// 		if(index >= 0)
// 		{
// 			String protocol = name.substring(0, index).toLowerCase();
// 			ConnectionProvider provider = providers.get(protocol);
// 			
// 			if(provider != null)
// 			{
// 				return provider.open(name.substring(index + 3), mode);
// 			}
// 			else
// 			{
// 				throw new ConnectionNotFoundException("'" + protocol + "' connections are not supported");
// 			}
// 		}
// 		else
// 		{
// 			throw new IllegalArgumentException("malformed URL: " + name);
// 		}
// 	}
// 	
// 	public static InputStream openInputStream(String name) throws IOException
// 	{
// 		Connection conn = open(name, READ);
// 		
// 		if(conn instanceof StreamConnection)
// 		{
// 			return new ImmediateInputStream((StreamConnection)conn);
// 		}
// 		else
// 		{
// 			throw new IOException("cannot open stream on a non-stream connection");
// 		}
// 	}
// 	
// 	public static OutputStream openOutputStream(String name) throws IOException
// 	{
// 		Connection conn = open(name, WRITE);
// 		
// 		if(conn instanceof StreamConnection)
// 		{
// 			return new ImmediateOutputStream((StreamConnection)conn);
// 		}
// 		else
// 		{
// 			throw new IOException("cannot open stream on a non-stream connection");
// 		}
// 	}
// }


// Path: app/src/main/java/javax/microedition/io/file/FileSystemRegistry.java
import java.io.File;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.Connection;
import javax.microedition.io.ConnectionProvider;
import javax.microedition.io.Connector;
import android.os.Environment;

		{
			name = getExternalStoragePath() + name.substring(EXTERNAL_DISK.length());
		}
		
		return "/" + name;
	}
	
	public static String androidFileToMIDP(String name)
	{
		if(name.startsWith("/"))
		{
			name = name.substring(1);
		}
		
		String sdcard = getExternalStoragePath();
		
		if(name.startsWith(sdcard))
		{
			name = EXTERNAL_DISK + name.substring(sdcard.length());
		}
		else
		{
			name = INTERNAL_DISK + name;
		}
		
		return "/" + name;
	}
	
	public Connection open(String name, int mode)
	{

		return new FileConnection(new File(midpFileToAndroid(name)), (mode & Connector.WRITE) != 0 ? FileConnection.READ_WRITE : FileConnection.READ);
