de.esprit.netsuite.client.activity.transfer

## Class DownloadStream

- java.lang.Object
- - java.io.InputStream
  - - java.io.FilterInputStream
    - - java.io.BufferedInputStream
      - - de.esprit.appsuite.io.ProgressInputStream
        - - de.esprit.netsuite.client.activity.transfer.DownloadStream

- All Implemented Interfaces:
    CancellableTask, LocalCancellableTask, TaskIdHolder, Renderable, java.io.Closeable, java.lang.AutoCloseable

      public class DownloadStream
      extends ProgressInputStream
      implements Renderable, LocalCancellableTask

  This is a special stream used by the `FileStreamDownloadAgent` for downloading file data from the server. Reading the stream is automatically monitored by the client.
  Author:
    Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.io.ProgressInputStream

      `STREAM_BUFF_SIZE`

    - ### Fields inherited from class java.io.BufferedInputStream

      `buf, count, marklimit, markpos, pos`

    - ### Fields inherited from class java.io.FilterInputStream

      `in`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DownloadStream(IOFileDownstreamConnection strConn)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Cancels the running task.
    `void` | `close()`
    `protected void` | `fireProgress(java.lang.Object result, long percentage, java.lang.String progressMsg)` Note that the total length of the stream is normed to 100%.
    `AgentId` | `getAgentId()`
    `FileDataType` | `getFileDataType()`
    `JobId` | `getJobId()`
    `long` | `getRealFileSize()`
    `java.awt.Color` | `getRenderColor()`
    `javax.swing.Icon` | `getRenderIcon()`
    `java.lang.String` | `getRenderText()`
    `java.io.File` | `getServerFile()`
    `FileStreamJob` | `getStreamJob()`
    `TaskId` | `getTaskId()` Returns the unique identifier for this task.
    `java.lang.String` | `toString()`
    `boolean` | `wasCancelled()` Tells whether ever an attempt has been made to cancel this task.

    - ### Methods inherited from class de.esprit.appsuite.io.ProgressInputStream

      `getByteCount, getFileInfo, getFireCount, getProgressorTask, getReadPercentage, getTotalBytes, read, read, setProgressorTask, skip`

    - ### Methods inherited from class java.io.BufferedInputStream

      `available, mark, markSupported, reset`

    - ### Methods inherited from class java.io.FilterInputStream

      `read`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### DownloadStream

          public DownloadStream(IOFileDownstreamConnection strConn)
                         throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### cancel

          public void cancel()

      Description copied from interface: `LocalCancellableTask`
      Cancels the running task. Note that this call puts the task in a CANCEL_REQUESTED state. Once this happened `CancellableTask.wasCancelled()` will return true. Actually this call cancels the task's current `Future` and enforces a `CancellationException` to be thrown.
      Specified by:
        `cancel` in interface `LocalCancellableTask`

    - #### wasCancelled

          public boolean wasCancelled()

      Description copied from interface: `CancellableTask`
      Tells whether ever an attempt has been made to cancel this task.
      Specified by:
        `wasCancelled` in interface `CancellableTask`

    - #### getTaskId

          public TaskId getTaskId()

      Description copied from interface: `TaskIdHolder`
      Returns the unique identifier for this task. This identifier is only valid for a single task execution. When the same task instance executes another time then it will have a new `TaskId`.
      Specified by:
        `getTaskId` in interface `TaskIdHolder`

    - #### getRealFileSize

          public long getRealFileSize()

    - #### getServerFile

          public java.io.File getServerFile()

    - #### getStreamJob

          public FileStreamJob getStreamJob()

    - #### getFileDataType

          public FileDataType getFileDataType()

    - #### getJobId

          public JobId getJobId()

    - #### getAgentId

          public AgentId getAgentId()

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `java.io.BufferedInputStream`
      Throws:
        `java.io.IOException`

    - #### fireProgress

          protected void fireProgress(java.lang.Object result,
                          long percentage,
                          java.lang.String progressMsg)

      Note that the total length of the stream is normed to 100%.
      Overrides:
        `fireProgress` in class `ProgressInputStream`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getRenderColor

          public java.awt.Color getRenderColor()

      Specified by:
        `getRenderColor` in interface `Renderable`

    - #### getRenderIcon

          public javax.swing.Icon getRenderIcon()

      Specified by:
        `getRenderIcon` in interface `Renderable`

    - #### getRenderText

          public java.lang.String getRenderText()

      Specified by:
        `getRenderText` in interface `Renderable`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.