public class

AuFileReader

extends AudioFileReader
java.lang.Object
   ↳ javax.sound.sampled.spi.AudioFileReader
     ↳ com.sun.media.sound.AuFileReader

Class Overview

AU file reader.

Summary

Constants
int bisBufferSize
Fields
public static final Type[] types AU reader type
Public Constructors
AuFileReader()
Constructs a new AuFileReader object.
Public Methods
AudioFileFormat getAudioFileFormat(InputStream stream)
Obtains the audio file format of the input stream provided.
AudioFileFormat getAudioFileFormat(URL url)
Obtains the audio file format of the URL provided.
AudioFileFormat getAudioFileFormat(File file)
Obtains the audio file format of the File provided.
AudioInputStream getAudioInputStream(InputStream stream)
Obtains an audio stream from the input stream provided.
AudioInputStream getAudioInputStream(File file)
Obtains an audio stream from the File provided.
AudioInputStream getAudioInputStream(URL url)
Obtains an audio stream from the URL provided.
Protected Methods
int big2little(int i)
big2little Protected helper method to swap the order of bytes in a 32 bit int
short big2littleShort(short i)
big2little Protected helper method to swap the order of bytes in a 16 bit short
static int calculatePCMFrameSize(int sampleSizeInBits, int channels)
Calculates the frame size for PCM frames.
int rllong(DataInputStream dis)
rllong Protected helper method to read 64 bits and changing the order of each bytes.
short rlshort(DataInputStream dis)
rlshort Protected helper method to read 16 bits value.
[Expand]
Inherited Methods
From class javax.sound.sampled.spi.AudioFileReader
From class java.lang.Object

Constants

protected static final int bisBufferSize

Constant Value: 4096 (0x00001000)

Fields

public static final Type[] types

AU reader type

Public Constructors

public AuFileReader ()

Constructs a new AuFileReader object.

Public Methods

public AudioFileFormat getAudioFileFormat (InputStream stream)

Obtains the audio file format of the input stream provided. The stream must point to valid audio file data. In general, audio file providers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream the input stream from which file format information should be extracted
Returns
  • an AudioFileFormat object describing the audio file format
Throws
UnsupportedAudioFileException if the stream does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

public AudioFileFormat getAudioFileFormat (URL url)

Obtains the audio file format of the URL provided. The URL must point to valid audio file data.

Parameters
url the URL from which file format information should be extracted
Returns
  • an AudioFileFormat object describing the audio file format
Throws
UnsupportedAudioFileException if the URL does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

public AudioFileFormat getAudioFileFormat (File file)

Obtains the audio file format of the File provided. The File must point to valid audio file data.

Parameters
file the File from which file format information should be extracted
Returns
  • an AudioFileFormat object describing the audio file format
Throws
UnsupportedAudioFileException if the File does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

public AudioInputStream getAudioInputStream (InputStream stream)

Obtains an audio stream from the input stream provided. The stream must point to valid audio file data. In general, audio file providers may need to read some data from the stream before determining whether they support it. These parsers must be able to mark the stream, read enough data to determine whether they support the stream, and, if not, reset the stream's read pointer to its original position. If the input stream does not support this, this method may fail with an IOException.

Parameters
stream the input stream from which the AudioInputStream should be constructed
Returns
  • an AudioInputStream object based on the audio file data contained in the input stream.
Throws
UnsupportedAudioFileException if the stream does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

public AudioInputStream getAudioInputStream (File file)

Obtains an audio stream from the File provided. The File must point to valid audio file data.

Parameters
file the File for which the AudioInputStream should be constructed
Returns
  • an AudioInputStream object based on the audio file data pointed to by the File
Throws
UnsupportedAudioFileException if the File does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

public AudioInputStream getAudioInputStream (URL url)

Obtains an audio stream from the URL provided. The URL must point to valid audio file data.

Parameters
url the URL for which the AudioInputStream should be constructed
Returns
  • an AudioInputStream object based on the audio file data pointed to by the URL
Throws
UnsupportedAudioFileException if the URL does not point to valid audio file data recognized by the system
IOException if an I/O exception occurs

Protected Methods

protected int big2little (int i)

big2little Protected helper method to swap the order of bytes in a 32 bit int

Returns
  • 32 bits swapped value

protected short big2littleShort (short i)

big2little Protected helper method to swap the order of bytes in a 16 bit short

Returns
  • 16 bits swapped value

protected static int calculatePCMFrameSize (int sampleSizeInBits, int channels)

Calculates the frame size for PCM frames. Note that this method is appropriate for non-packed samples. For instance, 12 bit, 2 channels will return 4 bytes, not 3.

Parameters
sampleSizeInBits the size of a single sample in bits
channels the number of channels
Returns
  • the size of a PCM frame in bytes.

protected int rllong (DataInputStream dis)

rllong Protected helper method to read 64 bits and changing the order of each bytes.

Returns
  • 32 bits swapped value.
Throws
IOException

protected short rlshort (DataInputStream dis)

rlshort Protected helper method to read 16 bits value. Swap high with low byte.

Returns
  • the swapped value.
Throws
IOException