Opens the line with the specified format and requested buffer size, causing the line to acquire any required system resources and become operational.
The buffer size is specified in bytes, but must represent an integral number of sample frames. Invoking this method with a requested buffer size that does not meet this requirement may result in an IllegalArgumentException. The actual buffer size for the open line may differ from the requested buffer size. The value actually set may be queried by subsequently calling {@link DataLine#getBufferSize}
If this operation succeeds, the line is marked as open, and an {@link LineEvent.Type#OPEN OPEN}
event is dispatched to the line's listeners.
Invoking this method on a line that is already open is illegal and may result in an IllegalStateException
.
Some lines, once closed, cannot be reopened. Attempts to reopen such a line will always result in a LineUnavailableException
.
@param format the desired audio format
@param bufferSize the desired buffer size, in bytes.
@throws LineUnavailableException if the line cannot beopened due to resource restrictions
@throws IllegalArgumentException if the buffer size does not representan integral number of sample frames, or if format
is not fully specified or invalid
@throws IllegalStateException if the line is already open
@throws SecurityException if the line cannot beopened due to security restrictions
@see #open(AudioFormat)
@see Line#open
@see Line#close
@see Line#isOpen
@see LineEvent