Class WaveUtils

java.lang.Object
com.ibm.watson.text_to_speech.v1.util.WaveUtils

public final class WaveUtils
extends Object
Utility class to write the data size header in wave(.wav) files synthesized with the TextToSpeech service.
  • Method Details

    • reWriteWaveHeader

      public static InputStream reWriteWaveHeader​(InputStream is) throws IOException
      Re-writes the data size in the header(bytes 4-8) of the WAVE(.wav) input stream.
      It needs to be read in order to calculate the size.
      Parameters:
      is - the input stream
      Returns:
      A new input stream that includes the data header in the header
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • toByteArray

      public static byte[] toByteArray​(InputStream is) throws IOException
      Converts an InputStream to byte array.
      Parameters:
      is - the input stream
      Returns:
      the byte array
      Throws:
      IOException - If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.