Package Acquisition.pamAudio
Class WavFileInputStream
java.lang.Object
java.io.InputStream
javax.sound.sampled.AudioInputStream
Acquisition.pamAudio.WavFileInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Wav file input stream which will work for large wav files (>2 Gigabytes) which
fail with the standard JAva classes since the data chunk size gets read as a
signed integer which then ends up invalid input: '<' 0.
This class should work with files of up to 4 Gigabytes (or 2^32 bytes). The only exception would be mono 8 bit files. This is because various parts of the super class (e.g. the available() function) use int for a sample number variable. With stereo or 16 bit files, the sample number can never exceed 2^31, since will be half or a quarter of the overall file size (minus the header). However, for mono 8 bit files, the sample number can still reach almost 2^32 which will mess up any parts of the code using a 32 bit sample number.
- Author:
- Doug Gillespie
-
Method Summary
Modifier and TypeMethodDescriptionGet additional header information from the wav file.static WavFileInputStream
openInputStream
(File file) Methods inherited from class javax.sound.sampled.AudioInputStream
available, close, getFormat, getFrameLength, mark, markSupported, read, read, read, reset, skip
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Method Details
-
openInputStream
public static WavFileInputStream openInputStream(File file) throws UnsupportedAudioFileException, IOException -
getWavHeader
Get additional header information from the wav file.- Returns:
- the wavHeader
-