Forum Stats

  • 3,768,284 Users
  • 2,252,770 Discussions
  • 7,874,514 Comments

Discussions

convert BufferedInputStream into AudioInputStream

User_V4K20
User_V4K20 Member Posts: 1 Green Ribbon

try {

stream=AudioSystem.getAudioInputStream(new BufferedInputStream(this.socket.getInputStream()));

} catch (UnsupportedAudioFileException e) {

                e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

java.io.IOException: Resetting to invalid mark

    at java.base/java.io.BufferedInputStream.reset(BufferedInputStream.java:446)

    at java.desktop/com.sun.media.sound.SunFileReader.getAudioFileFormat(SunFileReader.java:59)

    at java.desktop/com.sun.media.sound.WaveExtensibleFileReader.getAudioInputStream(WaveExtensibleFileReader.java:259)   

    at java.desktop/javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1010)

    at ServerThread.run(ServerThread.java:49)


This is errors gotten because I try to convert bytes from socket stream into AudioInputStream. The bytes aren't in wave format thus I can't create an AudioInputStream.

How can I do?

Thanks,

good jobs

Nicola

Tagged: