Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.finj
Class FTPSocket  view FTPSocket download FTPSocket.java

java.lang.Object
  extended byorg.finj.FTPSocket

public class FTPSocket
extends java.lang.Object

This class wraps java.net.Socket and java.net.ServerSocket behind a common (limited) interface that mimics theirs. It only exsists to circumvent the absence of a common ancestor in their hierarchy, and to provide a transparent programming for both passive and non-passive data transfers, that require Socket and ServerSocket manipulation respectively. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Since:
v1.0.2
Version:
$Id: FTPSocket.java,v 1.3 2003/10/22 08:26:25 jiglesia Exp $

Field Summary
private  java.lang.Object socket
          Wrapped socket, either a java.net.Socket, or a java.net.ServerSocket
 
Constructor Summary
FTPSocket(java.net.ServerSocket socket)
          Constructs a new instance of this class that will wrap the socket.
FTPSocket(java.net.Socket socket)
          Constructs a new instance of this class that will wrap the socket.
 
Method Summary
 void close()
          Closes the wrapped socket.
 java.net.InetAddress getInetAddress()
          Returns the value of the wrapped socket's address field.
 java.io.InputStream getInputStream()
          Returns an input stream for the wrapped socket.
 int getLocalPort()
          Returns the value of this socket's localport field.
 java.io.OutputStream getOutputStream()
          Returns an output stream for the wrapped socket.
 boolean isServerSocket()
          Returns info on the kind of socket wrapped.
 boolean isSocket()
          Returns info on the kind of socket wrapped.
 java.lang.String toString()
          Returns a string representation of the wrapped socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

socket

private java.lang.Object socket
Wrapped socket, either a java.net.Socket, or a java.net.ServerSocket

Constructor Detail

FTPSocket

public FTPSocket(java.net.Socket socket)
Constructs a new instance of this class that will wrap the socket.

Since:
v1.0.2

FTPSocket

public FTPSocket(java.net.ServerSocket socket)
Constructs a new instance of this class that will wrap the socket.

Since:
v1.0.2
Method Detail

isSocket

public boolean isSocket()
Returns info on the kind of socket wrapped.

Since:
v1.0.2

isServerSocket

public boolean isServerSocket()
Returns info on the kind of socket wrapped.

Since:
v1.0.2

getLocalPort

public int getLocalPort()
Returns the value of this socket's localport field.

Since:
v1.0.2

getInetAddress

public java.net.InetAddress getInetAddress()
Returns the value of the wrapped socket's address field.

Since:
v1.0.2

close

public void close()
           throws java.io.IOException
Closes the wrapped socket.

Since:
v1.0.2

toString

public java.lang.String toString()
Returns a string representation of the wrapped socket.

Since:
v1.0.2

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns an input stream for the wrapped socket.

Since:
v1.0.2

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns an output stream for the wrapped socket.

Since:
v1.0.2