Interface DtmfStream.SampleSource

Enclosing class:
DtmfStream
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface DtmfStream.SampleSource
A source of double PCM samples for DtmfStream.fromSource(SampleSource, DtmfConfig). Callers implement this as a functional interface, typically a lambda wrapping a file, socket, or pre-buffered array.

The return value follows the InputStream convention: a non-negative integer is the number of samples written into buffer starting at offset, and -1 signals end-of-stream.

  • Method Summary

    Modifier and Type
    Method
    Description
    int
    readInto(double[] buffer, int offset, int length)
    Read up to length samples into buffer[offset .. offset + length).
  • Method Details

    • readInto

      int readInto(double[] buffer, int offset, int length)
      Read up to length samples into buffer[offset .. offset + length).
      Parameters:
      buffer - destination buffer; non-null
      offset - starting index; 0 <= offset <= buffer.length
      length - maximum number of samples to write; 0 <= length && offset + length <= buffer.length
      Returns:
      the number of samples written (0 <= n <= length), or -1 to signal end-of-stream