com.impinj.stp

## Class DebugStreamGrabber

- java.lang.Object
- - com.impinj.stp.DebugStreamGrabber

- All Implemented Interfaces:
    java.lang.Runnable

      public class DebugStreamGrabber
      extends java.lang.Object
      implements java.lang.Runnable

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DebugStreamGrabber.StreamType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DebugStreamGrabber(java.lang.String readerName, DebugStreamGrabber.StreamType streamType)` Initiates a debug stream capture from the given reader

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `Close()`
    `void` | `close(int flushTime)` Closes the connection and joins the pumper thread.
    `protected java.io.InputStream` | `createConnection()` Establishes a connection with the reader and returns the input stream from the reader.
    `void` | `run()` This is purely just the pumping of bytes from the reader to the output stream
    `void` | `startPumperThread(java.lang.String outputFileName)` Kicks off the thread that streams data from the reader to the outputStream.

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

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

- - ### Constructor Detail

    - #### DebugStreamGrabber

          public DebugStreamGrabber(java.lang.String readerName,
                                    DebugStreamGrabber.StreamType streamType)
                             throws java.net.UnknownHostException,
                                    java.io.IOException

      Initiates a debug stream capture from the given reader
      Parameters:
        `readerName` - Name of the reader to which to connect. This can be a dns name or an ip address.
        `streamType` - Indicates whether its RDD or FDD
      Throws:
        `java.net.UnknownHostException` - IP address is not correct
        `java.io.IOException` - TCP/IP communication failure

  - ### Method Detail

    - #### startPumperThread

          public void startPumperThread(java.lang.String outputFileName)
                                 throws java.lang.Exception

      Kicks off the thread that streams data from the reader to the outputStream.
      Parameters:
        `outputFileName` - The stream to which to send the data.
      Throws:
        `java.io.IOException` - Error while outputting to file
        `java.lang.Exception`

    - #### Close

          public void Close()
                     throws java.lang.InterruptedException

      Throws:
        `java.lang.InterruptedException`

    - #### close

          public void close(int flushTime)
                     throws java.lang.InterruptedException

      Closes the connection and joins the pumper thread. The connection is closed by initiating a second connection to the reader with the same parameters. This results in the reader abandoning the previous connection, thus causing the pipes to flush.
      Parameters:
        `flushTime` - Extra time to allow data to get flushed through the system.
      Throws:
        `java.lang.InterruptedException` - Thread interrupted during close.

    - #### run

          public void run()

      This is purely just the pumping of bytes from the reader to the output stream
      Specified by:
        `run` in interface `java.lang.Runnable`

    - #### createConnection

          protected final java.io.InputStream createConnection()
                                                        throws java.net.UnknownHostException,
                                                               java.io.IOException

      Establishes a connection with the reader and returns the input stream from the reader. Even though the connection is http like, it's slightly broken from the point of view of standard http handlers, so we manually deal with the headers and such here. The returned InputStream is queued up at the beginning of real data after the headers have been eaten off.
      Returns:
        InputStream rdd or fdd input stream
      Throws:
        `java.net.UnknownHostException` - IP address is not correct
        `java.io.IOException` - TCP/IP communication failure