javax.sound.sampled

Interface SourceDataLine

public interface SourceDataLine extends DataLine

This is a DataLine to which data may be written.

Since: 1.3

Method Summary
voidopen(AudioFormat fmt)
Open the line, given the desired audio format.
voidopen(AudioFormat fmt, int size)
Open the line, given the desired audio format and the buffer size.
intwrite(byte[] buf, int offset, int length)
Write audio data to this line.

Method Detail

open

public void open(AudioFormat fmt)
Open the line, given the desired audio format.

Parameters: fmt the format to use

Throws: LineUnavailableException if the line is not available for some reason SecurityException if this is prevented by the security manager

open

public void open(AudioFormat fmt, int size)
Open the line, given the desired audio format and the buffer size.

Parameters: fmt the format to use size the buffer size

Throws: LineUnavailableException if the line is not available for some reason SecurityException if this is prevented by the security manager

write

public int write(byte[] buf, int offset, int length)
Write audio data to this line. The data must be an integral number of frames, as determined by the audio format.

Parameters: buf a byte array of audio data offset index of the first byte in the array to use length the number of bytes to write

Returns: the number of bytes written