org.apache.cassandra.streaming

## Class FileStreamTask

- java.lang.Object
- - org.apache.cassandra.utils.WrappedRunnable
  - - org.apache.cassandra.streaming.FileStreamTask

- All Implemented Interfaces:
    java.lang.Runnable
  Direct Known Subclasses:
    CompressedFileStreamTask

      public class FileStreamTask
      extends WrappedRunnable

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CHUNK_SIZE`
    `protected StreamHeader` | `header`
    `static int` | `MAX_CONNECT_ATTEMPTS`
    `protected StreamingMetrics` | `metrics`
    `protected java.net.Socket` | `socket`
    `protected Throttle` | `throttle`
    `protected java.net.InetAddress` | `to`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FileStreamTask(StreamHeader header, java.net.InetAddress to)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `close()`
    `protected void` | `receiveReply()`
    `void` | `runMayThrow()`
    `protected void` | `stream()` Stream file by it's sections specified by this.header
    `java.lang.String` | `toString()`
    `protected long` | `write(RandomAccessReader reader, long length, long bytesTransferred)` Sequentially read bytes from the file and write them to the output stream

    - ### Methods inherited from class org.apache.cassandra.utils.WrappedRunnable

      `run`

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

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

- - ### Field Detail

    - #### CHUNK_SIZE

          public static final int CHUNK_SIZE

      See Also:
        Constant Field Values

    - #### MAX_CONNECT_ATTEMPTS

          public static final int MAX_CONNECT_ATTEMPTS

      See Also:
        Constant Field Values

    - #### header

          protected final StreamHeader header

    - #### to

          protected final java.net.InetAddress to

    - #### socket

          protected java.net.Socket socket

    - #### throttle

          protected final Throttle throttle

    - #### metrics

          protected final StreamingMetrics metrics

  - ### Constructor Detail

    - #### FileStreamTask

          public FileStreamTask(StreamHeader header,
                        java.net.InetAddress to)

  - ### Method Detail

    - #### runMayThrow

          public void runMayThrow()
                           throws java.io.IOException

      Specified by:
        `runMayThrow` in class `WrappedRunnable`
      Throws:
        `java.io.IOException`

    - #### stream

          protected void stream()
                         throws java.io.IOException

      Stream file by it's sections specified by this.header
      Throws:
        `java.io.IOException` - on any I/O error

    - #### receiveReply

          protected void receiveReply()
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          protected long write(RandomAccessReader reader,
                   long length,
                   long bytesTransferred)
                        throws java.io.IOException

      Sequentially read bytes from the file and write them to the output stream
      Parameters:
        `reader` - The file reader to read from
        `length` - The full length that should be transferred
        `bytesTransferred` - Number of bytes remaining to transfer
      Returns:
        Number of bytes transferred
      Throws:
        `java.io.IOException` - on any I/O error

    - #### close

          protected void close()
                        throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

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

Copyright © 2014 The Apache Software Foundation