public abstract class AbstractFileTransfer extends Object
DownloadTarget
and UploadSource
interfaces, eg. the name and file metdata information.
DownloadTarget
implementations only need to extend this class and
implement the DownloadTarget.getOutputStream()
method. File metadata
about the remote file should be available in the getMetadata()
instance when the DownloadTarget.getOutputStream()
method is called.
UploadSource
implementations that are extending this class
need to implement the UploadSource.getInputStream()
method.
If file metadata is important the implementation should call
getMetadata()
and initialize the information before the
UploadSource.getInputStream()
method is called.Modifier and Type | Field and Description |
---|---|
private FileMetaData |
metadata |
private String |
name |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFileTransfer(String name) |
Modifier and Type | Method and Description |
---|---|
FileMetaData |
getMetadata()
Get metadata about the local file or receive metadata for
the remote file.
|
String |
getName()
Get the name of the file.
|
protected void |
initMetadata(FileMetaData metadata)
Subclasses that are implementing the
UploadSource
interface should override this method and initialize the
metadata instance with information about the loca file. |
private final String name
private FileMetaData metadata
protected AbstractFileTransfer(String name)
public String getName()
UploadSource.getName()
,
DownloadTarget.getName()
public FileMetaData getMetadata()
protected void initMetadata(FileMetaData metadata)
UploadSource
interface should override this method and initialize the
metadata instance with information about the loca file.
This method is called also for DownloadTarget
implementations but can typically be ignored since
the metadata will be overwritten with information from
the remote server.