Code example for SourceDataLine

Methods: flush

0
    public void resume() { 
        line.start();
    } 
 
    public void flush() { 
        line.flush();
    } 
 
    public void drain() { 
        line.drain();
    } 
 
    public void write(ByteBuffer sound) {
        int written;
        if (sound.hasArray()) {
            written = line.write(sound.array(), sound.arrayOffset() + sound.position(), sound.remaining());
        } else { 
            byte[] array = NIOUtils.toArray(sound);
            written = line.write(array, 0, array.length);
        }