public abstract class AbstractUFTPClient extends Object implements Runnable, Closeable
Modifier and Type | Field and Description |
---|---|
static int |
BUFFSIZE
NETWORK send/receive buffer size, this must be the same on client/server
if multiple streams are to be used
|
protected boolean |
cancelled |
protected DPCClient |
client |
protected boolean |
compress |
static int |
HOSTERR |
protected byte[] |
key |
protected int |
numcons |
protected UFTPProgressListener |
progressListener |
protected InputStream |
reader |
protected Socket |
socket |
static int |
SYNERR
Errorcodes
|
protected OutputStream |
writer |
Constructor and Description |
---|
AbstractUFTPClient(InetAddress[] servers,
int port)
create a new UFTP client for file transfer from/to the given server
|
Modifier and Type | Method and Description |
---|---|
void |
assertFeature(String feature) |
void |
cancel()
signal the client that it should cancel an operation
|
void |
close() |
protected void |
closeData() |
void |
connect() |
protected Socket |
createSocket(int numConnections,
DPCClient client,
byte[] key) |
protected Socket |
createSocket(int numConnections,
DPCClient client,
byte[] key,
boolean compress) |
int |
getAuthtimeout() |
int |
getBufferSize() |
byte[] |
getKey() |
int |
getNumConnections() |
UFTPProgressListener |
getProgressListener() |
String |
getSecret() |
List<String> |
getServerFeatures() |
InetAddress[] |
getServerList() |
int |
getTimeout() |
boolean |
isCompress() |
boolean |
isConnected() |
void |
openDataConnection()
if necessary, open data connection
|
protected void |
prepareGet(OutputStream localTarget)
setup reader and writer for getting remote data, by connecting them to
the appropriate socket input stream and local output stream
|
protected void |
preparePut(InputStream localSource)
setup reader and writer for writing local data to the remote target, by
connecting them to the socket output stream and local input source
|
void |
setAuthtimeout(int authtimeout) |
void |
setBufferSize(int bufferSize) |
void |
setCompress(boolean compress) |
void |
setKey(byte[] key)
set the (encoded) symmetric key to be used for encryption/decryption
|
void |
setNumConnections(int num) |
void |
setProgressListener(UFTPProgressListener progressListener) |
void |
setSecret(String secret) |
void |
setTimeout(int timeout) |
public static final int SYNERR
public static final int HOSTERR
public static final int BUFFSIZE
protected byte[] key
protected boolean compress
protected int numcons
protected UFTPProgressListener progressListener
protected final DPCClient client
protected Socket socket
protected InputStream reader
protected OutputStream writer
protected volatile boolean cancelled
public AbstractUFTPClient(InetAddress[] servers, int port)
servers
- - list of alternative IP addresses of the UFTP serverport
- - the server portpublic void connect() throws IOException, AuthorizationFailureException
public void openDataConnection() throws IOException
IOException
protected void closeData()
protected void prepareGet(OutputStream localTarget) throws IOException
localTarget
- local output streamIOException
protected void preparePut(InputStream localSource) throws IOException
localSource
- local input sourceIOException
protected Socket createSocket(int numConnections, DPCClient client, byte[] key) throws IOException
IOException
protected Socket createSocket(int numConnections, DPCClient client, byte[] key, boolean compress) throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void setNumConnections(int num)
public int getNumConnections()
public int getTimeout()
public void setTimeout(int timeout)
public int getAuthtimeout()
public void setAuthtimeout(int authtimeout)
public String getSecret()
public void setSecret(String secret)
public void setKey(byte[] key)
key
- public byte[] getKey()
public boolean isCompress()
public void setCompress(boolean compress)
public UFTPProgressListener getProgressListener()
public void setProgressListener(UFTPProgressListener progressListener)
public InetAddress[] getServerList()
public int getBufferSize()
public void setBufferSize(int bufferSize)
public boolean isConnected()
public void assertFeature(String feature) throws RuntimeException
RuntimeException
public void cancel()
Copyright © 2010–2018 UNICORE. All rights reserved.