gnu.inet.gopher
Class GopherConnection

java.lang.Object
  extended by gnu.inet.gopher.GopherConnection

public class GopherConnection
extends java.lang.Object

A gopher client.

Author:
Chris Burdess

Field Summary
static int DEFAULT_PORT
          The default gopher port.
protected  java.io.InputStream in
           
protected  java.io.OutputStream out
           
protected  java.net.Socket socket
           
 
Constructor Summary
GopherConnection(java.lang.String host)
          Creates a new connection to the gopher server at the specified hostname.
GopherConnection(java.lang.String host, int port)
          Creates a new connection to the gopher server at the specified hostname with the specified non-standard port.
 
Method Summary
 java.io.InputStream get(java.lang.String selector)
          Returns the resource identified by the specified selector.
 DirectoryListing list()
          Returns the directory listing for this gopher server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default gopher port.

See Also:
Constant Field Values

socket

protected java.net.Socket socket

in

protected java.io.InputStream in

out

protected java.io.OutputStream out
Constructor Detail

GopherConnection

public GopherConnection(java.lang.String host)
                 throws java.io.IOException
Creates a new connection to the gopher server at the specified hostname.

Parameters:
hostname - the hostname
Throws:
java.io.IOException

GopherConnection

public GopherConnection(java.lang.String host,
                        int port)
                 throws java.io.IOException
Creates a new connection to the gopher server at the specified hostname with the specified non-standard port.

Parameters:
hostname - the hostname
port - the non-standard port to use
Throws:
java.io.IOException
Method Detail

list

public DirectoryListing list()
                      throws java.io.IOException
Returns the directory listing for this gopher server. When all entries have been read from the listing, the connection will be closed.

Throws:
java.io.IOException

get

public java.io.InputStream get(java.lang.String selector)
                        throws java.io.IOException
Returns the resource identified by the specified selector. If the resource is text-based, it will need to be wrapped in a CRLFInputStream.

Throws:
java.io.IOException


© Copyright 2003 The Free Software Foundation, all rights reserved