package com.jxml.quick.ocm; // Open Conversion Model
import com.jxml.quick.*;
import org.xml.sax.*;
import java.util.*;
import java.io.*;
import com.jxml.quick.qmap.*;
import java.net.*;

/**
 * Maps data model classes to peer classes.
 */
public class OCMparam extends QKeyedBase implements QBiModal
{
	public String url="";
	String text="";

	public String toString()
	{
		if ("".equals(url))
			return text;
		if (url.indexOf(':')==-1)
			url+="file:";
		try
		{
			URL realURL=new URL(url);
			URLConnection connection=realURL.openConnection();
			String encoding=connection.getContentEncoding();
			InputStream is=connection.getInputStream();
			BufferedReader in;
			if (encoding==null)
				in=new BufferedReader(new InputStreamReader(is));
			else
			{
				in=new BufferedReader(new InputStreamReader(is,encoding));
			}
			StringBuffer sb=new StringBuffer();
			String buf=in.readLine();
			while(buf!=null)
			{
				sb.append(buf);
				buf=in.readLine();
				sb.append(NL.LS);
			}
			return sb.toString();
		}
		catch (Exception e)
		{
			e.printStackTrace();
			throw new RuntimeException(e.toString());
		}
	}

	public String getQText()
	{

		return text;
	}

	public void setQText(String text)
	{
		this.text=text;
	}
	
	
}	
	
	
