Class UniversalAudioInputStream

java.lang.Object
be.tarsos.dsp.io.UniversalAudioInputStream
All Implemented Interfaces:
TarsosDSPAudioInputStream

public class UniversalAudioInputStream
extends java.lang.Object
implements TarsosDSPAudioInputStream
  • Constructor Summary

    Constructors 
    Constructor Description
    UniversalAudioInputStream​(java.io.InputStream underlyingInputStream, TarsosDSPAudioFormat format)  
  • Method Summary

    Modifier and Type Method Description
    void close()
    Closes this audio input stream and releases any system resources associated with the stream.
    TarsosDSPAudioFormat getFormat()  
    long getFrameLength()  
    int read​(byte[] b, int off, int len)
    Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array.
    long skip​(long bytesToSkip)
    Skip a number of bytes before reading the remaining bytes.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • skip

      public long skip​(long bytesToSkip) throws java.io.IOException
      Description copied from interface: TarsosDSPAudioInputStream
      Skip a number of bytes before reading the remaining bytes.
      Specified by:
      skip in interface TarsosDSPAudioInputStream
      Parameters:
      bytesToSkip - The number of bytes to skip.
      Returns:
      The number of bytes skipped.
      Throws:
      java.io.IOException - If the underlying if an input or output error occurs #see read
    • read

      public int read​(byte[] b, int off, int len) throws java.io.IOException
      Description copied from interface: TarsosDSPAudioInputStream
      Reads up to a specified maximum number of bytes of data from the audio stream, putting them into the given byte array.

      This method will always read an integral number of frames. If len does not specify an integral number of frames, a maximum of len - (len % frameSize) bytes will be read.

      Specified by:
      read in interface TarsosDSPAudioInputStream
      Parameters:
      b - the buffer into which the data is read
      off - the offset, from the beginning of array b, at which the data will be written
      len - the maximum number of bytes to read
      Returns:
      the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached
      Throws:
      java.io.IOException - if an input or output error occurs
      See Also:
      TarsosDSPAudioInputStream.skip(long)
    • close

      public void close() throws java.io.IOException
      Description copied from interface: TarsosDSPAudioInputStream
      Closes this audio input stream and releases any system resources associated with the stream.
      Specified by:
      close in interface TarsosDSPAudioInputStream
      Throws:
      java.io.IOException - if an input or output error occurs
    • getFormat

      public TarsosDSPAudioFormat getFormat()
      Specified by:
      getFormat in interface TarsosDSPAudioInputStream
      Returns:
      The format of the underlying audio
    • getFrameLength

      public long getFrameLength()
      Specified by:
      getFrameLength in interface TarsosDSPAudioInputStream