org.apache.commons.net
Class FingerClient
public class FingerClient
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;
}
- Daniel F. Savarese
InputStream | getInputStream(boolean longOutput) -
Fingers the connected host and returns the input stream from
the network connection of the finger query.
|
InputStream | getInputStream(boolean longOutput, String username) -
Fingers a user and returns the input stream from the network connection
of the finger query.
|
String | query(boolean longOutput) -
Fingers the connected host and returns the output
as a String.
|
String | query(boolean longOutput, String username) -
Fingers a user at the connected host and returns the output
as a String.
|
_connectAction_ , connect , connect , connect , connect , connect , connect , disconnect , getDefaultPort , getDefaultTimeout , getLocalAddress , getLocalPort , getRemoteAddress , getRemotePort , getSoLinger , getSoTimeout , getTcpNoDelay , isConnected , setDefaultPort , setDefaultTimeout , setSoLinger , setSoTimeout , setSocketFactory , setTcpNoDelay , verifyRemote |
DEFAULT_PORT
public static final int DEFAULT_PORT
The default FINGER port. Set to 79 according to RFC 1288.
- 79
__LONG_FLAG
private static final String __LONG_FLAG
__buffer
private char[] __buffer
__query
private StringBuffer __query
FingerClient
public FingerClient()
The default FingerClient constructor. Initializes the
default port to DEFAULT_PORT
.
getInputStream
public InputStream getInputStream(boolean longOutput)
throws 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.
longOutput
- Set to true if long output is requested, false if not.
- The InputStream of the network connection of the finger query.
Can be read to obtain finger results.
getInputStream
public InputStream getInputStream(boolean longOutput,
String username)
throws 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.
longOutput
- Set to true if long output is requested, false if not.username
- The name of the user to finger.
- The InputStream of the network connection of the finger query.
Can be read to obtain finger results.
query
public String query(boolean longOutput)
throws 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, "")
.
longOutput
- Set to true if long output is requested, false if not.
- The result of the finger query.
query
public String query(boolean longOutput,
String username)
throws 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.
longOutput
- Set to true if long output is requested, false if not.username
- The name of the user to finger.
- The result of the finger query.