Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
commons-net-1.4.1.jar - Apache Commons Net
commons-net-1.4.1.jar is the JAR file for Apache Commons Net 1.4.1, which implements the client side of many basic Internet protocols.
commons-net-1.4.1.jar is distributed as part of the commons-net-1.4.1.zip download file.
JAR File Size and Download Location:
JAR name: commons-net.jar, commons-net-1.4.1.jar Target JDK version: 1.4 Dependency: None File name: commons-net-1.4.1.jar File size: 180792 bytes Date modified: 03-Dec-2005 Download: Apache Commons Net
✍: FYIcenter.com
⏎ org/apache/commons/net/FingerClient.java
/* * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.net; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedOutputStream; import java.io.DataOutputStream; /*** * 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: * <pre> * 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; * } * </pre> * <p> * <p> * @author Daniel F. Savarese ***/ public class FingerClient extends SocketClient { /*** * The default FINGER port. Set to 79 according to RFC 1288. ***/ public static final int DEFAULT_PORT = 79; private static final String __LONG_FLAG = "/W "; private transient StringBuffer __query = new StringBuffer(64); private transient char[] __buffer = new char[1024]; /*** * The default FingerClient constructor. Initializes the * default port to <code> DEFAULT_PORT </code>. ***/ public FingerClient() { setDefaultPort(DEFAULT_PORT); } /*** * 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. * <p> * @param longOutput Set to true if long output is requested, false if not. * @param username The name of the user to finger. * @return The result of the finger query. * @exception IOException If an I/O error occurs while reading the socket. ***/ public String query(boolean longOutput, String username) throws IOException { int read; StringBuffer result = new StringBuffer(__buffer.length); BufferedReader input; input = new BufferedReader(new InputStreamReader(getInputStream(longOutput, username))); while (true) { read = input.read(__buffer, 0, __buffer.length); if (read <= 0) break; result.append(__buffer, 0, read); } input.close(); return result.toString(); } /*** * 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 <code> query(longOutput, "") </code>. * <p> * @param longOutput Set to true if long output is requested, false if not. * @return The result of the finger query. * @exception IOException If an I/O error occurs while reading the socket. ***/ public String query(boolean longOutput) throws IOException { return query(longOutput, ""); } /*** * 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. * <p> * @param longOutput Set to true if long output is requested, false if not. * @param username The name of the user to finger. * @return The InputStream of the network connection of the finger query. * Can be read to obtain finger results. * @exception IOException If an I/O error during the operation. ***/ public InputStream getInputStream(boolean longOutput, String username) throws IOException { DataOutputStream output; __query.setLength(0); if (longOutput) __query.append(__LONG_FLAG); __query.append(username); __query.append(SocketClient.NETASCII_EOL); output = new DataOutputStream(new BufferedOutputStream(_output_, 1024)); output.writeBytes(__query.toString()); output.flush(); return _input_; } /*** * 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. * <p> * @param longOutput Set to true if long output is requested, false if not. * @return The InputStream of the network connection of the finger query. * Can be read to obtain finger results. * @exception IOException If an I/O error during the operation. ***/ public InputStream getInputStream(boolean longOutput) throws IOException { return getInputStream(longOutput, ""); } }
⏎ org/apache/commons/net/FingerClient.java
Or download all of them as a single archive file:
File name: commons-net-1.4.1-src.zip File size: 324370 bytes Release date: 2013-03-03 Download
⇒ Using commons-net.jar in Java Programs
⇐ What Is commons-net-ftp-2.0.jar
2015-06-03, 65281👍, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.1? The if you...
JAX-WS is an API for building web services and clients. It is the next generation Web Services API r...