Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cnrg.itx.datax.devices
Class StreamSource

    java.lang.Object
      |
      +--cnrg.itx.datax.devices.StreamSource

public class StreamSource
extends java.lang.Object
implements Source, java.lang.Runnable

Class implementing a stream source. This class will take any InputStream and synchronize it to make it a valid `Source`.

Field Summary
`static int` | `DEFAULT_BUFFER_TIME` Default buffer time
`static int` | `SAMPLE_SIZE` File sample size

Constructor Summary
`StreamSource(java.io.InputStream inputStream, Channel channel)` Constructor to make a StreamSource from any input stream (no flow control)
`StreamSource(java.io.InputStream inputStream, Channel channel, long bufferTime)` Constructor to make a StreamSource from any input stream (flow control)

Method Summary
`void` | `close()` Method to close the input stream.
`PropertiesCollection` | `getProperties()` Returns a collection of properties supported.
`Stats` | `getStatistics()` Method to get the statistics of the input stream.
`boolean` | `mute(boolean mute)` Method to mute the input stream.
`void` | `run()` Method which acts as a thread and pushes data to the channel.
`void` | `setPeerProperties(PropertiesCollection pc)` Interface to set the given properties collection into the device.
`void` | `setProperties(PropertiesCollection pc)` Sets the given properties collection into the device
`void` | `start()` Method to start the source thread.
`void` | `stop()` Method to stop the thread.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SAMPLE_SIZE

    public static final int SAMPLE_SIZE

  File sample size

### DEFAULT_BUFFER_TIME

    public static final int DEFAULT_BUFFER_TIME

  Default buffer time

Constructor Detail

### StreamSource

    public StreamSource(java.io.InputStream inputStream,
                        Channel channel)

  Constructor to make a StreamSource from any input stream (no flow control)
  Parameters:
    `inputStream` - The input Stream
    `channel` - The audio channel

### StreamSource

    public StreamSource(java.io.InputStream inputStream,
                        Channel channel,
                        long bufferTime)

  Constructor to make a StreamSource from any input stream (flow control)
  Parameters:
    `inputStream` - The input Stream
    `channel` - The audio channel
    `bufferTime` - The amount of data to keep buffered on the output stream in ms

Method Detail

### close

    public void close()

  Method to close the input stream.
  Specified by:
    close in interface Source

### mute

    public boolean mute(boolean mute)

  Method to mute the input stream. This method will either block or resume the stream according to the value passed to it.
  Specified by:
    mute in interface Source
  Parameters:
    `mute` - true to mute and false to resume the stream
  Returns:
    boolean The previous mute state

### getStatistics

    public Stats getStatistics()

  Method to get the statistics of the input stream.
  Returns:
    Stats The statistics object

### start

    public void start()

  Method to start the source thread.
  Specified by:
    start in interface Source

### run

    public void run()

  Method which acts as a thread and pushes data to the channel.
  Specified by:
    run in interface java.lang.Runnable

### stop

    public void stop()

  Method to stop the thread.

### getProperties

    public PropertiesCollection getProperties()
                                       throws DataException

  Returns a collection of properties supported.

### setProperties

    public void setProperties(PropertiesCollection pc)
                       throws DataException

  Sets the given properties collection into the device

### setPeerProperties

    public void setPeerProperties(PropertiesCollection pc)
                           throws DataException

  Interface to set the given properties collection into the device. WOrks under the assumption that this is the properties collection of the peer.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD