Class PersistableTransfer

  • Direct Known Subclasses:
    PersistableDownload, PersistableUpload

    public abstract class PersistableTransfer
    extends Object
    Abstract base class for the information of a pausible upload or download; such information can be used to resume the upload or download later on, and can be serialized/deserialized for persistence purposes.
    • Constructor Detail

      • PersistableTransfer

        public PersistableTransfer()
    • Method Detail

      • serialize

        public final String serialize()
        Returns the serialized representation of the paused transfer state.
      • serialize

        public final void serialize​(OutputStream out)
                             throws IOException
        Writes the serialized representation of the paused transfer state to the given OutputStream. Caller of this method should explicitly close the OutputStream.
        Throws:
        IOException
      • deserializeFrom

        public static <T extends PersistableTransfer> T deserializeFrom​(InputStream in)
        Returns the deserialized transfer state of the given serialized representation. Caller of this method should explicitly close the InputStream.
        Throws:
        UnsupportedOperationException - if the paused transfer type extracted from the serialized representation is not supported.
      • deserializeFrom

        public static <T extends PersistableTransfer> T deserializeFrom​(String serialized)
        Returns the deserialized transfer state of the given serialized representation.
        Throws:
        UnsupportedOperationException - if the paused transfer type extracted from the serialized representation is not supported.