Class ByteArrayDownloadTarget

java.lang.Object
net.sf.basedb.opengrid.filetransfer.AbstractFileTransfer
net.sf.basedb.opengrid.filetransfer.ByteArrayDownloadTarget
All Implemented Interfaces:
DownloadTarget

public class ByteArrayDownloadTarget
extends AbstractFileTransfer
implements DownloadTarget
Download target implementation for getting the remote file as a byte array.
Since:
1.0
Author:
nicklas
  • Field Details

  • Constructor Details

    • ByteArrayDownloadTarget

      public ByteArrayDownloadTarget​(String name)
      Create a new byte array download target with "unlimited" size.
      Parameters:
      name - The name of the "file"
  • Method Details

    • getOutputStream

      public OutputStream getOutputStream()
      Description copied from interface: DownloadTarget
      Get an ouput stream for writing the file data to the local resource.
      Specified by:
      getOutputStream in interface DownloadTarget
    • getDownloadedSize

      public int getDownloadedSize()
      Get the size of the downloaded data.
    • getData

      public byte[] getData()
      Get the downloaded data as a byte array. Note that a copy is made for each call to this method. If no data has been downloaded null is returned.
    • getString

      public String getString​(String charset)
      Get the downloaded data as a string. If no data has been downloaded null is returned.