Code example for SourceDataLine

Methods: write

        // is written, however the user might stop the line in the 
        // middle of writing and then we get told how much was actually written. 
        // because of that, we might not need to write the entire array when we 
        // get here. 
        int needToWrite = rawBytes.length - bytesWritten;
        int actualWrit = line.write( rawBytes, bytesWritten, needToWrite );
        // if the total written is not equal to how much we needed to write 
        // then we need to remember where we were so that we don't read more 
        // until we finished writing our entire rawBytes array. 
        if ( actualWrit != needToWrite )
            shouldRead = false;
            bytesWritten += actualWrit;
            // if it all got written, we should continue reading 
            // and we reset our bytesWritten value. 
            shouldRead = true;
            bytesWritten = 0;