gnu.inet.gopher

Class 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 InputStream
in
protected OutputStream
out
protected Socket
socket

Constructor Summary

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

Method Summary

InputStream
get(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 InputStream in

out

protected OutputStream out

socket

protected Socket socket

Constructor Details

GopherConnection

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

GopherConnection

public GopherConnection(String host,
                        int port)
            throws 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 InputStream get(String selector)
            throws 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 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