import java.net.URL;
import java.io.*;

public class IORHolder {

    private String ior_string;

    // constructor


    public String readIORFile( String file_name ) {

        try {
	        RandomAccessFile file = new RandomAccessFile( file_name, "r");
            ior_string = new String( file.readLine() );
            //System.out.println( "["+ior_string+"]" );
        } catch ( java.io.IOException io_exception ) {
            System.out.println( io_exception );
        }
        return ior_string;
    }

    public String readURL( String address ) {
       int c;
       StringBuffer buffer = new StringBuffer();

       try {
         URL url = new URL( address );
         //URLConnection conn = url.openConnection();

         //following lines are jdk1.1
   /**      InputStream datain = url.openStream();
         InputStreamReader reader = new InputStreamReader( datain );

         c = reader.read();
         while ( c != -1 ) {
            buffer.append( (char) c );

            c = reader.read();
         }

         ior_string = new String( buffer.toString());
         ior_string = ior_string.substring( 0, ior_string.length() - 1 );

    */
        //following lines are jdk1.0
         ior_string = new String( (String)url.getContent());
         ior_string = ior_string.substring( 0, ior_string.length() - 1 );

       } catch ( java.io.IOException io_exception ) {
          System.out.println( io_exception );
       }

       return ior_string;
    }



    // methods

    public String get_ior_string() {
	    return ior_string;
    }
}

