java.lang.Object
org.apache.commons.net.SocketClient
org.apache.commons.net.FingerClient
- Direct Known Subclasses:
- WhoisClient
- public class FingerClient
- extends SocketClient
The FingerClient class implements the client side of the Internet Finger
Protocol defined in RFC 1288. To finger a host you create a
FingerClient instance, connect to the host, query the host, and finally
disconnect from the host. If the finger service you want to query is on
a non-standard port, connect to the host at that port.
Here's a sample use:
FingerClient finger;
finger = new FingerClient();
try {
finger.connect("foo.bar.com");
System.out.println(finger.query("foobar", false));
finger.disconnect();
} catch(IOException e) {
System.err.println("Error I/O exception: " + e.getMessage());
return;
}
|
Constructor Summary |
FingerClient()
The default FingerClient constructor. |
| Methods inherited from class org.apache.commons.net.SocketClient |
_connectAction_, connect, connect, connect, connect, connect, connect, disconnect, getDefaultPort, getDefaultTimeout, getLocalAddress, getLocalPort, getRemoteAddress, getRemotePort, getSoLinger, getSoTimeout, getTcpNoDelay, isConnected, setDefaultPort, setDefaultTimeout, setSocketFactory, setSoLinger, setSoTimeout, setTcpNoDelay, verifyRemote |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_PORT
public static final int DEFAULT_PORT
- The default FINGER port. Set to 79 according to RFC 1288.
- See Also:
- Constant Field Values
__LONG_FLAG
private static final java.lang.String __LONG_FLAG
- See Also:
- Constant Field Values
__query
private transient java.lang.StringBuffer __query
__buffer
private transient char[] __buffer
FingerClient
public FingerClient()
- The default FingerClient constructor. Initializes the
default port to
DEFAULT_PORT .
query
public java.lang.String query(boolean longOutput,
java.lang.String username)
throws java.io.IOException
- Fingers a user at the connected host and returns the output
as a String. You must first connect to a finger server before
calling this method, and you should disconnect afterward.
query
public java.lang.String query(boolean longOutput)
throws java.io.IOException
- Fingers the connected host and returns the output
as a String. You must first connect to a finger server before
calling this method, and you should disconnect afterward.
This is equivalent to calling
query(longOutput, "") .
getInputStream
public java.io.InputStream getInputStream(boolean longOutput,
java.lang.String username)
throws java.io.IOException
- Fingers a user and returns the input stream from the network connection
of the finger query. You must first connect to a finger server before
calling this method, and you should disconnect after finishing reading
the stream.
getInputStream
public java.io.InputStream getInputStream(boolean longOutput)
throws java.io.IOException
- Fingers the connected host and returns the input stream from
the network connection of the finger query. This is equivalent to
calling getInputStream(longOutput, ""). You must first connect to a
finger server before calling this method, and you should disconnect
after finishing reading the stream.