|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.finj.FTPSocket
public class FTPSocket
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) 2000-2008 Javier Iglesias.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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 |
Constructor Detail |
---|
public FTPSocket(java.net.Socket socket)
socket
.
socket
- the one to wrap.public FTPSocket(java.net.ServerSocket socket)
socket
.
socket
- the one to wrap.Method Detail |
---|
public boolean isSocket()
true
if wrapped socket is an instance of
java.net.Socket
, false if it's an instance of
java.net.ServerSocket
.public boolean isServerSocket()
true
if wrapped socket is an instance of
java.net.ServerSocket
, false if it's an instance of
java.net.Socket
.public int getLocalPort()
public java.net.InetAddress getInetAddress()
public void close() throws java.io.IOException
java.io.IOException
- something goes wrong with
the sockets, streams, ...public java.lang.String toString()
toString
in class java.lang.Object
String
representation.public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- something goes wrong with
the sockets, streams, ...public java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
- something goes wrong with
the sockets, streams, ...
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |