gnu.inet.gopher

Class GopherConnection


public class GopherConnection
extends java.lang.Object

A gopher client.

Version:
$Revision: 1.3 $ $Date: 2004/06/07 20:12:50 $

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.

Field Details

DEFAULT_PORT

public static final int DEFAULT_PORT
The default gopher port.

Field Value:
80


in

protected java.io.InputStream in


out

protected java.io.OutputStream out


socket

protected java.net.Socket socket

Constructor Details

GopherConnection

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

Parameters:


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:
port - the non-standard port to use

Method Details

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.


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.


© Copyright 2003 The Free Software Foundation, all rights reserved