Class PutTask

    • Constructor Detail

      • PutTask

        public PutTask​(java.net.URI location)
        Creates a new task for the specified remote resource.
        Parameters:
        location - The relative location of the resource in the remote repository, must not be null.
    • Method Detail

      • newInputStream

        public java.io.InputStream newInputStream()
                                           throws java.io.IOException
        Opens an input stream for the data to be uploaded. The length of the stream can be queried via getDataLength(). It's the responsibility of the caller to close the provided stream.
        Returns:
        The input stream for the data, never null. The stream is unbuffered.
        Throws:
        java.io.IOException - If the stream could not be opened.
      • getDataLength

        public long getDataLength()
        Gets the total number of bytes to be uploaded.
        Returns:
        The total number of bytes to be uploaded.
      • getDataFile

        @Deprecated
        public java.io.File getDataFile()
        Deprecated.
        Use getDataPath() instead.
        Gets the file (if any) with the data to be uploaded.
        Returns:
        The data file or null if the data resides in memory.
      • getDataPath

        public java.nio.file.Path getDataPath()
        Gets the file (if any) with the data to be uploaded.
        Returns:
        The data file or null if the data resides in memory.
        Since:
        2.0.0
      • setDataFile

        @Deprecated
        public PutTask setDataFile​(java.io.File dataFile)
        Deprecated.
        Use setDataPath(Path) instead.
        Sets the file with the data to be uploaded. To upload some data residing already in memory, use setDataString(String) or setDataBytes(byte[]).
        Parameters:
        dataFile - The data file, may be null if the resource data is provided directly from memory.
        Returns:
        This task for chaining, never null.
      • setDataPath

        public PutTask setDataPath​(java.nio.file.Path dataPath)
        Sets the file with the data to be uploaded. To upload some data residing already in memory, use setDataString(String) or setDataBytes(byte[]).
        Parameters:
        dataPath - The data file, may be null if the resource data is provided directly from memory.
        Returns:
        This task for chaining, never null.
        Since:
        2.0.0
      • setDataBytes

        public PutTask setDataBytes​(byte[] bytes)
        Sets the binary data to be uploaded.
        Parameters:
        bytes - The binary data, may be null.
        Returns:
        This task for chaining, never null.
      • setDataString

        public PutTask setDataString​(java.lang.String str)
        Sets the textual data to be uploaded. The text is encoded using UTF-8 before transmission.
        Parameters:
        str - The textual data, may be null.
        Returns:
        This task for chaining, never null.
      • setListener

        public PutTask setListener​(TransportListener listener)
        Sets the listener that is to be notified during the transfer.
        Parameters:
        listener - The listener to notify of progress, may be null.
        Returns:
        This task for chaining, never null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object