org.strbio
Class IO

java.lang.Object
  extended by org.strbio.IO

public final class IO
extends java.lang.Object

A class containing some useful IO functions which don't really merit their own classes.

  Version 1.2, 3/13/1 - added getURLData
  Version 1.1, 7/9/99 - added openReaderResource, openStreamResource
  Version 1.0, 5/21/98 - original version
  

Version:
1.2, 3/13/1
Author:
JMC

Constructor Summary
IO()
           
 
Method Summary
static java.lang.String getURLData(java.net.URL url, java.lang.String query, java.lang.String serverName, Printf outfile)
          Get raw data from a web server, as a string.
static boolean inPath(java.lang.String programName)
          Check to see if a program is in your path.
static java.io.BufferedReader openReader(java.lang.String fileName)
          Open a file with transparent gunzipping.
static java.io.BufferedReader openReaderResource(java.lang.String fileName, java.lang.Object parent)
          Open a file stored somewhere in the CLASSPATH (a resource, in Java terms).
static java.io.BufferedInputStream openStream(java.lang.String fileName)
          Open a file with transparent gunzipping.
static java.io.BufferedInputStream openStreamResource(java.lang.String fileName, java.lang.Object parent)
          Open a file stored somewhere in the CLASSPATH (a resource, in Java terms).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IO

public IO()
Method Detail

inPath

public static final boolean inPath(java.lang.String programName)
Check to see if a program is in your path. This was deliberately broken by Java 1.1, so there's now no way to do this.


openReader

public static final java.io.BufferedReader openReader(java.lang.String fileName)
                                               throws java.io.IOException
Open a file with transparent gunzipping. If the file ends in .gz, it is opened using gzip. Otherwise, both the normal file name and name.gz are tried.

Throws:
java.io.IOException

openStream

public static final java.io.BufferedInputStream openStream(java.lang.String fileName)
                                                    throws java.io.IOException
Open a file with transparent gunzipping. If the file ends in .gz, it is opened using gzip. Otherwise, both the normal file name and name.gz are tried.

Throws:
java.io.IOException

openStreamResource

public static final java.io.BufferedInputStream openStreamResource(java.lang.String fileName,
                                                                   java.lang.Object parent)
                                                            throws java.io.IOException
Open a file stored somewhere in the CLASSPATH (a resource, in Java terms). If the file ends in .gz, it is transparently opened with a GZIPInputStream. Otherwise, both the normal file name and name.gz are looked for.

Parameters:
parent - the name of the file must be specified relative to the directory the parent object is found in.
Throws:
java.io.IOException

openReaderResource

public static final java.io.BufferedReader openReaderResource(java.lang.String fileName,
                                                              java.lang.Object parent)
                                                       throws java.io.IOException
Open a file stored somewhere in the CLASSPATH (a resource, in Java terms). If the file ends in .gz, it is transparently opened with a GZIPInputStream. Otherwise, both the normal file name and name.gz are looked for.

Parameters:
parent - the name of the file must be specified relative to the directory the parent object is found in.
Throws:
java.io.IOException

getURLData

public static final java.lang.String getURLData(java.net.URL url,
                                                java.lang.String query,
                                                java.lang.String serverName,
                                                Printf outfile)
Get raw data from a web server, as a string. outfile and query can be null.