public SoundBuffer read()
    {
        if( myAudioInputStream == null )
            return null;

        // Get the format for the audio data:
        AudioFormat audioFormat = myAudioInputStream.getFormat();

        // Check to make sure there is an audio format:
        if( audioFormat == null )
        {
            errorMessage( "Audio Format null in method 'read'" );
            return null;
        }

        // Varriables used when reading from the audio input stream:
        int bytesRead = 0, cnt = 0;

        // Allocate memory for the audio data:
        byte[] streamBuffer =
                           new byte[SoundSystemConfig.getStreamingBufferSize()];

        try
        {
            // Read until buffer is full or end of stream is reached:
            while( ( !endOfStream( GET, XXX ) )
                   && ( bytesRead < streamBuffer.length ) )
            {
                if( ( cnt = myAudioInputStream.read( streamBuffer, bytesRead,
                                      streamBuffer.length - bytesRead ) )
                     <= 0 )
                {
                    endOfStream( SET, true );
                    break;
                }
                // keep track of how many bytes were read:
                bytesRead += cnt;
            }
        }
        catch( IOException ioe )
        {
// TODO: See if setting endOfStream is needed here
            endOfStream( SET, true );
            return null;
        }

        // Return null if no data was read:
        if( bytesRead <= 0 )
            return null;

        // If we didn't fill the stream buffer entirely, trim it down to size:
        if( bytesRead < streamBuffer.length )
            streamBuffer = trimArray( streamBuffer, bytesRead );


        // Insert the converted data into a ByteBuffer:
        byte[] data = convertAudioBytes( streamBuffer,
                                      audioFormat.getSampleSizeInBits() == 16 );

        // Wrap the data into a SoundBuffer:
        SoundBuffer buffer = new SoundBuffer( data, audioFormat );

        // Return the result:
        return buffer;
    }