Class ByteArrayUploadSource

java.lang.Object
net.sf.basedb.opengrid.filetransfer.AbstractFileTransfer
net.sf.basedb.opengrid.filetransfer.ByteArrayUploadSource
All Implemented Interfaces:
UploadSource
Direct Known Subclasses:
StringUploadSource

public class ByteArrayUploadSource
extends AbstractFileTransfer
implements UploadSource
Upload source implementation for uploading the contents of a string to a file on a remote server.
Since:
1.0
Author:
nicklas
  • Field Details

    • data

      private final byte[] data
  • Constructor Details

    • ByteArrayUploadSource

      public ByteArrayUploadSource​(String name, byte[] data)
      Create a new source file from a byte[].
      Parameters:
      name - The name of the "file"
      data - The contents of the file
  • Method Details

    • initMetadata

      protected void initMetadata​(FileMetaData metadata)
      Description copied from class: AbstractFileTransfer
      Subclasses that are implementing the 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.
      Overrides:
      initMetadata in class AbstractFileTransfer
    • getInputStream

      public InputStream getInputStream()
      Get the file data.
      Specified by:
      getInputStream in interface UploadSource