Class DefaultProxyTransfer
- java.lang.Object
-
- org.jivesoftware.openfire.filetransfer.proxy.DefaultProxyTransfer
-
- All Implemented Interfaces:
Serializable,FileTransferProgress,ProxyTransfer,Cacheable
public class DefaultProxyTransfer extends Object implements ProxyTransfer
Tracks the different connections related to a file transfer. There are two connections, the initiator and the target and when both connections are completed the transfer can begin.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultProxyTransfer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoTransfer()Transfers the file from the initiator to the target.longgetAmountTransferred()Returns the number of bytes that has been transferred.intgetCachedSize()Returns the approximate size of the Object in bytes.StringgetInitiator()Returns the fully qualified JID of the initiator of the file transfer.InputStreamgetInputStream()OutputStreamgetOutputStream()StringgetSessionID()Returns the unique session id that correlates to the file transfer.StringgetTarget()Returns the full qualified JID of the target of the file transfer.StringgetTransferDigest()Returns the transfer digest uniquely identifies a file transfer in the system.booleanisActivatable()Returns true if the Bytestream is ready to be activated and the proxy transfer can begin.voidsetInitiator(String initiator)voidsetInputStream(InputStream initiatorInputStream)voidsetOutputStream(OutputStream outputStream)voidsetSessionID(String streamID)voidsetTarget(String target)voidsetTransferDigest(String transferDigest)Sets the transfer digest for a file transfer.voidsetTransferFuture(Future<?> future)When the file transfer is being caried out by another thread this will set the Future relating to the thread that is carrying out the transfer.
-
-
-
Method Detail
-
getInitiator
public String getInitiator()
Description copied from interface:FileTransferProgressReturns the fully qualified JID of the initiator of the file transfer.- Specified by:
getInitiatorin interfaceFileTransferProgress- Returns:
- the fully qualified JID of the initiator of the file transfer.
-
setInitiator
public void setInitiator(String initiator)
- Specified by:
setInitiatorin interfaceFileTransferProgress
-
getInputStream
public InputStream getInputStream()
- Specified by:
getInputStreamin interfaceFileTransferProgress
-
setInputStream
public void setInputStream(InputStream initiatorInputStream)
- Specified by:
setInputStreamin interfaceFileTransferProgress
-
getOutputStream
public OutputStream getOutputStream()
- Specified by:
getOutputStreamin interfaceFileTransferProgress
-
setOutputStream
public void setOutputStream(OutputStream outputStream)
- Specified by:
setOutputStreamin interfaceFileTransferProgress
-
getTarget
public String getTarget()
Description copied from interface:FileTransferProgressReturns the full qualified JID of the target of the file transfer.- Specified by:
getTargetin interfaceFileTransferProgress- Returns:
- the fully qualified JID of the target
-
setTarget
public void setTarget(String target)
- Specified by:
setTargetin interfaceFileTransferProgress
-
getTransferDigest
public String getTransferDigest()
Description copied from interface:ProxyTransferReturns the transfer digest uniquely identifies a file transfer in the system.- Specified by:
getTransferDigestin interfaceProxyTransfer- Returns:
- the transfer digest uniquely identifies a file transfer in the system.
-
setTransferDigest
public void setTransferDigest(String transferDigest)
Description copied from interface:ProxyTransferSets the transfer digest for a file transfer. The transfer digest uniquely identifies a file transfer in the system.- Specified by:
setTransferDigestin interfaceProxyTransfer- Parameters:
transferDigest- the digest which uniquely identifies this transfer.
-
getSessionID
public String getSessionID()
Description copied from interface:FileTransferProgressReturns the unique session id that correlates to the file transfer.- Specified by:
getSessionIDin interfaceFileTransferProgress- Returns:
- Returns the unique session id that correlates to the file transfer.
-
setSessionID
public void setSessionID(String streamID)
- Specified by:
setSessionIDin interfaceFileTransferProgress
-
isActivatable
public boolean isActivatable()
Description copied from interface:ProxyTransferReturns true if the Bytestream is ready to be activated and the proxy transfer can begin.- Specified by:
isActivatablein interfaceProxyTransfer- Returns:
- true if the Bytestream is ready to be activated.
-
setTransferFuture
public void setTransferFuture(Future<?> future)
Description copied from interface:FileTransferProgressWhen the file transfer is being caried out by another thread this will set the Future relating to the thread that is carrying out the transfer.- Specified by:
setTransferFuturein interfaceFileTransferProgress- Parameters:
future- the furute that is carrying out the transfer
-
getAmountTransferred
public long getAmountTransferred()
Description copied from interface:FileTransferProgressReturns the number of bytes that has been transferred.- Specified by:
getAmountTransferredin interfaceFileTransferProgress- Returns:
- the number of bytes that has been transferred.
-
doTransfer
public void doTransfer() throws IOExceptionDescription copied from interface:ProxyTransferTransfers the file from the initiator to the target.- Specified by:
doTransferin interfaceProxyTransfer- Throws:
IOException- when an error occurs either reading from the input stream or writing to the output stream.
-
getCachedSize
public int getCachedSize()
Description copied from interface:CacheableReturns the approximate size of the Object in bytes. The size should be considered to be a best estimate of how much memory the Object occupies and may be based on empirical trials or dynamic calculations.- Specified by:
getCachedSizein interfaceCacheable- Returns:
- the size of the Object in bytes.
-
-