8043979: Javadoc cleanup of javax.sound.sampled package
Reviewed-by: pchelko, azvegint
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFileFormat.java Wed Jun 04 17:14:56 2014 +0400
@@ -25,36 +25,29 @@
package javax.sound.sampled;
-import java.io.File;
-import java.io.OutputStream;
-import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-
/**
- * An instance of the <code>AudioFileFormat</code> class describes
- * an audio file, including the file type, the file's length in bytes,
- * the length in sample frames of the audio data contained in the file,
- * and the format of the audio data.
+ * An instance of the {@code AudioFileFormat} class describes an audio file,
+ * including the file type, the file's length in bytes, the length in sample
+ * frames of the audio data contained in the file, and the format of the audio
+ * data.
* <p>
- * The <code>{@link AudioSystem}</code> class includes methods for determining the format
- * of an audio file, obtaining an audio input stream from an audio file, and
+ * The {@link AudioSystem} class includes methods for determining the format of
+ * an audio file, obtaining an audio input stream from an audio file, and
* writing an audio file from an audio input stream.
- *
- * <p>An <code>AudioFileFormat</code> object can
- * include a set of properties. A property is a pair of key and value:
- * the key is of type <code>String</code>, the associated property
- * value is an arbitrary object.
- * Properties specify additional informational
- * meta data (like a author, copyright, or file duration).
- * Properties are optional information, and file reader and file
- * writer implementations are not required to provide or
- * recognize properties.
- *
- * <p>The following table lists some common properties that should
- * be used in implementations:
+ * <p>
+ * An {@code AudioFileFormat} object can include a set of properties. A property
+ * is a pair of key and value: the key is of type {@code String}, the associated
+ * property value is an arbitrary object. Properties specify additional
+ * informational meta data (like a author, copyright, or file duration).
+ * Properties are optional information, and file reader and file writer
+ * implementations are not required to provide or recognize properties.
+ * <p>
+ * The following table lists some common properties that should be used in
+ * implementations:
*
* <table border=1>
* <caption>Audio File Format Properties</caption>
@@ -104,17 +97,13 @@
*/
public class AudioFileFormat {
-
- // INSTANCE VARIABLES
-
-
/**
* File type.
*/
private Type type;
/**
- * File length in bytes
+ * File length in bytes.
*/
private int byteLength;
@@ -124,25 +113,26 @@
private AudioFormat format;
/**
- * Audio data length in sample frames
+ * Audio data length in sample frames.
*/
private int frameLength;
-
- /** The set of properties */
+ /**
+ * The set of properties.
+ */
private HashMap<String, Object> properties;
-
/**
- * Constructs an audio file format object.
- * This protected constructor is intended for use by providers of file-reading
- * services when returning information about an audio file or about supported audio file
- * formats.
- * @param type the type of the audio file
- * @param byteLength the length of the file in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
- * @param format the format of the audio data contained in the file
- * @param frameLength the audio data length in sample frames, or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Constructs an audio file format object. This protected constructor is
+ * intended for use by providers of file-reading services when returning
+ * information about an audio file or about supported audio file formats.
*
+ * @param type the type of the audio file
+ * @param byteLength the length of the file in bytes, or
+ * {@code AudioSystem.NOT_SPECIFIED}
+ * @param format the format of the audio data contained in the file
+ * @param frameLength the audio data length in sample frames, or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see #getType
*/
protected AudioFileFormat(Type type, int byteLength, AudioFormat format, int frameLength) {
@@ -154,14 +144,15 @@
this.properties = null;
}
-
/**
- * Constructs an audio file format object.
- * This public constructor may be used by applications to describe the
- * properties of a requested audio file.
- * @param type the type of the audio file
- * @param format the format of the audio data contained in the file
- * @param frameLength the audio data length in sample frames, or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Constructs an audio file format object. This public constructor may be
+ * used by applications to describe the properties of a requested audio
+ * file.
+ *
+ * @param type the type of the audio file
+ * @param format the format of the audio data contained in the file
+ * @param frameLength the audio data length in sample frames, or
+ * {@code AudioSystem.NOT_SPECIFIED}
*/
public AudioFileFormat(Type type, AudioFormat format, int frameLength) {
@@ -170,19 +161,16 @@
}
/**
- * Construct an audio file format object with a set of
- * defined properties.
+ * Construct an audio file format object with a set of defined properties.
* This public constructor may be used by applications to describe the
- * properties of a requested audio file. The properties map
- * will be copied to prevent any changes to it.
+ * properties of a requested audio file. The properties map will be copied
+ * to prevent any changes to it.
*
- * @param type the type of the audio file
- * @param format the format of the audio data contained in the file
- * @param frameLength the audio data length in sample frames, or
- * <code>AudioSystem.NOT_SPECIFIED</code>
- * @param properties a <code>Map<String,Object></code> object
- * with properties
- *
+ * @param type the type of the audio file
+ * @param format the format of the audio data contained in the file
+ * @param frameLength the audio data length in sample frames, or
+ * {@code AudioSystem.NOT_SPECIFIED}
+ * @param properties a {@code Map<String, Object>} object with properties
* @since 1.5
*/
public AudioFileFormat(Type type, AudioFormat format,
@@ -191,11 +179,10 @@
this.properties = new HashMap<String, Object>(properties);
}
-
/**
- * Obtains the audio file type, such as <code>WAVE</code> or <code>AU</code>.
+ * Obtains the audio file type, such as {@code WAVE} or {@code AU}.
+ *
* @return the audio file type
- *
* @see Type#WAVE
* @see Type#AU
* @see Type#AIFF
@@ -207,7 +194,9 @@
}
/**
- * Obtains the size in bytes of the entire audio file (not just its audio data).
+ * Obtains the size in bytes of the entire audio file (not just its audio
+ * data).
+ *
* @return the audio file length in bytes
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -217,6 +206,7 @@
/**
* Obtains the format of the audio data contained in the audio file.
+ *
* @return the audio data format
*/
public AudioFormat getFormat() {
@@ -224,7 +214,9 @@
}
/**
- * Obtains the length of the audio data contained in the file, expressed in sample frames.
+ * Obtains the length of the audio data contained in the file, expressed in
+ * sample frames.
+ *
* @return the number of sample frames of audio data in the file
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -233,18 +225,15 @@
}
/**
- * Obtain an unmodifiable map of properties.
- * The concept of properties is further explained in
- * the {@link AudioFileFormat class description}.
+ * Obtain an unmodifiable map of properties. The concept of properties is
+ * further explained in the {@link AudioFileFormat class description}.
*
- * @return a <code>Map<String,Object></code> object containing
- * all properties. If no properties are recognized, an empty map is
- * returned.
- *
+ * @return a {@code Map<String, Object>} object containing all properties.
+ * If no properties are recognized, an empty map is returned.
* @see #getProperty(String)
* @since 1.5
*/
- public Map<String,Object> properties() {
+ public Map<String, Object> properties() {
Map<String,Object> ret;
if (properties == null) {
ret = new HashMap<String,Object>(0);
@@ -254,20 +243,16 @@
return Collections.unmodifiableMap(ret);
}
-
/**
- * Obtain the property value specified by the key.
- * The concept of properties is further explained in
- * the {@link AudioFileFormat class description}.
+ * Obtain the property value specified by the key. The concept of properties
+ * is further explained in the {@link AudioFileFormat class description}.
+ * <p>
+ * If the specified property is not defined for a particular file format,
+ * this method returns {@code null}.
*
- * <p>If the specified property is not defined for a
- * particular file format, this method returns
- * <code>null</code>.
- *
- * @param key the key of the desired property
- * @return the value of the property with the specified key,
- * or <code>null</code> if the property does not exist.
- *
+ * @param key the key of the desired property
+ * @return the value of the property with the specified key, or {@code null}
+ * if the property does not exist
* @see #properties()
* @since 1.5
*/
@@ -278,11 +263,12 @@
return properties.get(key);
}
-
/**
* Provides a string representation of the file format.
+ *
* @return the file format as a string
*/
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
@@ -307,11 +293,9 @@
return new String(buf);
}
-
/**
- * An instance of the <code>Type</code> class represents one of the
- * standard types of audio file. Static instances are provided for the
- * common types.
+ * An instance of the {@code Type} class represents one of the standard
+ * types of audio file. Static instances are provided for the common types.
*/
public static class Type {
@@ -342,9 +326,6 @@
*/
public static final Type SND = new Type("SND", "snd");
-
- // INSTANCE VARIABLES
-
/**
* File type name.
*/
@@ -355,27 +336,22 @@
*/
private final String extension;
-
- // CONSTRUCTOR
-
/**
* Constructs a file type.
- * @param name the string that names the file type
- * @param extension the string that commonly marks the file type
- * without leading dot.
+ *
+ * @param name the string that names the file type
+ * @param extension the string that commonly marks the file type
+ * without leading dot
*/
public Type(String name, String extension) {
-
this.name = name;
this.extension = extension;
}
-
- // METHODS
-
/**
- * Finalizes the equals method
+ * Finalizes the equals method.
*/
+ @Override
public final boolean equals(Object obj) {
if (toString() == null) {
return (obj != null) && (obj.toString() == null);
@@ -387,8 +363,9 @@
}
/**
- * Finalizes the hashCode method
+ * Finalizes the hashCode method.
*/
+ @Override
public final int hashCode() {
if (toString() == null) {
return 0;
@@ -397,22 +374,23 @@
}
/**
- * Provides the file type's name as the <code>String</code> representation
- * of the file type.
+ * Provides the file type's name as the {@code String} representation of
+ * the file type.
+ *
* @return the file type's name
*/
+ @Override
public final String toString() {
return name;
}
/**
* Obtains the common file name extension for this file type.
+ *
* @return file type extension
*/
public String getExtension() {
return extension;
}
-
- } // class Type
-
-} // class AudioFileFormat
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioFormat.java Wed Jun 04 17:14:56 2014 +0400
@@ -30,59 +30,63 @@
import java.util.Map;
/**
- * <code>AudioFormat</code> is the class that specifies a particular arrangement of data in a sound stream.
- * By examining the information stored in the audio format, you can discover how to interpret the bits in the
- * binary sound data.
+ * {@code AudioFormat} is the class that specifies a particular arrangement of
+ * data in a sound stream. By examining the information stored in the audio
+ * format, you can discover how to interpret the bits in the binary sound data.
* <p>
- * Every data line has an audio format associated with its data stream. The audio format of a source (playback) data line indicates
- * what kind of data the data line expects to receive for output. For a target (capture) data line, the audio format specifies the kind
- * of the data that can be read from the line.
- * Sound files also have audio formats, of course. The <code>{@link AudioFileFormat}</code>
- * class encapsulates an <code>AudioFormat</code> in addition to other,
- * file-specific information. Similarly, an <code>{@link AudioInputStream}</code> has an
- * <code>AudioFormat</code>.
+ * Every data line has an audio format associated with its data stream. The
+ * audio format of a source (playback) data line indicates what kind of data the
+ * data line expects to receive for output. For a target (capture) data line,
+ * the audio format specifies the kind of the data that can be read from the
+ * line.
+ * Sound files also have audio formats, of course. The {@link AudioFileFormat}
+ * class encapsulates an {@code AudioFormat} in addition to other, file-specific
+ * information. Similarly, an {@link AudioInputStream} has an
+ * {@code AudioFormat}.
+ * <p>
+ * The {@code AudioFormat} class accommodates a number of common sound-file
+ * encoding techniques, including pulse-code modulation (PCM), mu-law encoding,
+ * and a-law encoding. These encoding techniques are predefined, but service
+ * providers can create new encoding types. The encoding that a specific format
+ * uses is named by its {@code encoding} field.
* <p>
- * The <code>AudioFormat</code> class accommodates a number of common sound-file encoding techniques, including
- * pulse-code modulation (PCM), mu-law encoding, and a-law encoding. These encoding techniques are predefined,
- * but service providers can create new encoding types.
- * The encoding that a specific format uses is named by its <code>encoding</code> field.
- *<p>
- * In addition to the encoding, the audio format includes other properties that further specify the exact
- * arrangement of the data.
- * These include the number of channels, sample rate, sample size, byte order, frame rate, and frame size.
- * Sounds may have different numbers of audio channels: one for mono, two for stereo.
- * The sample rate measures how many "snapshots" (samples) of the sound pressure are taken per second, per channel.
- * (If the sound is stereo rather than mono, two samples are actually measured at each instant of time: one for the left channel,
- * and another for the right channel; however, the sample rate still measures the number per channel, so the rate is the same
- * regardless of the number of channels. This is the standard use of the term.)
- * The sample size indicates how many bits are used to store each snapshot; 8 and 16 are typical values.
- * For 16-bit samples (or any other sample size larger than a byte),
- * byte order is important; the bytes in each sample are arranged in
- * either the "little-endian" or "big-endian" style.
- * For encodings like PCM, a frame consists of the set of samples for all channels at a given
- * point in time, and so the size of a frame (in bytes) is always equal to the size of a sample (in bytes) times
- * the number of channels. However, with some other sorts of encodings a frame can contain
- * a bundle of compressed data for a whole series of samples, as well as additional, non-sample
- * data. For such encodings, the sample rate and sample size refer to the data after it is decoded into PCM,
- * and so they are completely different from the frame rate and frame size.
- *
- * <p>An <code>AudioFormat</code> object can include a set of
- * properties. A property is a pair of key and value: the key
- * is of type <code>String</code>, the associated property
- * value is an arbitrary object. Properties specify
- * additional format specifications, like the bit rate for
- * compressed formats. Properties are mainly used as a means
- * to transport additional information of the audio format
- * to and from the service providers. Therefore, properties
- * are ignored in the {@link #matches(AudioFormat)} method.
- * However, methods which rely on the installed service
- * providers, like {@link AudioSystem#isConversionSupported
- * (AudioFormat, AudioFormat) isConversionSupported} may consider
- * properties, depending on the respective service provider
- * implementation.
- *
- * <p>The following table lists some common properties which
- * service providers should use, if applicable:
+ * In addition to the encoding, the audio format includes other properties that
+ * further specify the exact arrangement of the data. These include the number
+ * of channels, sample rate, sample size, byte order, frame rate, and frame
+ * size. Sounds may have different numbers of audio channels: one for mono, two
+ * for stereo. The sample rate measures how many "snapshots" (samples) of the
+ * sound pressure are taken per second, per channel. (If the sound is stereo
+ * rather than mono, two samples are actually measured at each instant of time:
+ * one for the left channel, and another for the right channel; however, the
+ * sample rate still measures the number per channel, so the rate is the same
+ * regardless of the number of channels. This is the standard use of the term.)
+ * The sample size indicates how many bits are used to store each snapshot; 8
+ * and 16 are typical values. For 16-bit samples (or any other sample size
+ * larger than a byte), byte order is important; the bytes in each sample are
+ * arranged in either the "little-endian" or "big-endian" style. For encodings
+ * like PCM, a frame consists of the set of samples for all channels at a given
+ * point in time, and so the size of a frame (in bytes) is always equal to the
+ * size of a sample (in bytes) times the number of channels. However, with some
+ * other sorts of encodings a frame can contain a bundle of compressed data for
+ * a whole series of samples, as well as additional, non-sample data. For such
+ * encodings, the sample rate and sample size refer to the data after it is
+ * decoded into PCM, and so they are completely different from the frame rate
+ * and frame size.
+ * <p>
+ * An {@code AudioFormat} object can include a set of properties. A property is
+ * a pair of key and value: the key is of type {@code String}, the associated
+ * property value is an arbitrary object. Properties specify additional format
+ * specifications, like the bit rate for compressed formats. Properties are
+ * mainly used as a means to transport additional information of the audio
+ * format to and from the service providers. Therefore, properties are ignored
+ * in the {@link #matches(AudioFormat)} method. However, methods which rely on
+ * the installed service providers, like
+ * {@link AudioSystem#isConversionSupported (AudioFormat, AudioFormat)
+ * isConversionSupported} may consider properties, depending on the respective
+ * service provider implementation.
+ * <p>
+ * The following table lists some common properties which service providers
+ * should use, if applicable:
*
* <table border=0>
* <caption>Audio Format Properties</caption>
@@ -99,7 +103,7 @@
* <tr>
* <td>"vbr"</td>
* <td>{@link java.lang.Boolean Boolean}</td>
- * <td><code>true</code>, if the file is encoded in variable bit
+ * <td>{@code true}, if the file is encoded in variable bit
* rate (VBR)</td>
* </tr>
* <tr>
@@ -108,11 +112,10 @@
* <td>encoding/conversion quality, 1..100</td>
* </tr>
* </table>
- *
- * <p>Vendors of service providers (plugins) are encouraged
- * to seek information about other already established
- * properties in third party plugins, and follow the same
- * conventions.
+ * <p>
+ * Vendors of service providers (plugins) are encouraged to seek information
+ * about other already established properties in third party plugins, and follow
+ * the same conventions.
*
* @author Kara Kytle
* @author Florian Bomers
@@ -124,16 +127,14 @@
*/
public class AudioFormat {
- // INSTANCE VARIABLES
-
-
/**
* The audio encoding technique used by this format.
*/
protected Encoding encoding;
/**
- * The number of samples played or recorded per second, for sounds that have this format.
+ * The number of samples played or recorded per second, for sounds that have
+ * this format.
*/
protected float sampleRate;
@@ -153,34 +154,37 @@
protected int frameSize;
/**
- * The number of frames played or recorded per second, for sounds that have this format.
+ * The number of frames played or recorded per second, for sounds that have
+ * this format.
*/
protected float frameRate;
/**
- * Indicates whether the audio data is stored in big-endian or little-endian order.
+ * Indicates whether the audio data is stored in big-endian or little-endian
+ * order.
*/
protected boolean bigEndian;
-
- /** The set of properties */
+ /**
+ * The set of properties.
+ */
private HashMap<String, Object> properties;
-
/**
- * Constructs an <code>AudioFormat</code> with the given parameters.
- * The encoding specifies the convention used to represent the data.
- * The other parameters are further explained in the {@link AudioFormat
- * class description}.
- * @param encoding the audio encoding technique
- * @param sampleRate the number of samples per second
- * @param sampleSizeInBits the number of bits in each sample
- * @param channels the number of channels (1 for mono, 2 for stereo, and so on)
- * @param frameSize the number of bytes in each frame
- * @param frameRate the number of frames per second
- * @param bigEndian indicates whether the data for a single sample
- * is stored in big-endian byte order (<code>false</code>
- * means little-endian)
+ * Constructs an {@code AudioFormat} with the given parameters. The encoding
+ * specifies the convention used to represent the data. The other parameters
+ * are further explained in the {@link AudioFormat class description}.
+ *
+ * @param encoding the audio encoding technique
+ * @param sampleRate the number of samples per second
+ * @param sampleSizeInBits the number of bits in each sample
+ * @param channels the number of channels (1 for mono, 2 for stereo,
+ * and so on)
+ * @param frameSize the number of bytes in each frame
+ * @param frameRate the number of frames per second
+ * @param bigEndian indicates whether the data for a single sample is
+ * stored in big-endian byte order ({@code false} means
+ * little-endian)
*/
public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
int channels, int frameSize, float frameRate, boolean bigEndian) {
@@ -195,25 +199,22 @@
this.properties = null;
}
-
/**
- * Constructs an <code>AudioFormat</code> with the given parameters.
- * The encoding specifies the convention used to represent the data.
- * The other parameters are further explained in the {@link AudioFormat
- * class description}.
- * @param encoding the audio encoding technique
- * @param sampleRate the number of samples per second
- * @param sampleSizeInBits the number of bits in each sample
- * @param channels the number of channels (1 for mono, 2 for
- * stereo, and so on)
- * @param frameSize the number of bytes in each frame
- * @param frameRate the number of frames per second
- * @param bigEndian indicates whether the data for a single sample
- * is stored in big-endian byte order
- * (<code>false</code> means little-endian)
- * @param properties a <code>Map<String,Object></code> object
- * containing format properties
+ * Constructs an {@code AudioFormat} with the given parameters. The encoding
+ * specifies the convention used to represent the data. The other parameters
+ * are further explained in the {@link AudioFormat class description}.
*
+ * @param encoding the audio encoding technique
+ * @param sampleRate the number of samples per second
+ * @param sampleSizeInBits the number of bits in each sample
+ * @param channels the number of channels (1 for mono, 2 for stereo, and so
+ * on)
+ * @param frameSize the number of bytes in each frame
+ * @param frameRate the number of frames per second
+ * @param bigEndian indicates whether the data for a single sample is
+ * stored in big-endian byte order ({@code false} means little-endian)
+ * @param properties a {@code Map<String, Object>} object containing format
+ * properties
* @since 1.5
*/
public AudioFormat(Encoding encoding, float sampleRate,
@@ -225,20 +226,20 @@
this.properties = new HashMap<String, Object>(properties);
}
-
/**
- * Constructs an <code>AudioFormat</code> with a linear PCM encoding and
- * the given parameters. The frame size is set to the number of bytes
- * required to contain one sample from each channel, and the frame rate
- * is set to the sample rate.
+ * Constructs an {@code AudioFormat} with a linear PCM encoding and the
+ * given parameters. The frame size is set to the number of bytes required
+ * to contain one sample from each channel, and the frame rate is set to the
+ * sample rate.
*
- * @param sampleRate the number of samples per second
- * @param sampleSizeInBits the number of bits in each sample
- * @param channels the number of channels (1 for mono, 2 for stereo, and so on)
- * @param signed indicates whether the data is signed or unsigned
- * @param bigEndian indicates whether the data for a single sample
- * is stored in big-endian byte order (<code>false</code>
- * means little-endian)
+ * @param sampleRate the number of samples per second
+ * @param sampleSizeInBits the number of bits in each sample
+ * @param channels the number of channels (1 for mono, 2 for stereo, and so
+ * on)
+ * @param signed indicates whether the data is signed or unsigned
+ * @param bigEndian indicates whether the data for a single sample is
+ * stored in big-endian byte order ({@code false} means
+ * little-endian)
*/
public AudioFormat(float sampleRate, int sampleSizeInBits,
int channels, boolean signed, boolean bigEndian) {
@@ -269,19 +270,17 @@
}
/**
- * Obtains the sample rate.
- * For compressed formats, the return value is the sample rate of the uncompressed
- * audio data.
- * When this AudioFormat is used for queries (e.g. {@link
- * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
- * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
- * DataLine.Info#getFormats() DataLine.Info.getFormats}), a sample rate of
- * <code>AudioSystem.NOT_SPECIFIED</code> means that any sample rate is
- * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
- * the sample rate is not defined for this audio format.
- * @return the number of samples per second,
- * or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Obtains the sample rate. For compressed formats, the return value is the
+ * sample rate of the uncompressed audio data. When this AudioFormat is used
+ * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+ * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+ * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample rate
+ * of {@code AudioSystem.NOT_SPECIFIED} means that any sample rate is
+ * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+ * sample rate is not defined for this audio format.
*
+ * @return the number of samples per second, or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see #getFrameRate()
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -291,19 +290,18 @@
}
/**
- * Obtains the size of a sample.
- * For compressed formats, the return value is the sample size of the
- * uncompressed audio data.
- * When this AudioFormat is used for queries (e.g. {@link
- * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
- * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
- * DataLine.Info#getFormats() DataLine.Info.getFormats}), a sample size of
- * <code>AudioSystem.NOT_SPECIFIED</code> means that any sample size is
- * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
- * the sample size is not defined for this audio format.
- * @return the number of bits in each sample,
- * or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Obtains the size of a sample. For compressed formats, the return value is
+ * the sample size of the uncompressed audio data. When this AudioFormat is
+ * used for queries (e.g. {@link AudioSystem#isConversionSupported(
+ * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
+ * capabilities (e.g.
+ * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample size
+ * of {@code AudioSystem.NOT_SPECIFIED} means that any sample size is
+ * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+ * sample size is not defined for this audio format.
*
+ * @return the number of bits in each sample, or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see #getFrameSize()
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -313,16 +311,15 @@
}
/**
- * Obtains the number of channels.
- * When this AudioFormat is used for queries (e.g. {@link
- * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
- * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
- * DataLine.Info#getFormats() DataLine.Info.getFormats}), a return value of
- * <code>AudioSystem.NOT_SPECIFIED</code> means that any (positive) number of channels is
- * acceptable.
- * @return The number of channels (1 for mono, 2 for stereo, etc.),
- * or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Obtains the number of channels. When this AudioFormat is used for queries
+ * (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
+ * AudioSystem.isConversionSupported}) or capabilities (e.g.
+ * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a return
+ * value of {@code AudioSystem.NOT_SPECIFIED} means that any (positive)
+ * number of channels is acceptable.
*
+ * @return The number of channels (1 for mono, 2 for stereo, etc.), or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see AudioSystem#NOT_SPECIFIED
*/
public int getChannels() {
@@ -331,17 +328,16 @@
}
/**
- * Obtains the frame size in bytes.
- * When this AudioFormat is used for queries (e.g. {@link
- * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
- * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
- * DataLine.Info#getFormats() DataLine.Info.getFormats}), a frame size of
- * <code>AudioSystem.NOT_SPECIFIED</code> means that any frame size is
- * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
- * the frame size is not defined for this audio format.
- * @return the number of bytes per frame,
- * or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Obtains the frame size in bytes. When this AudioFormat is used for
+ * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat,
+ * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g.
+ * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame size
+ * of {@code AudioSystem.NOT_SPECIFIED} means that any frame size is
+ * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+ * frame size is not defined for this audio format.
*
+ * @return the number of bytes per frame, or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see #getSampleSizeInBits()
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -351,17 +347,17 @@
}
/**
- * Obtains the frame rate in frames per second.
- * When this AudioFormat is used for queries (e.g. {@link
- * AudioSystem#isConversionSupported(AudioFormat, AudioFormat)
- * AudioSystem.isConversionSupported}) or capabilities (e.g. {@link
- * DataLine.Info#getFormats() DataLine.Info.getFormats}), a frame rate of
- * <code>AudioSystem.NOT_SPECIFIED</code> means that any frame rate is
- * acceptable. <code>AudioSystem.NOT_SPECIFIED</code> is also returned when
- * the frame rate is not defined for this audio format.
- * @return the number of frames per second,
- * or <code>AudioSystem.NOT_SPECIFIED</code>
+ * Obtains the frame rate in frames per second. When this AudioFormat is
+ * used for queries (e.g. {@link AudioSystem#isConversionSupported(
+ * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or
+ * capabilities (e.g.
+ * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame rate
+ * of {@code AudioSystem.NOT_SPECIFIED} means that any frame rate is
+ * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the
+ * frame rate is not defined for this audio format.
*
+ * @return the number of frames per second, or
+ * {@code AudioSystem.NOT_SPECIFIED}
* @see #getSampleRate()
* @see AudioSystem#NOT_SPECIFIED
*/
@@ -370,29 +366,25 @@
return frameRate;
}
-
/**
* Indicates whether the audio data is stored in big-endian or little-endian
- * byte order. If the sample size is not more than one byte, the return value is
- * irrelevant.
- * @return <code>true</code> if the data is stored in big-endian byte order,
- * <code>false</code> if little-endian
+ * byte order. If the sample size is not more than one byte, the return
+ * value is irrelevant.
+ *
+ * @return {@code true} if the data is stored in big-endian byte order,
+ * {@code false} if little-endian
*/
public boolean isBigEndian() {
return bigEndian;
}
-
/**
- * Obtain an unmodifiable map of properties.
- * The concept of properties is further explained in
- * the {@link AudioFileFormat class description}.
+ * Obtain an unmodifiable map of properties. The concept of properties is
+ * further explained in the {@link AudioFileFormat class description}.
*
- * @return a <code>Map<String,Object></code> object containing
- * all properties. If no properties are recognized, an empty map is
- * returned.
- *
+ * @return a {@code Map<String, Object>} object containing all properties.
+ * If no properties are recognized, an empty map is returned.
* @see #getProperty(String)
* @since 1.5
*/
@@ -406,20 +398,16 @@
return Collections.unmodifiableMap(ret);
}
-
/**
- * Obtain the property value specified by the key.
- * The concept of properties is further explained in
- * the {@link AudioFileFormat class description}.
+ * Obtain the property value specified by the key. The concept of properties
+ * is further explained in the {@link AudioFileFormat class description}.
+ * <p>
+ * If the specified property is not defined for a particular file format,
+ * this method returns {@code null}.
*
- * <p>If the specified property is not defined for a
- * particular file format, this method returns
- * <code>null</code>.
- *
- * @param key the key of the desired property
- * @return the value of the property with the specified key,
- * or <code>null</code> if the property does not exist.
- *
+ * @param key the key of the desired property
+ * @return the value of the property with the specified key, or {@code null}
+ * if the property does not exist
* @see #properties()
* @since 1.5
*/
@@ -430,21 +418,18 @@
return properties.get(key);
}
-
/**
- * Indicates whether this format matches the one specified.
- * To match, two formats must have the same encoding,
- * and consistent values of the number of channels, sample rate, sample size,
- * frame rate, and frame size.
- * The values of the property are consistent if they are equal
- * or the specified format has the property value
- * {@code AudioSystem.NOT_SPECIFIED}.
- * The byte order (big-endian or little-endian) must be the same
- * if the sample size is greater than one byte.
+ * Indicates whether this format matches the one specified. To match, two
+ * formats must have the same encoding, and consistent values of the number
+ * of channels, sample rate, sample size, frame rate, and frame size. The
+ * values of the property are consistent if they are equal or the specified
+ * format has the property value {@code AudioSystem.NOT_SPECIFIED}. The byte
+ * order (big-endian or little-endian) must be the same if the sample size
+ * is greater than one byte.
*
- * @param format format to test for match
+ * @param format format to test for match
* @return {@code true} if this format matches the one specified,
- * {@code false} otherwise.
+ * {@code false} otherwise
*/
public boolean matches(AudioFormat format) {
if (format.getEncoding().equals(getEncoding())
@@ -465,14 +450,14 @@
return false;
}
-
/**
- * Returns a string that describes the format, such as:
- * "PCM SIGNED 22050 Hz 16 bit mono big-endian". The contents of the string
- * may vary between implementations of Java Sound.
+ * Returns a string that describes the format, such as: "PCM SIGNED 22050 Hz
+ * 16 bit mono big-endian". The contents of the string may vary between
+ * implementations of Java Sound.
*
* @return a string that describes the format parameters
*/
+ @Override
public String toString() {
String sEncoding = "";
if (getEncoding() != null) {
@@ -546,42 +531,36 @@
}
/**
- * The <code>Encoding</code> class names the specific type of data representation
- * used for an audio stream. The encoding includes aspects of the
- * sound format other than the number of channels, sample rate, sample size,
- * frame rate, frame size, and byte order.
+ * The {@code Encoding} class names the specific type of data representation
+ * used for an audio stream. The encoding includes aspects of the sound
+ * format other than the number of channels, sample rate, sample size, frame
+ * rate, frame size, and byte order.
* <p>
* One ubiquitous type of audio encoding is pulse-code modulation (PCM),
* which is simply a linear (proportional) representation of the sound
- * waveform. With PCM, the number stored in each sample is proportional
- * to the instantaneous amplitude of the sound pressure at that point in
- * time. The numbers may be signed or unsigned integers or floats.
- * Besides PCM, other encodings include mu-law and a-law, which are nonlinear
- * mappings of the sound amplitude that are often used for recording speech.
+ * waveform. With PCM, the number stored in each sample is proportional to
+ * the instantaneous amplitude of the sound pressure at that point in time.
+ * The numbers may be signed or unsigned integers or floats. Besides PCM,
+ * other encodings include mu-law and a-law, which are nonlinear mappings of
+ * the sound amplitude that are often used for recording speech.
* <p>
* You can use a predefined encoding by referring to one of the static
- * objects created by this class, such as PCM_SIGNED or
- * PCM_UNSIGNED. Service providers can create new encodings, such as
- * compressed audio formats, and make
- * these available through the <code>{@link AudioSystem}</code> class.
+ * objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED.
+ * Service providers can create new encodings, such as compressed audio
+ * formats, and make these available through the {@link AudioSystem} class.
* <p>
- * The <code>Encoding</code> class is static, so that all
- * <code>AudioFormat</code> objects that have the same encoding will refer
- * to the same object (rather than different instances of the same class).
- * This allows matches to be made by checking that two format's encodings
- * are equal.
+ * The {@code Encoding} class is static, so that all {@code AudioFormat}
+ * objects that have the same encoding will refer to the same object (rather
+ * than different instances of the same class). This allows matches to be
+ * made by checking that two format's encodings are equal.
*
+ * @author Kara Kytle
* @see AudioFormat
* @see javax.sound.sampled.spi.FormatConversionProvider
- *
- * @author Kara Kytle
* @since 1.3
*/
public static class Encoding {
-
- // ENCODING DEFINES
-
/**
* Specifies signed, linear PCM data.
*/
@@ -609,31 +588,24 @@
*/
public static final Encoding ALAW = new Encoding("ALAW");
-
- // INSTANCE VARIABLES
-
/**
* Encoding name.
*/
private String name;
-
- // CONSTRUCTOR
-
/**
* Constructs a new encoding.
- * @param name the name of the new type of encoding
+ *
+ * @param name the name of the new type of encoding
*/
public Encoding(String name) {
this.name = name;
}
-
- // METHODS
-
/**
- * Finalizes the equals method
+ * Finalizes the equals method.
*/
+ @Override
public final boolean equals(Object obj) {
if (toString() == null) {
return (obj != null) && (obj.toString() == null);
@@ -645,8 +617,9 @@
}
/**
- * Finalizes the hashCode method
+ * Finalizes the hashCode method.
*/
+ @Override
public final int hashCode() {
if (toString() == null) {
return 0;
@@ -655,16 +628,17 @@
}
/**
- * Provides the <code>String</code> representation of the encoding. This <code>String</code> is
- * the same name that was passed to the constructor. For the predefined encodings, the name
- * is similar to the encoding's variable (field) name. For example, <code>PCM_SIGNED.toString()</code> returns
- * the name "pcm_signed".
+ * Provides the {@code String} representation of the encoding. This
+ * {@code String} is the same name that was passed to the constructor.
+ * For the predefined encodings, the name is similar to the encoding's
+ * variable (field) name. For example, {@code PCM_SIGNED.toString()}
+ * returns the name "pcm_signed".
*
* @return the encoding name
*/
+ @Override
public final String toString() {
return name;
}
-
- } // class Encoding
+ }
}
--- a/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioInputStream.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,27 +25,24 @@
package javax.sound.sampled;
+import java.io.IOException;
import java.io.InputStream;
-import java.io.PushbackInputStream;
-import java.io.IOException;
/**
* An audio input stream is an input stream with a specified audio format and
- * length. The length is expressed in sample frames, not bytes.
- * Several methods are provided for reading a certain number of bytes from
- * the stream, or an unspecified number of bytes.
- * The audio input stream keeps track of the last byte that was read.
- * You can skip over an arbitrary number of bytes to get to a later position
- * for reading. An audio input stream may support marks. When you set a mark,
- * the current position is remembered so that you can return to it later.
+ * length. The length is expressed in sample frames, not bytes. Several methods
+ * are provided for reading a certain number of bytes from the stream, or an
+ * unspecified number of bytes. The audio input stream keeps track of the last
+ * byte that was read. You can skip over an arbitrary number of bytes to get to
+ * a later position for reading. An audio input stream may support marks. When
+ * you set a mark, the current position is remembered so that you can return to
+ * it later.
* <p>
- * The <code>AudioSystem</code> class includes many methods that manipulate
- * <code>AudioInputStream</code> objects.
- * For example, the methods let you:
+ * The {@code AudioSystem} class includes many methods that manipulate
+ * {@code AudioInputStream} objects. For example, the methods let you:
* <ul>
- * <li> obtain an
- * audio input stream from an external audio file, stream, or URL
+ * <li> obtain an audio input stream from an external audio file, stream, or URL
* <li> write an external file from an audio input stream
* <li> convert an audio input stream to a different audio format
* </ul>
@@ -53,16 +50,15 @@
* @author David Rivas
* @author Kara Kytle
* @author Florian Bomers
- *
* @see AudioSystem
- * @see Clip#open(AudioInputStream) Clip.open(AudioInputStream)
+ * @see Clip#open(AudioInputStream)
* @since 1.3
*/
public class AudioInputStream extends InputStream {
/**
- * The <code>InputStream</code> from which this <code>AudioInputStream</code>
- * object was constructed.
+ * The {@code InputStream} from which this {@code AudioInputStream} object
+ * was constructed.
*/
private InputStream stream;
@@ -92,35 +88,34 @@
private long markpos;
/**
- * When the underlying stream could only return
- * a non-integral number of frames, store
- * the remainder in a temporary buffer
+ * When the underlying stream could only return a non-integral number of
+ * frames, store the remainder in a temporary buffer.
*/
private byte[] pushBackBuffer = null;
/**
- * number of valid bytes in the pushBackBuffer
+ * number of valid bytes in the pushBackBuffer.
*/
private int pushBackLen = 0;
/**
- * MarkBuffer at mark position
+ * MarkBuffer at mark position.
*/
private byte[] markPushBackBuffer = null;
/**
- * number of valid bytes in the markPushBackBuffer
+ * number of valid bytes in the markPushBackBuffer.
*/
private int markPushBackLen = 0;
-
/**
- * Constructs an audio input stream that has the requested format and length in sample frames,
- * using audio data from the specified input stream.
- * @param stream the stream on which this <code>AudioInputStream</code>
- * object is based
- * @param format the format of this stream's audio data
- * @param length the length in sample frames of the data in this stream
+ * Constructs an audio input stream that has the requested format and length
+ * in sample frames, using audio data from the specified input stream.
+ *
+ * @param stream the stream on which this {@code AudioInputStream} object
+ * is based
+ * @param format the format of this stream's audio data
+ * @param length the length in sample frames of the data in this stream
*/
public AudioInputStream(InputStream stream, AudioFormat format, long length) {
@@ -141,12 +136,12 @@
markpos = 0;
}
-
/**
- * Constructs an audio input stream that reads its data from the target
- * data line indicated. The format of the stream is the same as that of
- * the target data line, and the length is AudioSystem#NOT_SPECIFIED.
- * @param line the target data line from which this stream obtains its data.
+ * Constructs an audio input stream that reads its data from the target data
+ * line indicated. The format of the stream is the same as that of the
+ * target data line, and the length is AudioSystem#NOT_SPECIFIED.
+ *
+ * @param line the target data line from which this stream obtains its data
* @see AudioSystem#NOT_SPECIFIED
*/
public AudioInputStream(TargetDataLine line) {
@@ -164,29 +159,29 @@
markpos = 0;
}
-
/**
* Obtains the audio format of the sound data in this audio input stream.
+ *
* @return an audio format object describing this stream's format
*/
public AudioFormat getFormat() {
return format;
}
-
/**
- * Obtains the length of the stream, expressed in sample frames rather than bytes.
+ * Obtains the length of the stream, expressed in sample frames rather than
+ * bytes.
+ *
* @return the length in sample frames
*/
public long getFrameLength() {
return frameLength;
}
-
/**
- * Reads the next byte of data from the audio input stream. The audio input
- * stream's frame size must be one byte, or an <code>IOException</code>
- * will be thrown.
+ * Reads the next byte of data from the audio input stream. The audio input
+ * stream's frame size must be one byte, or an {@code IOException} will be
+ * thrown.
*
* @return the next byte of data, or -1 if the end of the stream is reached
* @throws IOException if an input or output error occurs
@@ -194,6 +189,7 @@
* @see #read(byte[])
* @see #available
*/
+ @Override
public int read() throws IOException {
if( frameSize != 1 ) {
throw new IOException("cannot read a single byte if frame size > 1");
@@ -208,50 +204,50 @@
return data[0] & 0xFF;
}
-
/**
- * Reads some number of bytes from the audio input stream and stores them into
- * the buffer array <code>b</code>. The number of bytes actually read is
- * returned as an integer. This method blocks until input data is
- * available, the end of the stream is detected, or an exception is thrown.
- * <p>This method will always read an integral number of frames.
- * If the length of the array is not an integral number
- * of frames, a maximum of <code>b.length - (b.length % frameSize)
- * </code> bytes will be read.
+ * Reads some number of bytes from the audio input stream and stores them
+ * into the buffer array {@code b}. The number of bytes actually read is
+ * returned as an integer. This method blocks until input data is available,
+ * the end of the stream is detected, or an exception is thrown.
+ * <p>
+ * This method will always read an integral number of frames. If the length
+ * of the array is not an integral number of frames, a maximum of
+ * {@code b.length - (b.length % frameSize)} bytes will be read.
*
- * @param b the buffer into which the data is read
- * @return the total number of bytes read into the buffer, or -1 if there
- * is no more data because the end of the stream has been reached
+ * @param b the buffer into which the data is read
+ * @return the total number of bytes read into the buffer, or -1 if there is
+ * no more data because the end of the stream has been reached
* @throws IOException if an input or output error occurs
* @see #read(byte[], int, int)
* @see #read()
* @see #available
*/
+ @Override
public int read(byte[] b) throws IOException {
return read(b,0,b.length);
}
-
/**
* Reads up to a specified maximum number of bytes of data from the audio
* stream, putting them into the given byte array.
- * <p>This method will always read an integral number of frames.
- * If <code>len</code> does not specify an integral number
- * of frames, a maximum of <code>len - (len % frameSize)
- * </code> bytes will be read.
+ * <p>
+ * This method will always read an integral number of frames. If {@code len}
+ * does not specify an integral number of frames, a maximum of
+ * {@code len - (len % frameSize)} bytes will be read.
*
- * @param b the buffer into which the data is read
- * @param off the offset, from the beginning of array <code>b</code>, at which
- * the data will be written
- * @param len the maximum number of bytes to read
- * @return the total number of bytes read into the buffer, or -1 if there
- * is no more data because the end of the stream has been reached
+ * @param b the buffer into which the data is read
+ * @param off the offset, from the beginning of array {@code b}, at which
+ * the data will be written
+ * @param len the maximum number of bytes to read
+ * @return the total number of bytes read into the buffer, or -1 if there is
+ * no more data because the end of the stream has been reached
* @throws IOException if an input or output error occurs
* @see #read(byte[])
* @see #read()
* @see #skip
* @see #available
*/
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
// make sure we don't read fractions of a frame.
@@ -313,16 +309,17 @@
return bytesRead;
}
-
/**
- * Skips over and discards a specified number of bytes from this
- * audio input stream.
- * @param n the requested number of bytes to be skipped
+ * Skips over and discards a specified number of bytes from this audio input
+ * stream.
+ *
+ * @param n the requested number of bytes to be skipped
* @return the actual number of bytes skipped
* @throws IOException if an input or output error occurs
* @see #read
* @see #available
*/
+ @Override
public long skip(long n) throws IOException {
// make sure not to skip fractional frames
@@ -351,21 +348,23 @@
}
-
/**
- * Returns the maximum number of bytes that can be read (or skipped over) from this
- * audio input stream without blocking. This limit applies only to the next invocation of
- * a <code>read</code> or <code>skip</code> method for this audio input stream; the limit
- * can vary each time these methods are invoked.
- * Depending on the underlying stream,an IOException may be thrown if this
- * stream is closed.
- * @return the number of bytes that can be read from this audio input stream without blocking
+ * Returns the maximum number of bytes that can be read (or skipped over)
+ * from this audio input stream without blocking. This limit applies only
+ * to the next invocation of a {@code read} or {@code skip} method for this
+ * audio input stream; the limit can vary each time these methods are
+ * invoked. Depending on the underlying stream, an IOException may be thrown
+ * if this stream is closed.
+ *
+ * @return the number of bytes that can be read from this audio input stream
+ * without blocking
* @throws IOException if an input or output error occurs
* @see #read(byte[], int, int)
* @see #read(byte[])
* @see #read()
* @see #skip
*/
+ @Override
public int available() throws IOException {
int temp = stream.available();
@@ -378,25 +377,26 @@
}
}
-
/**
- * Closes this audio input stream and releases any system resources associated
- * with the stream.
+ * Closes this audio input stream and releases any system resources
+ * associated with the stream.
+ *
* @throws IOException if an input or output error occurs
*/
+ @Override
public void close() throws IOException {
stream.close();
}
-
/**
* Marks the current position in this audio input stream.
- * @param readlimit the maximum number of bytes that can be read before
- * the mark position becomes invalid.
+ *
+ * @param readlimit the maximum number of bytes that can be read before the
+ * mark position becomes invalid.
* @see #reset
* @see #markSupported
*/
-
+ @Override
public void mark(int readlimit) {
stream.mark(readlimit);
@@ -413,14 +413,15 @@
}
}
-
/**
- * Repositions this audio input stream to the position it had at the time its
- * <code>mark</code> method was last invoked.
- * @throws IOException if an input or output error occurs.
+ * Repositions this audio input stream to the position it had at the time
+ * its {@code mark} method was last invoked.
+ *
+ * @throws IOException if an input or output error occurs
* @see #mark
* @see #markSupported
*/
+ @Override
public void reset() throws IOException {
stream.reset();
@@ -435,21 +436,21 @@
}
}
-
/**
- * Tests whether this audio input stream supports the <code>mark</code> and
- * <code>reset</code> methods.
- * @return <code>true</code> if this stream supports the <code>mark</code>
- * and <code>reset</code> methods; <code>false</code> otherwise
+ * Tests whether this audio input stream supports the {@code mark} and
+ * {@code reset} methods.
+ *
+ * @return {@code true} if this stream supports the {@code mark} and
+ * {@code reset} methods; {@code false} otherwise
* @see #mark
* @see #reset
*/
+ @Override
public boolean markSupported() {
return stream.markSupported();
}
-
/**
* Private inner class that makes a TargetDataLine look like an InputStream.
*/
@@ -460,19 +461,19 @@
*/
TargetDataLine line;
-
TargetDataLineInputStream(TargetDataLine line) {
super();
this.line = line;
}
-
+ @Override
public int available() throws IOException {
return line.available();
}
//$$fb 2001-07-16: added this method to correctly close the underlying TargetDataLine.
// fixes bug 4479984
+ @Override
public void close() throws IOException {
// the line needs to be flushed and stopped to avoid a dead lock...
// Probably related to bugs 4417527, 4334868, 4383457
@@ -483,6 +484,7 @@
line.close();
}
+ @Override
public int read() throws IOException {
byte[] b = new byte[1];
@@ -502,7 +504,7 @@
return value;
}
-
+ @Override
public int read(byte[] b, int off, int len) throws IOException {
try {
return line.read(b, off, len);
--- a/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioPermission.java Wed Jun 04 17:14:56 2014 +0400
@@ -28,18 +28,18 @@
import java.security.BasicPermission;
/**
- * The <code>AudioPermission</code> class represents access rights to the audio
- * system resources. An <code>AudioPermission</code> contains a target name
- * but no actions list; you either have the named permission or you don't.
+ * The {@code AudioPermission} class represents access rights to the audio
+ * system resources. An {@code AudioPermission} contains a target name but no
+ * actions list; you either have the named permission or you don't.
* <p>
* The target name is the name of the audio permission (see the table below).
- * The names follow the hierarchical property-naming convention. Also, an asterisk
- * can be used to represent all the audio permissions.
+ * The names follow the hierarchical property-naming convention. Also, an
+ * asterisk can be used to represent all the audio permissions.
* <p>
- * The following table lists the possible <code>AudioPermission</code> target names.
- * For each name, the table provides a description of exactly what that permission
- * allows, as well as a discussion of the risks of granting code the permission.
- *
+ * The following table lists the possible {@code AudioPermission} target names.
+ * For each name, the table provides a description of exactly what that
+ * permission allows, as well as a discussion of the risks of granting code the
+ * permission.
*
* <table border=1 cellpadding=5 summary="permission target name, what the permission allows, and associated risks">
* <tr>
@@ -57,7 +57,7 @@
* applications because the audio from one line may be mixed with other audio
* being played on the system, or because manipulation of a mixer affects the
* audio for all lines using that mixer.</td>
- *</tr>
+ * </tr>
*
* <tr>
* <td>record</td>
@@ -68,42 +68,40 @@
* applications because manipulation of a mixer affects the audio for all lines
* using that mixer.
* This permission can enable an applet or application to eavesdrop on a user.</td>
- *</tr>
- *</table>
- *<p>
+ * </tr>
+ * </table>
*
* @author Kara Kytle
* @since 1.3
*/
public class AudioPermission extends BasicPermission {
+
private static final long serialVersionUID = -5518053473477801126L;
/**
- * Creates a new <code>AudioPermission</code> object that has the specified
- * symbolic name, such as "play" or "record". An asterisk can be used to indicate
- * all audio permissions.
- * @param name the name of the new <code>AudioPermission</code>
+ * Creates a new {@code AudioPermission} object that has the specified
+ * symbolic name, such as "play" or "record". An asterisk can be used to
+ * indicate all audio permissions.
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @param name the name of the new {@code AudioPermission}
+ * @throws NullPointerException if {@code name} is {@code null}
+ * @throws IllegalArgumentException if {@code name} is empty
*/
- public AudioPermission(String name) {
-
+ public AudioPermission(final String name) {
super(name);
}
/**
- * Creates a new <code>AudioPermission</code> object that has the specified
- * symbolic name, such as "play" or "record". The <code>actions</code>
- * parameter is currently unused and should be <code>null</code>.
- * @param name the name of the new <code>AudioPermission</code>
- * @param actions (unused; should be <code>null</code>)
+ * Creates a new {@code AudioPermission} object that has the specified
+ * symbolic name, such as "play" or "record". The {@code actions} parameter
+ * is currently unused and should be {@code null}.
*
- * @throws NullPointerException if <code>name</code> is <code>null</code>.
- * @throws IllegalArgumentException if <code>name</code> is empty.
+ * @param name the name of the new {@code AudioPermission}
+ * @param actions (unused; should be {@code null})
+ * @throws NullPointerException if {@code name} is {@code null}
+ * @throws IllegalArgumentException if {@code name} is empty
*/
- public AudioPermission(String name, String actions) {
-
+ public AudioPermission(final String name, final String actions) {
super(name, actions);
}
}
--- a/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/AudioSystem.java Wed Jun 04 17:14:56 2014 +0400
@@ -50,29 +50,24 @@
/**
- * The <code>AudioSystem</code> class acts as the entry point to the
- * sampled-audio system resources. This class lets you query and
- * access the mixers that are installed on the system.
- * <code>AudioSystem</code> includes a number of
- * methods for converting audio data between different formats, and for
- * translating between audio files and streams. It also provides a method
- * for obtaining a <code>{@link Line}</code> directly from the
- * <code>AudioSystem</code> without dealing explicitly
+ * The {@code AudioSystem} class acts as the entry point to the sampled-audio
+ * system resources. This class lets you query and access the mixers that are
+ * installed on the system. {@code AudioSystem} includes a number of methods for
+ * converting audio data between different formats, and for translating between
+ * audio files and streams. It also provides a method for obtaining a
+ * {@link Line} directly from the {@code AudioSystem} without dealing explicitly
* with mixers.
- *
- * <p>Properties can be used to specify the default mixer
- * for specific line types.
- * Both system properties and a properties file are considered.
- * The <code>sound.properties</code> properties file is read from
- * an implementation-specific location (typically it is the <code>lib</code>
- * directory in the Java installation directory).
- * If a property exists both as a system property and in the
- * properties file, the system property takes precedence. If none is
- * specified, a suitable default is chosen among the available devices.
- * The syntax of the properties file is specified in
- * {@link java.util.Properties#load(InputStream) Properties.load}. The
- * following table lists the available property keys and which methods
- * consider them:
+ * <p>
+ * Properties can be used to specify the default mixer for specific line types.
+ * Both system properties and a properties file are considered. The
+ * {@code sound.properties} properties file is read from an
+ * implementation-specific location (typically it is the {@code lib} directory
+ * in the Java installation directory). If a property exists both as a system
+ * property and in the properties file, the system property takes precedence.
+ * If none is specified, a suitable default is chosen among the available
+ * devices. The syntax of the properties file is specified in
+ * {@link java.util.Properties#load(InputStream) Properties.load}. The following
+ * table lists the available property keys and which methods consider them:
*
* <table border=0>
* <caption>Audio System Property Keys</caption>
@@ -82,84 +77,68 @@
* <th>Affected Method(s)</th>
* </tr>
* <tr>
- * <td><code>javax.sound.sampled.Clip</code></td>
+ * <td>{@code javax.sound.sampled.Clip}</td>
* <td>{@link Clip}</td>
* <td>{@link #getLine}, {@link #getClip}</td>
* </tr>
* <tr>
- * <td><code>javax.sound.sampled.Port</code></td>
+ * <td>{@code javax.sound.sampled.Port}</td>
* <td>{@link Port}</td>
* <td>{@link #getLine}</td>
* </tr>
* <tr>
- * <td><code>javax.sound.sampled.SourceDataLine</code></td>
+ * <td>{@code javax.sound.sampled.SourceDataLine}</td>
* <td>{@link SourceDataLine}</td>
* <td>{@link #getLine}, {@link #getSourceDataLine}</td>
* </tr>
* <tr>
- * <td><code>javax.sound.sampled.TargetDataLine</code></td>
+ * <td>{@code javax.sound.sampled.TargetDataLine}</td>
* <td>{@link TargetDataLine}</td>
* <td>{@link #getLine}, {@link #getTargetDataLine}</td>
* </tr>
* </table>
*
- * The property value consists of the provider class name
- * and the mixer name, separated by the hash mark ("#").
- * The provider class name is the fully-qualified
- * name of a concrete {@link javax.sound.sampled.spi.MixerProvider
- * mixer provider} class. The mixer name is matched against
- * the <code>String</code> returned by the <code>getName</code>
- * method of <code>Mixer.Info</code>.
- * Either the class name, or the mixer name may be omitted.
- * If only the class name is specified, the trailing hash mark
- * is optional.
- *
- * <p>If the provider class is specified, and it can be
- * successfully retrieved from the installed providers, the list of
- * <code>Mixer.Info</code> objects is retrieved
- * from the provider. Otherwise, or when these mixers
- * do not provide a subsequent match, the list is retrieved
- * from {@link #getMixerInfo} to contain
- * all available <code>Mixer.Info</code> objects.
- *
- * <p>If a mixer name is specified, the resulting list of
- * <code>Mixer.Info</code> objects is searched:
- * the first one with a matching name, and whose
- * <code>Mixer</code> provides the
+ * The property value consists of the provider class name and the mixer name,
+ * separated by the hash mark ("#"). The provider class name is the
+ * fully-qualified name of a concrete
+ * {@link javax.sound.sampled.spi.MixerProvider mixer provider} class. The mixer
+ * name is matched against the {@code String} returned by the {@code getName}
+ * method of {@code Mixer.Info}. Either the class name, or the mixer name may be
+ * omitted. If only the class name is specified, the trailing hash mark is
+ * optional.
+ * <p>
+ * If the provider class is specified, and it can be successfully retrieved from
+ * the installed providers, the list of {@code Mixer.Info} objects is retrieved
+ * from the provider. Otherwise, or when these mixers do not provide a
+ * subsequent match, the list is retrieved from {@link #getMixerInfo} to contain
+ * all available {@code Mixer.Info} objects.
+ * <p>
+ * If a mixer name is specified, the resulting list of {@code Mixer.Info}
+ * objects is searched: the first one with a matching name, and whose
+ * {@code Mixer} provides the respective line interface, will be returned. If no
+ * matching {@code Mixer.Info} object is found, or the mixer name is not
+ * specified, the first mixer from the resulting list, which provides the
* respective line interface, will be returned.
- * If no matching <code>Mixer.Info</code> object
- * is found, or the mixer name is not specified,
- * the first mixer from the resulting
- * list, which provides the respective line
- * interface, will be returned.
*
- * For example, the property <code>javax.sound.sampled.Clip</code>
- * with a value
- * <code>"com.sun.media.sound.MixerProvider#SunClip"</code>
- * will have the following consequences when
- * <code>getLine</code> is called requesting a <code>Clip</code>
- * instance:
- * if the class <code>com.sun.media.sound.MixerProvider</code> exists
- * in the list of installed mixer providers,
- * the first <code>Clip</code> from the first mixer with name
- * <code>"SunClip"</code> will be returned. If it cannot
- * be found, the first <code>Clip</code> from the first mixer
- * of the specified provider will be returned, regardless of name.
- * If there is none, the first <code>Clip</code> from the first
- * <code>Mixer</code> with name
- * <code>"SunClip"</code> in the list of all mixers
- * (as returned by <code>getMixerInfo</code>) will be returned,
- * or, if not found, the first <code>Clip</code> of the first
- * <code>Mixer</code>that can be found in the list of all
- * mixers is returned.
- * If that fails, too, an <code>IllegalArgumentException</code>
- * is thrown.
+ * For example, the property {@code javax.sound.sampled.Clip} with a value
+ * {@code "com.sun.media.sound.MixerProvider#SunClip"}
+ * will have the following consequences when {@code getLine} is called
+ * requesting a {@code Clip} instance: if the class
+ * {@code com.sun.media.sound.MixerProvider} exists in the list of installed
+ * mixer providers, the first {@code Clip} from the first mixer with name
+ * {@code "SunClip"} will be returned. If it cannot be found, the
+ * first {@code Clip} from the first mixer of the specified provider will be
+ * returned, regardless of name. If there is none, the first {@code Clip} from
+ * the first {@code Mixer} with name {@code "SunClip"} in the list of
+ * all mixers (as returned by {@code getMixerInfo}) will be returned, or, if not
+ * found, the first {@code Clip} of the first {@code Mixer} that can be found in
+ * the list of all mixers is returned. If that fails, too, an
+ * {@code IllegalArgumentException} is thrown.
*
* @author Kara Kytle
* @author Florian Bomers
* @author Matthias Pfisterer
* @author Kevin P. Smith
- *
* @see AudioFormat
* @see AudioInputStream
* @see Mixer
@@ -170,13 +149,12 @@
public class AudioSystem {
/**
- * An integer that stands for an unknown numeric value.
- * This value is appropriate only for signed quantities that do not
- * normally take negative values. Examples include file sizes, frame
- * sizes, buffer sizes, and sample rates.
- * A number of Java Sound constructors accept
- * a value of <code>NOT_SPECIFIED</code> for such parameters. Other
- * methods may also accept or return this value, as documented.
+ * An integer that stands for an unknown numeric value. This value is
+ * appropriate only for signed quantities that do not normally take negative
+ * values. Examples include file sizes, frame sizes, buffer sizes, and
+ * sample rates. A number of Java Sound constructors accept a value of
+ * {@code NOT_SPECIFIED} for such parameters. Other methods may also accept
+ * or return this value, as documented.
*/
public static final int NOT_SPECIFIED = -1;
@@ -186,12 +164,13 @@
private AudioSystem() {
}
-
/**
- * Obtains an array of mixer info objects that represents
- * the set of audio mixers that are currently installed on the system.
- * @return an array of info objects for the currently installed mixers. If no mixers
- * are available on the system, an array of length 0 is returned.
+ * Obtains an array of mixer info objects that represents the set of audio
+ * mixers that are currently installed on the system.
+ *
+ * @return an array of info objects for the currently installed mixers. If
+ * no mixers are available on the system, an array of length 0 is
+ * returned.
* @see #getMixer
*/
public static Mixer.Info[] getMixerInfo() {
@@ -201,16 +180,16 @@
return allInfos;
}
-
/**
* Obtains the requested audio mixer.
- * @param info a <code>Mixer.Info</code> object representing the desired
- * mixer, or <code>null</code> for the system default mixer
+ *
+ * @param info a {@code Mixer.Info} object representing the desired mixer,
+ * or {@code null} for the system default mixer
* @return the requested mixer
- * @throws SecurityException if the requested mixer
- * is unavailable because of security restrictions
- * @throws IllegalArgumentException if the info object does not represent
- * a mixer installed on the system
+ * @throws SecurityException if the requested mixer is unavailable because
+ * of security restrictions
+ * @throws IllegalArgumentException if the info object does not represent a
+ * mixer installed on the system
* @see #getMixerInfo
*/
public static Mixer getMixer(Mixer.Info info) {
@@ -259,17 +238,17 @@
+ (info!=null?info.toString():"null"));
}
+ //$$fb 2002-11-26: fix for 4757930: DOC: AudioSystem.getTarget/SourceLineInfo() is ambiguous
- //$$fb 2002-11-26: fix for 4757930: DOC: AudioSystem.getTarget/SourceLineInfo() is ambiguous
/**
- * Obtains information about all source lines of a particular type that are supported
- * by the installed mixers.
- * @param info a <code>Line.Info</code> object that specifies the kind of
- * lines about which information is requested
- * @return an array of <code>Line.Info</code> objects describing source lines matching
- * the type requested. If no matching source lines are supported, an array of length 0
- * is returned.
+ * Obtains information about all source lines of a particular type that are
+ * supported by the installed mixers.
*
+ * @param info a {@code Line.Info} object that specifies the kind of lines
+ * about which information is requested
+ * @return an array of {@code Line.Info} objects describing source lines
+ * matching the type requested. If no matching source lines are
+ * supported, an array of length 0 is returned.
* @see Mixer#getSourceLineInfo(Line.Info)
*/
public static Line.Info[] getSourceLineInfo(Line.Info info) {
@@ -300,16 +279,15 @@
return returnedArray;
}
-
/**
- * Obtains information about all target lines of a particular type that are supported
- * by the installed mixers.
- * @param info a <code>Line.Info</code> object that specifies the kind of
- * lines about which information is requested
- * @return an array of <code>Line.Info</code> objects describing target lines matching
- * the type requested. If no matching target lines are supported, an array of length 0
- * is returned.
+ * Obtains information about all target lines of a particular type that are
+ * supported by the installed mixers.
*
+ * @param info a {@code Line.Info} object that specifies the kind of lines
+ * about which information is requested
+ * @return an array of {@code Line.Info} objects describing target lines
+ * matching the type requested. If no matching target lines are
+ * supported, an array of length 0 is returned.
* @see Mixer#getTargetLineInfo(Line.Info)
*/
public static Line.Info[] getTargetLineInfo(Line.Info info) {
@@ -340,15 +318,15 @@
return returnedArray;
}
-
/**
- * Indicates whether the system supports any lines that match
- * the specified <code>Line.Info</code> object. A line is supported if
- * any installed mixer supports it.
- * @param info a <code>Line.Info</code> object describing the line for which support is queried
- * @return <code>true</code> if at least one matching line is
- * supported, otherwise <code>false</code>
+ * Indicates whether the system supports any lines that match the specified
+ * {@code Line.Info} object. A line is supported if any installed mixer
+ * supports it.
*
+ * @param info a {@code Line.Info} object describing the line for which
+ * support is queried
+ * @return {@code true} if at least one matching line is supported,
+ * otherwise {@code false}
* @see Mixer#isLineSupported(Line.Info)
*/
public static boolean isLineSupported(Line.Info info) {
@@ -371,40 +349,36 @@
/**
* Obtains a line that matches the description in the specified
- * <code>Line.Info</code> object.
- *
- * <p>If a <code>DataLine</code> is requested, and <code>info</code>
- * is an instance of <code>DataLine.Info</code> specifying at least
- * one fully qualified audio format, the last one
- * will be used as the default format of the returned
- * <code>DataLine</code>.
- *
- * <p>If system properties
- * <code>javax.sound.sampled.Clip</code>,
- * <code>javax.sound.sampled.Port</code>,
- * <code>javax.sound.sampled.SourceDataLine</code> and
- * <code>javax.sound.sampled.TargetDataLine</code> are defined
- * or they are defined in the file "sound.properties",
- * they are used to retrieve default lines.
- * For details, refer to the {@link AudioSystem class description}.
+ * {@code Line.Info} object.
+ * <p>
+ * If a {@code DataLine} is requested, and {@code info} is an instance of
+ * {@code DataLine.Info} specifying at least one fully qualified audio
+ * format, the last one will be used as the default format of the returned
+ * {@code DataLine}.
+ * <p>
+ * If system properties
+ * {@code javax.sound.sampled.Clip},
+ * {@code javax.sound.sampled.Port},
+ * {@code javax.sound.sampled.SourceDataLine} and
+ * {@code javax.sound.sampled.TargetDataLine} are defined or they are
+ * defined in the file "sound.properties", they are used to retrieve default
+ * lines. For details, refer to the {@link AudioSystem class description}.
*
- * If the respective property is not set, or the mixer
- * requested in the property is not installed or does not provide the
- * requested line, all installed mixers are queried for the
- * requested line type. A Line will be returned from the first mixer
- * providing the requested line type.
- *
- * @param info a <code>Line.Info</code> object describing the desired kind of line
- * @return a line of the requested kind
+ * If the respective property is not set, or the mixer requested in the
+ * property is not installed or does not provide the requested line, all
+ * installed mixers are queried for the requested line type. A Line will be
+ * returned from the first mixer providing the requested line type.
*
- * @throws LineUnavailableException if a matching line
- * is not available due to resource restrictions
- * @throws SecurityException if a matching line
- * is not available due to security restrictions
- * @throws IllegalArgumentException if the system does not
- * support at least one line matching the specified
- * <code>Line.Info</code> object
- * through any installed mixer
+ * @param info a {@code Line.Info} object describing the desired kind of
+ * line
+ * @return a line of the requested kind
+ * @throws LineUnavailableException if a matching line is not available due
+ * to resource restrictions
+ * @throws SecurityException if a matching line is not available due to
+ * security restrictions
+ * @throws IllegalArgumentException if the system does not support at least
+ * one line matching the specified {@code Line.Info} object through
+ * any installed mixer
*/
public static Line getLine(Line.Info info) throws LineUnavailableException {
LineUnavailableException lue = null;
@@ -479,37 +453,30 @@
info.toString() + " is supported.");
}
-
/**
- * Obtains a clip that can be used for playing back
- * an audio file or an audio stream. The returned clip
- * will be provided by the default system mixer, or,
- * if not possible, by any other mixer installed in the
- * system that supports a <code>Clip</code>
- * object.
- *
- * <p>The returned clip must be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioInputStream)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * <p>If the system property
- * <code>javax.sound.sampled.Clip</code>
- * is defined or it is defined in the file "sound.properties",
- * it is used to retrieve the default clip.
- * For details, refer to the {@link AudioSystem class description}.
+ * Obtains a clip that can be used for playing back an audio file or an
+ * audio stream. The returned clip will be provided by the default system
+ * mixer, or, if not possible, by any other mixer installed in the system
+ * that supports a {@code Clip} object.
+ * <p>
+ * The returned clip must be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioInputStream)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
+ * <p>
+ * If the system property {@code javax.sound.sampled.Clip} is defined or it
+ * is defined in the file "sound.properties", it is used to retrieve the
+ * default clip. For details, refer to the
+ * {@link AudioSystem class description}.
*
* @return the desired clip object
- *
- * @throws LineUnavailableException if a clip object
- * is not available due to resource restrictions
- * @throws SecurityException if a clip object
- * is not available due to security restrictions
- * @throws IllegalArgumentException if the system does not
- * support at least one clip instance through any installed mixer
- *
+ * @throws LineUnavailableException if a clip object is not available due to
+ * resource restrictions
+ * @throws SecurityException if a clip object is not available due to
+ * security restrictions
+ * @throws IllegalArgumentException if the system does not support at least
+ * one clip instance through any installed mixer
* @see #getClip(Mixer.Info)
* @since 1.5
*/
@@ -522,29 +489,26 @@
return (Clip) AudioSystem.getLine(info);
}
-
/**
- * Obtains a clip from the specified mixer that can be
- * used for playing back an audio file or an audio stream.
+ * Obtains a clip from the specified mixer that can be used for playing back
+ * an audio file or an audio stream.
+ * <p>
+ * The returned clip must be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioInputStream)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
*
- * <p>The returned clip must be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioInputStream)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * @param mixerInfo a <code>Mixer.Info</code> object representing the
- * desired mixer, or <code>null</code> for the system default mixer
+ * @param mixerInfo a {@code Mixer.Info} object representing the desired
+ * mixer, or {@code null} for the system default mixer
* @return a clip object from the specified mixer
*
- * @throws LineUnavailableException if a clip
- * is not available from this mixer due to resource restrictions
- * @throws SecurityException if a clip
- * is not available from this mixer due to security restrictions
- * @throws IllegalArgumentException if the system does not
- * support at least one clip through the specified mixer
- *
+ * @throws LineUnavailableException if a clip is not available from this
+ * mixer due to resource restrictions
+ * @throws SecurityException if a clip is not available from this mixer due
+ * to security restrictions
+ * @throws IllegalArgumentException if the system does not support at least
+ * one clip through the specified mixer
* @see #getClip()
* @since 1.5
*/
@@ -558,45 +522,38 @@
return (Clip) mixer.getLine(info);
}
-
/**
- * Obtains a source data line that can be used for playing back
- * audio data in the format specified by the
- * <code>AudioFormat</code> object. The returned line
- * will be provided by the default system mixer, or,
- * if not possible, by any other mixer installed in the
- * system that supports a matching
- * <code>SourceDataLine</code> object.
- *
- * <p>The returned line should be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioFormat, int)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * <p>The returned <code>SourceDataLine</code>'s default
- * audio format will be initialized with <code>format</code>.
+ * Obtains a source data line that can be used for playing back audio data
+ * in the format specified by the {@code AudioFormat} object. The returned
+ * line will be provided by the default system mixer, or, if not possible,
+ * by any other mixer installed in the system that supports a matching
+ * {@code SourceDataLine} object.
+ * <p>
+ * The returned line should be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioFormat, int)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
+ * <p>
+ * The returned {@code SourceDataLine}'s default audio format will be
+ * initialized with {@code format}.
+ * <p>
+ * If the system property {@code javax.sound.sampled.SourceDataLine} is
+ * defined or it is defined in the file "sound.properties", it is used to
+ * retrieve the default source data line. For details, refer to the
+ * {@link AudioSystem class description}.
*
- * <p>If the system property
- * <code>javax.sound.sampled.SourceDataLine</code>
- * is defined or it is defined in the file "sound.properties",
- * it is used to retrieve the default source data line.
- * For details, refer to the {@link AudioSystem class description}.
- *
- * @param format an <code>AudioFormat</code> object specifying
- * the supported audio format of the returned line,
- * or <code>null</code> for any audio format
- * @return the desired <code>SourceDataLine</code> object
- *
- * @throws LineUnavailableException if a matching source data line
- * is not available due to resource restrictions
- * @throws SecurityException if a matching source data line
- * is not available due to security restrictions
- * @throws IllegalArgumentException if the system does not
- * support at least one source data line supporting the
- * specified audio format through any installed mixer
- *
+ * @param format an {@code AudioFormat} object specifying the supported
+ * audio format of the returned line, or {@code null} for any audio
+ * format
+ * @return the desired {@code SourceDataLine} object
+ * @throws LineUnavailableException if a matching source data line is not
+ * available due to resource restrictions
+ * @throws SecurityException if a matching source data line is not available
+ * due to security restrictions
+ * @throws IllegalArgumentException if the system does not support at least
+ * one source data line supporting the specified audio format
+ * through any installed mixer
* @see #getSourceDataLine(AudioFormat, Mixer.Info)
* @since 1.5
*/
@@ -606,41 +563,33 @@
return (SourceDataLine) AudioSystem.getLine(info);
}
-
/**
- * Obtains a source data line that can be used for playing back
- * audio data in the format specified by the
- * <code>AudioFormat</code> object, provided by the mixer
- * specified by the <code>Mixer.Info</code> object.
- *
- * <p>The returned line should be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioFormat, int)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * <p>The returned <code>SourceDataLine</code>'s default
- * audio format will be initialized with <code>format</code>.
+ * Obtains a source data line that can be used for playing back audio data
+ * in the format specified by the {@code AudioFormat} object, provided by
+ * the mixer specified by the {@code Mixer.Info} object.
+ * <p>
+ * The returned line should be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioFormat, int)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
+ * <p>
+ * The returned {@code SourceDataLine}'s default audio format will be
+ * initialized with {@code format}.
*
- * @param format an <code>AudioFormat</code> object specifying
- * the supported audio format of the returned line,
- * or <code>null</code> for any audio format
- * @param mixerinfo a <code>Mixer.Info</code> object representing
- * the desired mixer, or <code>null</code> for the system
- * default mixer
- * @return the desired <code>SourceDataLine</code> object
- *
- * @throws LineUnavailableException if a matching source data
- * line is not available from the specified mixer due
- * to resource restrictions
- * @throws SecurityException if a matching source data line
- * is not available from the specified mixer due to
- * security restrictions
- * @throws IllegalArgumentException if the specified mixer does
- * not support at least one source data line supporting
- * the specified audio format
- *
+ * @param format an {@code AudioFormat} object specifying the supported
+ * audio format of the returned line, or {@code null} for any audio
+ * format
+ * @param mixerinfo a {@code Mixer.Info} object representing the desired
+ * mixer, or {@code null} for the system default mixer
+ * @return the desired {@code SourceDataLine} object
+ * @throws LineUnavailableException if a matching source data line is not
+ * available from the specified mixer due to resource restrictions
+ * @throws SecurityException if a matching source data line is not available
+ * from the specified mixer due to security restrictions
+ * @throws IllegalArgumentException if the specified mixer does not support
+ * at least one source data line supporting the specified audio
+ * format
* @see #getSourceDataLine(AudioFormat)
* @since 1.5
*/
@@ -650,47 +599,40 @@
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
Mixer mixer = AudioSystem.getMixer(mixerinfo);
return (SourceDataLine) mixer.getLine(info);
- }
-
+ }
/**
- * Obtains a target data line that can be used for recording
- * audio data in the format specified by the
- * <code>AudioFormat</code> object. The returned line
- * will be provided by the default system mixer, or,
- * if not possible, by any other mixer installed in the
- * system that supports a matching
- * <code>TargetDataLine</code> object.
- *
- * <p>The returned line should be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioFormat, int)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * <p>The returned <code>TargetDataLine</code>'s default
- * audio format will be initialized with <code>format</code>.
+ * Obtains a target data line that can be used for recording audio data in
+ * the format specified by the {@code AudioFormat} object. The returned line
+ * will be provided by the default system mixer, or, if not possible, by any
+ * other mixer installed in the system that supports a matching
+ * {@code TargetDataLine} object.
+ * <p>
+ * The returned line should be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioFormat, int)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
+ * <p>
+ * The returned {@code TargetDataLine}'s default audio format will be
+ * initialized with {@code format}.
+ * <p>
+ * If the system property {@code javax.sound.sampled.TargetDataLine} is
+ * defined or it is defined in the file "sound.properties", it is used to
+ * retrieve the default target data line. For details, refer to the
+ * {@link AudioSystem class description}.
*
- * <p>If the system property
- * {@code javax.sound.sampled.TargetDataLine}
- * is defined or it is defined in the file "sound.properties",
- * it is used to retrieve the default target data line.
- * For details, refer to the {@link AudioSystem class description}.
- *
- * @param format an <code>AudioFormat</code> object specifying
- * the supported audio format of the returned line,
- * or <code>null</code> for any audio format
- * @return the desired <code>TargetDataLine</code> object
- *
- * @throws LineUnavailableException if a matching target data line
- * is not available due to resource restrictions
- * @throws SecurityException if a matching target data line
- * is not available due to security restrictions
- * @throws IllegalArgumentException if the system does not
- * support at least one target data line supporting the
- * specified audio format through any installed mixer
- *
+ * @param format an {@code AudioFormat} object specifying the supported
+ * audio format of the returned line, or {@code null} for any audio
+ * format
+ * @return the desired {@code TargetDataLine} object
+ * @throws LineUnavailableException if a matching target data line is not
+ * available due to resource restrictions
+ * @throws SecurityException if a matching target data line is not available
+ * due to security restrictions
+ * @throws IllegalArgumentException if the system does not support at least
+ * one target data line supporting the specified audio format
+ * through any installed mixer
* @see #getTargetDataLine(AudioFormat, Mixer.Info)
* @see AudioPermission
* @since 1.5
@@ -702,41 +644,33 @@
return (TargetDataLine) AudioSystem.getLine(info);
}
-
-
/**
- * Obtains a target data line that can be used for recording
- * audio data in the format specified by the
- * <code>AudioFormat</code> object, provided by the mixer
- * specified by the <code>Mixer.Info</code> object.
- *
- * <p>The returned line should be opened with the
- * <code>open(AudioFormat)</code> or
- * <code>open(AudioFormat, int)</code> method.
- *
- * <p>This is a high-level method that uses <code>getMixer</code>
- * and <code>getLine</code> internally.
- *
- * <p>The returned <code>TargetDataLine</code>'s default
- * audio format will be initialized with <code>format</code>.
+ * Obtains a target data line that can be used for recording audio data in
+ * the format specified by the {@code AudioFormat} object, provided by the
+ * mixer specified by the {@code Mixer.Info} object.
+ * <p>
+ * The returned line should be opened with the {@code open(AudioFormat)} or
+ * {@code open(AudioFormat, int)} method.
+ * <p>
+ * This is a high-level method that uses {@code getMixer} and
+ * {@code getLine} internally.
+ * <p>
+ * The returned {@code TargetDataLine}'s default audio format will be
+ * initialized with {@code format}.
*
- * @param format an <code>AudioFormat</code> object specifying
- * the supported audio format of the returned line,
- * or <code>null</code> for any audio format
- * @param mixerinfo a <code>Mixer.Info</code> object representing the
- * desired mixer, or <code>null</code> for the system default mixer
- * @return the desired <code>TargetDataLine</code> object
- *
- * @throws LineUnavailableException if a matching target data
- * line is not available from the specified mixer due
- * to resource restrictions
- * @throws SecurityException if a matching target data line
- * is not available from the specified mixer due to
- * security restrictions
- * @throws IllegalArgumentException if the specified mixer does
- * not support at least one target data line supporting
- * the specified audio format
- *
+ * @param format an {@code AudioFormat} object specifying the supported
+ * audio format of the returned line, or {@code null} for any audio
+ * format
+ * @param mixerinfo a {@code Mixer.Info} object representing the desired
+ * mixer, or {@code null} for the system default mixer
+ * @return the desired {@code TargetDataLine} object
+ * @throws LineUnavailableException if a matching target data line is not
+ * available from the specified mixer due to resource restrictions
+ * @throws SecurityException if a matching target data line is not available
+ * from the specified mixer due to security restrictions
+ * @throws IllegalArgumentException if the specified mixer does not support
+ * at least one target data line supporting the specified audio
+ * format
* @see #getTargetDataLine(AudioFormat)
* @see AudioPermission
* @since 1.5
@@ -750,17 +684,19 @@
return (TargetDataLine) mixer.getLine(info);
}
+ // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
- // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
/**
- * Obtains the encodings that the system can obtain from an
- * audio input stream with the specified encoding using the set
- * of installed format converters.
- * @param sourceEncoding the encoding for which conversion support
- * is queried
- * @return array of encodings. If <code>sourceEncoding</code>is not supported,
- * an array of length 0 is returned. Otherwise, the array will have a length
- * of at least 1, representing <code>sourceEncoding</code> (no conversion).
+ * Obtains the encodings that the system can obtain from an audio input
+ * stream with the specified encoding using the set of installed format
+ * converters.
+ *
+ * @param sourceEncoding the encoding for which conversion support is
+ * queried
+ * @return array of encodings. If {@code sourceEncoding}is not supported, an
+ * array of length 0 is returned. Otherwise, the array will have a
+ * length of at least 1, representing {@code sourceEncoding}
+ * (no conversion).
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding sourceEncoding) {
@@ -783,18 +719,18 @@
return encs2;
}
-
+ // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
- // $$fb 2002-04-12: fix for 4662082: behavior of AudioSystem.getTargetEncodings() methods doesn't match the spec
/**
- * Obtains the encodings that the system can obtain from an
- * audio input stream with the specified format using the set
- * of installed format converters.
- * @param sourceFormat the audio format for which conversion
- * is queried
- * @return array of encodings. If <code>sourceFormat</code>is not supported,
- * an array of length 0 is returned. Otherwise, the array will have a length
- * of at least 1, representing the encoding of <code>sourceFormat</code> (no conversion).
+ * Obtains the encodings that the system can obtain from an audio input
+ * stream with the specified format using the set of installed format
+ * converters.
+ *
+ * @param sourceFormat the audio format for which conversion is queried
+ * @return array of encodings. If {@code sourceFormat}is not supported, an
+ * array of length 0 is returned. Otherwise, the array will have a
+ * length of at least 1, representing the encoding of
+ * {@code sourceFormat} (no conversion).
*/
public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat) {
@@ -826,15 +762,14 @@
return encs2;
}
-
/**
- * Indicates whether an audio input stream of the specified encoding
- * can be obtained from an audio input stream that has the specified
- * format.
- * @param targetEncoding the desired encoding after conversion
- * @param sourceFormat the audio format before conversion
- * @return <code>true</code> if the conversion is supported,
- * otherwise <code>false</code>
+ * Indicates whether an audio input stream of the specified encoding can be
+ * obtained from an audio input stream that has the specified format.
+ *
+ * @param targetEncoding the desired encoding after conversion
+ * @param sourceFormat the audio format before conversion
+ * @return {@code true} if the conversion is supported, otherwise
+ * {@code false}
*/
public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
@@ -850,12 +785,12 @@
return false;
}
-
/**
- * Obtains an audio input stream of the indicated encoding, by converting the
- * provided audio input stream.
- * @param targetEncoding the desired encoding after conversion
- * @param sourceStream the stream to be converted
+ * Obtains an audio input stream of the indicated encoding, by converting
+ * the provided audio input stream.
+ *
+ * @param targetEncoding the desired encoding after conversion
+ * @param sourceStream the stream to be converted
* @return an audio input stream of the indicated encoding
* @throws IllegalArgumentException if the conversion is not supported
* @see #getTargetEncodings(AudioFormat.Encoding)
@@ -878,15 +813,15 @@
throw new IllegalArgumentException("Unsupported conversion: " + targetEncoding + " from " + sourceStream.getFormat());
}
-
/**
- * Obtains the formats that have a particular encoding and that the system can
- * obtain from a stream of the specified format using the set of
+ * Obtains the formats that have a particular encoding and that the system
+ * can obtain from a stream of the specified format using the set of
* installed format converters.
- * @param targetEncoding the desired encoding after conversion
- * @param sourceFormat the audio format before conversion
- * @return array of formats. If no formats of the specified
- * encoding are supported, an array of length 0 is returned.
+ *
+ * @param targetEncoding the desired encoding after conversion
+ * @param sourceFormat the audio format before conversion
+ * @return array of formats. If no formats of the specified encoding are
+ * supported, an array of length 0 is returned.
*/
public static AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
@@ -918,16 +853,15 @@
return fmts2;
}
-
/**
- * Indicates whether an audio input stream of a specified format
- * can be obtained from an audio input stream of another specified format.
- * @param targetFormat the desired audio format after conversion
- * @param sourceFormat the audio format before conversion
- * @return <code>true</code> if the conversion is supported,
- * otherwise <code>false</code>
+ * Indicates whether an audio input stream of a specified format can be
+ * obtained from an audio input stream of another specified format.
+ *
+ * @param targetFormat the desired audio format after conversion
+ * @param sourceFormat the audio format before conversion
+ * @return {@code true} if the conversion is supported, otherwise
+ * {@code false}
*/
-
public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
List codecs = getFormatConversionProviders();
@@ -941,15 +875,15 @@
return false;
}
-
/**
* Obtains an audio input stream of the indicated format, by converting the
* provided audio input stream.
- * @param targetFormat the desired audio format after conversion
- * @param sourceStream the stream to be converted
+ *
+ * @param targetFormat the desired audio format after conversion
+ * @param sourceStream the stream to be converted
* @return an audio input stream of the indicated format
* @throws IllegalArgumentException if the conversion is not supported
- * #see #getTargetEncodings(AudioFormat)
+ * @see #getTargetEncodings(AudioFormat)
* @see #getTargetFormats(AudioFormat.Encoding, AudioFormat)
* @see #isConversionSupported(AudioFormat, AudioFormat)
* @see #getAudioInputStream(AudioFormat.Encoding, AudioInputStream)
@@ -974,20 +908,22 @@
throw new IllegalArgumentException("Unsupported conversion: " + targetFormat + " from " + sourceStream.getFormat());
}
-
/**
- * Obtains the audio file format of the provided input stream. The stream must
- * point to valid audio file data. The implementation of this method may require
- * multiple parsers to examine the stream to determine whether they support it.
- * These parsers must be able to mark the stream, read enough data to determine whether they
- * support the stream, and, if not, reset the stream's read pointer to its original
- * position. If the input stream does not support these operations, this method may fail
- * with an <code>IOException</code>.
- * @param stream the input stream from which file format information should be
- * extracted
- * @return an <code>AudioFileFormat</code> object describing the stream's audio file format
- * @throws UnsupportedAudioFileException if the stream does not point to valid audio
- * file data recognized by the system
+ * Obtains the audio file format of the provided input stream. The stream
+ * must point to valid audio file data. The implementation of this method
+ * may require multiple parsers to examine the stream to determine whether
+ * they support it. These parsers must be able to mark the stream, read
+ * enough data to determine whether they support the stream, and, if not,
+ * reset the stream's read pointer to its original position. If the input
+ * stream does not support these operations, this method may fail with an
+ * {@code IOException}.
+ *
+ * @param stream the input stream from which file format information should
+ * be extracted
+ * @return an {@code AudioFileFormat} object describing the stream's audio
+ * file format
+ * @throws UnsupportedAudioFileException if the stream does not point to
+ * valid audio file data recognized by the system
* @throws IOException if an input/output exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
@@ -1016,13 +952,15 @@
}
/**
- * Obtains the audio file format of the specified URL. The URL must
- * point to valid audio file data.
- * @param url the URL from which file format information should be
- * extracted
- * @return an <code>AudioFileFormat</code> object describing the audio file format
- * @throws UnsupportedAudioFileException if the URL does not point to valid audio
- * file data recognized by the system
+ * Obtains the audio file format of the specified URL. The URL must point to
+ * valid audio file data.
+ *
+ * @param url the URL from which file format information should be
+ * extracted
+ * @return an {@code AudioFileFormat} object describing the audio file
+ * format
+ * @throws UnsupportedAudioFileException if the URL does not point to valid
+ * audio file data recognized by the system
* @throws IOException if an input/output exception occurs
*/
public static AudioFileFormat getAudioFileFormat(URL url)
@@ -1049,13 +987,15 @@
}
/**
- * Obtains the audio file format of the specified <code>File</code>. The <code>File</code> must
- * point to valid audio file data.
- * @param file the <code>File</code> from which file format information should be
- * extracted
- * @return an <code>AudioFileFormat</code> object describing the audio file format
- * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
- * file data recognized by the system
+ * Obtains the audio file format of the specified {@code File}. The
+ * {@code File} must point to valid audio file data.
+ *
+ * @param file the {@code File} from which file format information should
+ * be extracted
+ * @return an {@code AudioFileFormat} object describing the audio file
+ * format
+ * @throws UnsupportedAudioFileException if the {@code File} does not point
+ * to valid audio file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
public static AudioFileFormat getAudioFileFormat(File file)
@@ -1081,22 +1021,22 @@
}
}
-
/**
- * Obtains an audio input stream from the provided input stream. The stream must
- * point to valid audio file data. The implementation of this method may
- * require multiple parsers to
- * examine the stream to determine whether they support it. These parsers must
- * be able to mark the stream, read enough data to determine whether they
- * support the stream, and, if not, reset the stream's read pointer to its original
- * position. If the input stream does not support these operation, this method may fail
- * with an <code>IOException</code>.
- * @param stream the input stream from which the <code>AudioInputStream</code> should be
- * constructed
- * @return an <code>AudioInputStream</code> object based on the audio file data contained
- * in the input stream.
- * @throws UnsupportedAudioFileException if the stream does not point to valid audio
- * file data recognized by the system
+ * Obtains an audio input stream from the provided input stream. The stream
+ * must point to valid audio file data. The implementation of this method
+ * may require multiple parsers to examine the stream to determine whether
+ * they support it. These parsers must be able to mark the stream, read
+ * enough data to determine whether they support the stream, and, if not,
+ * reset the stream's read pointer to its original position. If the input
+ * stream does not support these operation, this method may fail with an
+ * {@code IOException}.
+ *
+ * @param stream the input stream from which the {@code AudioInputStream}
+ * should be constructed
+ * @return an {@code AudioInputStream} object based on the audio file data
+ * contained in the input stream
+ * @throws UnsupportedAudioFileException if the stream does not point to
+ * valid audio file data recognized by the system
* @throws IOException if an I/O exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
@@ -1125,14 +1065,15 @@
}
/**
- * Obtains an audio input stream from the URL provided. The URL must
- * point to valid audio file data.
- * @param url the URL for which the <code>AudioInputStream</code> should be
- * constructed
- * @return an <code>AudioInputStream</code> object based on the audio file data pointed
- * to by the URL
- * @throws UnsupportedAudioFileException if the URL does not point to valid audio
- * file data recognized by the system
+ * Obtains an audio input stream from the URL provided. The URL must point
+ * to valid audio file data.
+ *
+ * @param url the URL for which the {@code AudioInputStream} should be
+ * constructed
+ * @return an {@code AudioInputStream} object based on the audio file data
+ * pointed to by the URL
+ * @throws UnsupportedAudioFileException if the URL does not point to valid
+ * audio file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
public static AudioInputStream getAudioInputStream(URL url)
@@ -1159,14 +1100,15 @@
}
/**
- * Obtains an audio input stream from the provided <code>File</code>. The <code>File</code> must
- * point to valid audio file data.
- * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
- * constructed
- * @return an <code>AudioInputStream</code> object based on the audio file data pointed
- * to by the <code>File</code>
- * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
- * file data recognized by the system
+ * Obtains an audio input stream from the provided {@code File}. The
+ * {@code File} must point to valid audio file data.
+ *
+ * @param file the {@code File} for which the {@code AudioInputStream}
+ * should be constructed
+ * @return an {@code AudioInputStream} object based on the audio file data
+ * pointed to by the {@code File}
+ * @throws UnsupportedAudioFileException if the {@code File} does not point
+ * to valid audio file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
public static AudioInputStream getAudioInputStream(File file)
@@ -1192,11 +1134,12 @@
}
}
-
/**
- * Obtains the file types for which file writing support is provided by the system.
- * @return array of unique file types. If no file types are supported,
- * an array of length 0 is returned.
+ * Obtains the file types for which file writing support is provided by the
+ * system.
+ *
+ * @return array of unique file types. If no file types are supported, an
+ * array of length 0 is returned.
*/
public static AudioFileFormat.Type[] getAudioFileTypes() {
List providers = getAudioFileWriters();
@@ -1214,13 +1157,13 @@
return returnTypes;
}
-
/**
- * Indicates whether file writing support for the specified file type is provided
- * by the system.
- * @param fileType the file type for which write capabilities are queried
- * @return <code>true</code> if the file type is supported,
- * otherwise <code>false</code>
+ * Indicates whether file writing support for the specified file type is
+ * provided by the system.
+ *
+ * @param fileType the file type for which write capabilities are queried
+ * @return {@code true} if the file type is supported, otherwise
+ * {@code false}
*/
public static boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
@@ -1235,14 +1178,14 @@
return false;
}
-
/**
- * Obtains the file types that the system can write from the
- * audio input stream specified.
- * @param stream the audio input stream for which audio file type support
- * is queried
- * @return array of file types. If no file types are supported,
- * an array of length 0 is returned.
+ * Obtains the file types that the system can write from the audio input
+ * stream specified.
+ *
+ * @param stream the audio input stream for which audio file type
+ * support is queried
+ * @return array of file types. If no file types are supported, an array of
+ * length 0 is returned.
*/
public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream) {
List providers = getAudioFileWriters();
@@ -1260,14 +1203,14 @@
return returnTypes;
}
-
/**
* Indicates whether an audio file of the specified file type can be written
* from the indicated audio input stream.
- * @param fileType the file type for which write capabilities are queried
- * @param stream the stream for which file-writing support is queried
- * @return <code>true</code> if the file type is supported for this audio input stream,
- * otherwise <code>false</code>
+ *
+ * @param fileType the file type for which write capabilities are queried
+ * @param stream the stream for which file-writing support is queried
+ * @return {@code true} if the file type is supported for this audio input
+ * stream, otherwise {@code false}
*/
public static boolean isFileTypeSupported(AudioFileFormat.Type fileType,
AudioInputStream stream) {
@@ -1283,25 +1226,24 @@
return false;
}
-
/**
- * Writes a stream of bytes representing an audio file of the specified file type
- * to the output stream provided. Some file types require that
- * the length be written into the file header; such files cannot be written from
- * start to finish unless the length is known in advance. An attempt
- * to write a file of such a type will fail with an IOException if the length in
- * the audio file type is <code>AudioSystem.NOT_SPECIFIED</code>.
+ * Writes a stream of bytes representing an audio file of the specified file
+ * type to the output stream provided. Some file types require that the
+ * length be written into the file header; such files cannot be written from
+ * start to finish unless the length is known in advance. An attempt to
+ * write a file of such a type will fail with an IOException if the length
+ * in the audio file type is {@code AudioSystem.NOT_SPECIFIED}.
*
- * @param stream the audio input stream containing audio data to be
- * written to the file
- * @param fileType the kind of audio file to write
- * @param out the stream to which the file data should be written
+ * @param stream the audio input stream containing audio data to be written
+ * to the file
+ * @param fileType the kind of audio file to write
+ * @param out the stream to which the file data should be written
* @return the number of bytes written to the output stream
* @throws IOException if an input/output exception occurs
- * @throws IllegalArgumentException if the file type is not supported by
- * the system
+ * @throws IllegalArgumentException if the file type is not supported by the
+ * system
* @see #isFileTypeSupported
- * @see #getAudioFileTypes
+ * @see #getAudioFileTypes
*/
public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
OutputStream out) throws IOException {
@@ -1328,20 +1270,20 @@
}
}
-
/**
- * Writes a stream of bytes representing an audio file of the specified file type
- * to the external file provided.
- * @param stream the audio input stream containing audio data to be
- * written to the file
- * @param fileType the kind of audio file to write
- * @param out the external file to which the file data should be written
+ * Writes a stream of bytes representing an audio file of the specified file
+ * type to the external file provided.
+ *
+ * @param stream the audio input stream containing audio data to be written
+ * to the file
+ * @param fileType the kind of audio file to write
+ * @param out the external file to which the file data should be written
* @return the number of bytes written to the file
* @throws IOException if an I/O exception occurs
- * @throws IllegalArgumentException if the file type is not supported by
- * the system
+ * @throws IllegalArgumentException if the file type is not supported by the
+ * system
* @see #isFileTypeSupported
- * @see #getAudioFileTypes
+ * @see #getAudioFileTypes
*/
public static int write(AudioInputStream stream, AudioFileFormat.Type fileType,
File out) throws IOException {
@@ -1368,7 +1310,6 @@
}
}
-
// METHODS FOR INTERNAL IMPLEMENTATION USE
/**
@@ -1378,55 +1319,54 @@
return getProviders(MixerProvider.class);
}
-
/**
- * Obtains the set of format converters (codecs, transcoders, etc.)
- * that are currently installed on the system.
- * @return an array of
- * {@link javax.sound.sampled.spi.FormatConversionProvider
- * FormatConversionProvider}
- * objects representing the available format converters. If no format
- * converters readers are available on the system, an array of length 0 is
- * returned.
+ * Obtains the set of format converters (codecs, transcoders, etc.) that are
+ * currently installed on the system.
+ *
+ * @return an array of {@link javax.sound.sampled.spi.FormatConversionProvider
+ * FormatConversionProvider} objects representing the available
+ * format converters. If no format converters readers are available
+ * on the system, an array of length 0 is returned.
*/
private static List getFormatConversionProviders() {
return getProviders(FormatConversionProvider.class);
}
-
/**
- * Obtains the set of audio file readers that are currently installed on the system.
- * @return a List of
- * {@link javax.sound.sampled.spi.AudioFileReader
- * AudioFileReader}
- * objects representing the installed audio file readers. If no audio file
- * readers are available on the system, an empty List is returned.
+ * Obtains the set of audio file readers that are currently installed on the
+ * system.
+ *
+ * @return a List of {@link javax.sound.sampled.spi.AudioFileReader
+ * AudioFileReader} objects representing the installed audio file
+ * readers. If no audio file readers are available on the system, an
+ * empty List is returned.
*/
private static List getAudioFileReaders() {
return getProviders(AudioFileReader.class);
}
-
/**
- * Obtains the set of audio file writers that are currently installed on the system.
- * @return a List of
- * {@link javax.sound.samples.spi.AudioFileWriter AudioFileWriter}
- * objects representing the available audio file writers. If no audio file
- * writers are available on the system, an empty List is returned.
+ * Obtains the set of audio file writers that are currently installed on the
+ * system.
+ *
+ * @return a List of {@link javax.sound.sampled.spi.AudioFileWriter
+ * AudioFileWriter} objects representing the available audio file
+ * writers. If no audio file writers are available on the system, an
+ * empty List is returned.
*/
private static List getAudioFileWriters() {
return getProviders(AudioFileWriter.class);
}
-
-
- /** Attempts to locate and return a default Mixer that provides lines
- * of the specified type.
+ /**
+ * Attempts to locate and return a default Mixer that provides lines of the
+ * specified type.
*
- * @param providers the installed mixer providers
- * @param info The requested line type
- * TargetDataLine.class, Clip.class or Port.class.
- * @return a Mixer that matches the requirements, or null if no default mixer found
+ * @param providers the installed mixer providers
+ * @param info The requested line type TargetDataLine.class, Clip.class or
+ * Port.class
+ * @return a Mixer that matches the requirements, or null if no default
+ * mixer found
*/
private static Mixer getDefaultMixer(List providers, Line.Info info) {
Class lineClass = info.getLineClass();
@@ -1469,16 +1409,13 @@
return null;
}
-
-
- /** Return a MixerProvider of a given class from the list of
- MixerProviders.
-
- This method never requires the returned Mixer to do mixing.
- @param providerClassName The class name of the provider to be returned.
- @param providers The list of MixerProviders that is searched.
- @return A MixerProvider of the requested class, or null if none is
- found.
+ /**
+ * Return a MixerProvider of a given class from the list of MixerProviders.
+ * This method never requires the returned Mixer to do mixing.
+ *
+ * @param providerClassName The class name of the provider to be returned
+ * @param providers The list of MixerProviders that is searched
+ * @return A MixerProvider of the requested class, or null if none is found
*/
private static MixerProvider getNamedProvider(String providerClassName,
List providers) {
@@ -1491,15 +1428,14 @@
return null;
}
-
- /** Return a Mixer with a given name from a given MixerProvider.
- This method never requires the returned Mixer to do mixing.
- @param mixerName The name of the Mixer to be returned.
- @param provider The MixerProvider to check for Mixers.
- @param info The type of line the returned Mixer is required to
- support.
-
- @return A Mixer matching the requirements, or null if none is found.
+ /**
+ * Return a Mixer with a given name from a given MixerProvider. This method
+ * never requires the returned Mixer to do mixing.
+ *
+ * @param mixerName The name of the Mixer to be returned
+ * @param provider The MixerProvider to check for Mixers
+ * @param info The type of line the returned Mixer is required to support
+ * @return A Mixer matching the requirements, or null if none is found
*/
private static Mixer getNamedMixer(String mixerName,
MixerProvider provider,
@@ -1516,14 +1452,14 @@
return null;
}
-
- /** From a List of MixerProviders, return a Mixer with a given name.
- This method never requires the returned Mixer to do mixing.
- @param mixerName The name of the Mixer to be returned.
- @param providers The List of MixerProviders to check for Mixers.
- @param info The type of line the returned Mixer is required to
- support.
- @return A Mixer matching the requirements, or null if none is found.
+ /**
+ * From a List of MixerProviders, return a Mixer with a given name. This
+ * method never requires the returned Mixer to do mixing.
+ *
+ * @param mixerName The name of the Mixer to be returned
+ * @param providers The List of MixerProviders to check for Mixers
+ * @param info The type of line the returned Mixer is required to support
+ * @return A Mixer matching the requirements, or null if none is found
*/
private static Mixer getNamedMixer(String mixerName,
List providers,
@@ -1538,16 +1474,14 @@
return null;
}
-
- /** From a given MixerProvider, return the first appropriate Mixer.
- @param provider The MixerProvider to check for Mixers.
- @param info The type of line the returned Mixer is required to
- support.
- @param isMixingRequired If true, only Mixers that support mixing are
- returned for line types of SourceDataLine and Clip.
-
- @return A Mixer that is considered appropriate, or null
- if none is found.
+ /**
+ * From a given MixerProvider, return the first appropriate Mixer.
+ *
+ * @param provider The MixerProvider to check for Mixers
+ * @param info The type of line the returned Mixer is required to support
+ * @param isMixingRequired If true, only Mixers that support mixing are
+ * returned for line types of SourceDataLine and Clip
+ * @return A Mixer that is considered appropriate, or null if none is found
*/
private static Mixer getFirstMixer(MixerProvider provider,
Line.Info info,
@@ -1562,15 +1496,14 @@
return null;
}
-
- /** Checks if a Mixer is appropriate.
- A Mixer is considered appropriate if it support the given line type.
- If isMixingRequired is true and the line type is an output one
- (SourceDataLine, Clip), the mixer is appropriate if it supports
- at least 2 (concurrent) lines of the given type.
-
- @return true if the mixer is considered appropriate according to the
- rules given above, false otherwise.
+ /**
+ * Checks if a Mixer is appropriate. A Mixer is considered appropriate if it
+ * support the given line type. If isMixingRequired is true and the line
+ * type is an output one (SourceDataLine, Clip), the mixer is appropriate if
+ * it supports at least 2 (concurrent) lines of the given type.
+ *
+ * @return {@code true} if the mixer is considered appropriate according to
+ * the rules given above, {@code false} otherwise
*/
private static boolean isAppropriateMixer(Mixer mixer,
Line.Info lineInfo,
@@ -1588,19 +1521,16 @@
return true;
}
-
-
/**
- * Like getMixerInfo, but return List
+ * Like getMixerInfo, but return List.
*/
private static List getMixerInfoList() {
List providers = getMixerProviders();
return getMixerInfoList(providers);
}
-
/**
- * Like getMixerInfo, but return List
+ * Like getMixerInfo, but return List.
*/
private static List getMixerInfoList(List providers) {
List infos = new ArrayList();
@@ -1619,12 +1549,12 @@
return infos;
}
-
/**
- * Obtains the set of services currently installed on the system
- * using the SPI mechanism in 1.3.
- * @return a List of instances of providers for the requested service.
- * If no providers are available, a vector of length 0 will be returned.
+ * Obtains the set of services currently installed on the system using the
+ * SPI mechanism in 1.3.
+ *
+ * @return a List of instances of providers for the requested service. If no
+ * providers are available, a vector of length 0 will be returned.
*/
private static List getProviders(Class providerClass) {
return JDK13Services.getProviders(providerClass);
--- a/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/BooleanControl.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,34 +26,29 @@
package javax.sound.sampled;
/**
- * A <code>BooleanControl</code> provides the ability to switch between
- * two possible settings that affect a line's audio. The settings are boolean
- * values (<code>true</code> and <code>false</code>). A graphical user interface
- * might represent the control by a two-state button, an on/off switch, two
- * mutually exclusive buttons, or a checkbox (among other possibilities).
- * For example, depressing a button might activate a
- * <code>{@link BooleanControl.Type#MUTE MUTE}</code> control to silence
- * the line's audio.
+ * A {@code BooleanControl} provides the ability to switch between two possible
+ * settings that affect a line's audio. The settings are boolean values
+ * ({@code true} and {@code false}). A graphical user interface might represent
+ * the control by a two-state button, an on/off switch, two mutually exclusive
+ * buttons, or a checkbox (among other possibilities). For example, depressing a
+ * button might activate a {@link BooleanControl.Type#MUTE MUTE} control to
+ * silence the line's audio.
* <p>
- * As with other <code>{@link Control}</code> subclasses, a method is
- * provided that returns string labels for the values, suitable for
- * display in the user interface.
+ * As with other {@code Control} subclasses, a method is provided that returns
+ * string labels for the values, suitable for display in the user interface.
*
* @author Kara Kytle
* @since 1.3
*/
public abstract class BooleanControl extends Control {
-
- // INSTANCE VARIABLES
-
/**
- * The <code>true</code> state label, such as "true" or "on."
+ * The {@code true} state label, such as "true" or "on".
*/
private final String trueStateLabel;
/**
- * The <code>false</code> state label, such as "false" or "off."
+ * The {@code false} state label, such as "false" or "off".
*/
private final String falseStateLabel;
@@ -62,19 +57,15 @@
*/
private boolean value;
-
- // CONSTRUCTORS
-
-
/**
* Constructs a new boolean control object with the given parameters.
*
- * @param type the type of control represented this float control object
- * @param initialValue the initial control value
- * @param trueStateLabel the label for the state represented by <code>true</code>,
- * such as "true" or "on."
- * @param falseStateLabel the label for the state represented by <code>false</code>,
- * such as "false" or "off."
+ * @param type the type of control represented this float control object
+ * @param initialValue the initial control value
+ * @param trueStateLabel the label for the state represented by
+ * {@code true}, such as "true" or "on"
+ * @param falseStateLabel the label for the state represented by
+ * {@code false}, such as "false" or "off"
*/
protected BooleanControl(Type type, boolean initialValue, String trueStateLabel, String falseStateLabel) {
@@ -84,110 +75,88 @@
this.falseStateLabel = falseStateLabel;
}
-
/**
- * Constructs a new boolean control object with the given parameters.
- * The labels for the <code>true</code> and <code>false</code> states
- * default to "true" and "false."
+ * Constructs a new boolean control object with the given parameters. The
+ * labels for the {@code true} and {@code false} states default to "true"
+ * and "false".
*
- * @param type the type of control represented by this float control object
- * @param initialValue the initial control value
+ * @param type the type of control represented by this float control object
+ * @param initialValue the initial control value
*/
protected BooleanControl(Type type, boolean initialValue) {
this(type, initialValue, "true", "false");
}
-
- // METHODS
-
-
/**
- * Sets the current value for the control. The default
- * implementation simply sets the value as indicated.
- * Some controls require that their line be open before they can be affected
- * by setting a value.
- * @param value desired new value.
+ * Sets the current value for the control. The default implementation simply
+ * sets the value as indicated. Some controls require that their line be
+ * open before they can be affected by setting a value.
+ *
+ * @param value desired new value
*/
public void setValue(boolean value) {
this.value = value;
}
-
-
/**
* Obtains this control's current value.
- * @return current value.
+ *
+ * @return current value
*/
public boolean getValue() {
return value;
}
-
/**
* Obtains the label for the specified state.
- * @param state the state whose label will be returned
- * @return the label for the specified state, such as "true" or "on"
- * for <code>true</code>, or "false" or "off" for <code>false</code>.
+ *
+ * @param state the state whose label will be returned
+ * @return the label for the specified state, such as "true" or "on" for
+ * {@code true}, or "false" or "off" for {@code false}
*/
public String getStateLabel(boolean state) {
return ((state == true) ? trueStateLabel : falseStateLabel);
}
-
-
- // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
/**
- * Provides a string representation of the control
+ * Provides a string representation of the control.
+ *
* @return a string description
*/
+ @Override
public String toString() {
return new String(super.toString() + " with current value: " + getStateLabel(getValue()));
}
-
- // INNER CLASSES
-
-
/**
- * An instance of the <code>BooleanControl.Type</code> class identifies one kind of
- * boolean control. Static instances are provided for the
- * common types.
+ * An instance of the {@code BooleanControl.Type} class identifies one kind
+ * of boolean control. Static instances are provided for the common types.
*
* @author Kara Kytle
* @since 1.3
*/
public static class Type extends Control.Type {
-
- // TYPE DEFINES
-
-
/**
- * Represents a control for the mute status of a line.
- * Note that mute status does not affect gain.
+ * Represents a control for the mute status of a line. Note that mute
+ * status does not affect gain.
*/
public static final Type MUTE = new Type("Mute");
/**
- * Represents a control for whether reverberation is applied
- * to a line. Note that the status of this control not affect
- * the reverberation settings for a line, but does affect whether
- * these settings are used.
+ * Represents a control for whether reverberation is applied to a line.
+ * Note that the status of this control not affect the reverberation
+ * settings for a line, but does affect whether these settings are used.
*/
public static final Type APPLY_REVERB = new Type("Apply Reverb");
-
- // CONSTRUCTOR
-
-
/**
* Constructs a new boolean control type.
- * @param name the name of the new boolean control type
+ *
+ * @param name the name of the new boolean control type
*/
- protected Type(String name) {
+ protected Type(final String name) {
super(name);
}
- } // class Type
+ }
}
--- a/jdk/src/share/classes/javax/sound/sampled/Clip.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/Clip.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,188 +25,184 @@
package javax.sound.sampled;
-import java.io.InputStream;
import java.io.IOException;
/**
- * The <code>Clip</code> interface represents a special kind of data line whose
- * audio data can be loaded prior to playback, instead of being streamed in
- * real time.
+ * The {@code Clip} interface represents a special kind of data line whose audio
+ * data can be loaded prior to playback, instead of being streamed in real time.
* <p>
- * Because the data is pre-loaded and has a known length, you can set a clip
- * to start playing at any position in its audio data. You can also create a
- * loop, so that when the clip is played it will cycle repeatedly. Loops are
- * specified with a starting and ending sample frame, along with the number of
- * times that the loop should be played.
+ * Because the data is pre-loaded and has a known length, you can set a clip to
+ * start playing at any position in its audio data. You can also create a loop,
+ * so that when the clip is played it will cycle repeatedly. Loops are specified
+ * with a starting and ending sample frame, along with the number of times that
+ * the loop should be played.
* <p>
- * Clips may be obtained from a <code>{@link Mixer}</code> that supports lines
- * of this type. Data is loaded into a clip when it is opened.
+ * Clips may be obtained from a {@link Mixer} that supports lines of this type.
+ * Data is loaded into a clip when it is opened.
* <p>
- * Playback of an audio clip may be started and stopped using the <code>start</code>
- * and <code>stop</code> methods. These methods do not reset the media position;
- * <code>start</code> causes playback to continue from the position where playback
- * was last stopped. To restart playback from the beginning of the clip's audio
- * data, simply follow the invocation of <code>{@link DataLine#stop stop}</code>
- * with setFramePosition(0), which rewinds the media to the beginning
- * of the clip.
+ * Playback of an audio clip may be started and stopped using the
+ * {@link #start start} and {@link #stop stop} methods. These methods do not
+ * reset the media position; {@code start} causes playback to continue from the
+ * position where playback was last stopped. To restart playback from the
+ * beginning of the clip's audio data, simply follow the invocation of
+ * {@code stop} with {@code setFramePosition(0)}, which rewinds the media to the
+ * beginning of the clip.
*
* @author Kara Kytle
* @since 1.3
*/
public interface Clip extends DataLine {
-
/**
* A value indicating that looping should continue indefinitely rather than
* complete after a specific number of loops.
+ *
* @see #loop
*/
- public static final int LOOP_CONTINUOUSLY = -1;
+ int LOOP_CONTINUOUSLY = -1;
/**
- * Opens the clip, meaning that it should acquire any required
- * system resources and become operational. The clip is opened
- * with the format and audio data indicated.
- * If this operation succeeds, the line is marked as open and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched
- * to the line's listeners.
+ * Opens the clip, meaning that it should acquire any required system
+ * resources and become operational. The clip is opened with the format and
+ * audio data indicated. 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.
* <p>
- * Invoking this method on a line which is already open is illegal
- * and may result in an IllegalStateException.
+ * Invoking this method on a line which is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Note that some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>{@link LineUnavailableException}</code>.
+ * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+ * such a line will always result in a {@code LineUnavailableException}.
*
- * @param format the format of the supplied audio data
- * @param data a byte array containing audio data to load into the clip
- * @param offset the point at which to start copying, expressed in
- * <em>bytes</em> from the beginning of the array
- * @param bufferSize the number of <em>bytes</em>
- * of data to load into the clip from the array.
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IllegalArgumentException if the buffer size does not represent
- * an integral number of sample frames,
- * or if <code>format</code> is not fully specified or invalid
+ * @param format the format of the supplied audio data
+ * @param data a byte array containing audio data to load into the clip
+ * @param offset the point at which to start copying, expressed in
+ * <em>bytes</em> from the beginning of the array
+ * @param bufferSize the number of <em>bytes</em> of data to load into the
+ * clip from the array
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IllegalArgumentException if the buffer size does not represent an
+ * integral number of sample frames, or if {@code format} is not
+ * fully specified or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #close
* @see #isOpen
* @see LineListener
*/
- public void open(AudioFormat format, byte[] data, int offset, int bufferSize) throws LineUnavailableException;
+ void open(AudioFormat format, byte[] data, int offset, int bufferSize)
+ throws LineUnavailableException;
/**
- * Opens the clip with the format and audio data present in the provided audio
- * input stream. Opening a clip means that it should acquire any required
- * system resources and become operational. If this operation
- * input stream. If this operation
- * succeeds, the line is marked open and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched
- * to the line's listeners.
+ * Opens the clip with the format and audio data present in the provided
+ * audio input stream. Opening a clip means that it should acquire any
+ * required system resources and become operational. If this operation input
+ * stream. If this operation succeeds, the line is marked open and an
+ * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Invoking this method on a line which is already open is illegal
- * and may result in an IllegalStateException.
+ * Invoking this method on a line which is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Note that some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>{@link LineUnavailableException}</code>.
+ * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+ * such a line will always result in a {@code LineUnavailableException}.
*
- * @param stream an audio input stream from which audio data will be read into
- * the clip
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IOException if an I/O exception occurs during reading of
- * the stream
- * @throws IllegalArgumentException if the stream's audio format
- * is not fully specified or invalid
+ * @param stream an audio input stream from which audio data will be read
+ * into the clip
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IOException if an I/O exception occurs during reading of the
+ * stream
+ * @throws IllegalArgumentException if the stream's audio format is not
+ * fully specified or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #close
* @see #isOpen
* @see LineListener
*/
- public void open(AudioInputStream stream) throws LineUnavailableException, IOException;
+ void open(AudioInputStream stream)
+ throws LineUnavailableException, IOException;
/**
* Obtains the media length in sample frames.
- * @return the media length, expressed in sample frames,
- * or <code>AudioSystem.NOT_SPECIFIED</code> if the line is not open.
+ *
+ * @return the media length, expressed in sample frames, or
+ * {@code AudioSystem.NOT_SPECIFIED} if the line is not open
* @see AudioSystem#NOT_SPECIFIED
*/
- public int getFrameLength();
+ int getFrameLength();
/**
- * Obtains the media duration in microseconds
- * @return the media duration, expressed in microseconds,
- * or <code>AudioSystem.NOT_SPECIFIED</code> if the line is not open.
+ * Obtains the media duration in microseconds.
+ *
+ * @return the media duration, expressed in microseconds, or
+ * {@code AudioSystem.NOT_SPECIFIED} if the line is not open
* @see AudioSystem#NOT_SPECIFIED
*/
- public long getMicrosecondLength();
+ long getMicrosecondLength();
/**
- * Sets the media position in sample frames. The position is zero-based;
- * the first frame is frame number zero. When the clip begins playing the
- * next time, it will start by playing the frame at this position.
+ * Sets the media position in sample frames. The position is zero-based; the
+ * first frame is frame number zero. When the clip begins playing the next
+ * time, it will start by playing the frame at this position.
* <p>
* To obtain the current position in sample frames, use the
- * <code>{@link DataLine#getFramePosition getFramePosition}</code>
- * method of <code>DataLine</code>.
+ * {@link DataLine#getFramePosition getFramePosition} method of
+ * {@code DataLine}.
*
- * @param frames the desired new media position, expressed in sample frames
+ * @param frames the desired new media position, expressed in sample frames
*/
- public void setFramePosition(int frames);
+ void setFramePosition(int frames);
/**
- * Sets the media position in microseconds. When the clip begins playing the
- * next time, it will start at this position.
- * The level of precision is not guaranteed. For example, an implementation
- * might calculate the microsecond position from the current frame position
- * and the audio sample frame rate. The precision in microseconds would
- * then be limited to the number of microseconds per sample frame.
+ * Sets the media position in microseconds. When the clip begins playing the
+ * next time, it will start at this position. The level of precision is not
+ * guaranteed. For example, an implementation might calculate the
+ * microsecond position from the current frame position and the audio sample
+ * frame rate. The precision in microseconds would then be limited to the
+ * number of microseconds per sample frame.
* <p>
* To obtain the current position in microseconds, use the
- * <code>{@link DataLine#getMicrosecondPosition getMicrosecondPosition}</code>
- * method of <code>DataLine</code>.
+ * {@link DataLine#getMicrosecondPosition getMicrosecondPosition} method of
+ * {@code DataLine}.
*
- * @param microseconds the desired new media position, expressed in microseconds
+ * @param microseconds the desired new media position, expressed in
+ * microseconds
*/
- public void setMicrosecondPosition(long microseconds);
+ void setMicrosecondPosition(long microseconds);
/**
- * Sets the first and last sample frames that will be played in
- * the loop. The ending point must be greater than
- * or equal to the starting point, and both must fall within the
- * the size of the loaded media. A value of 0 for the starting
- * point means the beginning of the loaded media. Similarly, a value of -1
- * for the ending point indicates the last frame of the media.
- * @param start the loop's starting position, in sample frames (zero-based)
- * @param end the loop's ending position, in sample frames (zero-based), or
- * -1 to indicate the final frame
- * @throws IllegalArgumentException if the requested
- * loop points cannot be set, usually because one or both falls outside
- * the media's duration or because the ending point is
- * before the starting point
+ * Sets the first and last sample frames that will be played in the loop.
+ * The ending point must be greater than or equal to the starting point, and
+ * both must fall within the the size of the loaded media. A value of 0 for
+ * the starting point means the beginning of the loaded media. Similarly, a
+ * value of -1 for the ending point indicates the last frame of the media.
+ *
+ * @param start the loop's starting position, in sample frames (zero-based)
+ * @param end the loop's ending position, in sample frames (zero-based),
+ * or -1 to indicate the final frame
+ * @throws IllegalArgumentException if the requested loop points cannot be
+ * set, usually because one or both falls outside the media's
+ * duration or because the ending point is before the starting point
*/
- public void setLoopPoints(int start, int end);
+ void setLoopPoints(int start, int end);
/**
- * Starts looping playback from the current position. Playback will
- * continue to the loop's end point, then loop back to the loop start point
- * <code>count</code> times, and finally continue playback to the end of
- * the clip.
+ * Starts looping playback from the current position. Playback will continue
+ * to the loop's end point, then loop back to the loop start point
+ * {@code count} times, and finally continue playback to the end of the
+ * clip.
* <p>
* If the current position when this method is invoked is greater than the
- * loop end point, playback simply continues to the
- * end of the clip without looping.
+ * loop end point, playback simply continues to the end of the clip without
+ * looping.
* <p>
- * A <code>count</code> value of 0 indicates that any current looping should
- * cease and playback should continue to the end of the clip. The behavior
+ * A {@code count} value of 0 indicates that any current looping should
+ * cease and playback should continue to the end of the clip. The behavior
* is undefined when this method is invoked with any other value during a
* loop operation.
* <p>
@@ -214,10 +210,10 @@
* cleared; the behavior of subsequent loop and start requests is not
* affected by an interrupted loop operation.
*
- * @param count the number of times playback should loop back from the
- * loop's end position to the loop's start position, or
- * <code>{@link #LOOP_CONTINUOUSLY}</code> to indicate that looping should
- * continue until interrupted
+ * @param count the number of times playback should loop back from the
+ * loop's end position to the loop's start position, or
+ * {@link #LOOP_CONTINUOUSLY} to indicate that looping should
+ * continue until interrupted
*/
- public void loop(int count);
+ void loop(int count);
}
--- a/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/CompoundControl.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,55 +26,37 @@
package javax.sound.sampled;
/**
- * A <code>CompoundControl</code>, such as a graphic equalizer, provides control
- * over two or more related properties, each of which is itself represented as
- * a <code>Control</code>.
+ * A {@code CompoundControl}, such as a graphic equalizer, provides control over
+ * two or more related properties, each of which is itself represented as a
+ * {@code Control}.
*
* @author Kara Kytle
* @since 1.3
*/
public abstract class CompoundControl extends Control {
-
- // TYPE DEFINES
-
-
- // INSTANCE VARIABLES
-
-
/**
* The set of member controls.
*/
private Control[] controls;
-
-
- // CONSTRUCTORS
-
-
/**
* Constructs a new compound control object with the given parameters.
*
- * @param type the type of control represented this compound control object
- * @param memberControls the set of member controls
+ * @param type the type of control represented this compound control object
+ * @param memberControls the set of member controls
*/
protected CompoundControl(Type type, Control[] memberControls) {
-
super(type);
this.controls = memberControls;
}
-
-
- // METHODS
-
-
/**
* Returns the set of member controls that comprise the compound control.
- * @return the set of member controls.
+ *
+ * @return the set of member controls
*/
public Control[] getMemberControls() {
-
Control[] localArray = new Control[controls.length];
for (int i = 0; i < controls.length; i++) {
@@ -84,14 +66,12 @@
return localArray;
}
-
- // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
/**
- * Provides a string representation of the control
+ * Provides a string representation of the control.
+ *
* @return a string description
*/
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
@@ -108,13 +88,9 @@
return new String(getType() + " Control containing " + buf + " Controls.");
}
-
- // INNER CLASSES
-
-
/**
- * An instance of the <code>CompoundControl.Type</code> inner class identifies one kind of
- * compound control. Static instances are provided for the
+ * An instance of the {@code CompoundControl.Type} inner class identifies
+ * one kind of compound control. Static instances are provided for the
* common types.
*
* @author Kara Kytle
@@ -122,19 +98,13 @@
*/
public static class Type extends Control.Type {
-
- // TYPE DEFINES
-
- // CONSTRUCTOR
-
-
/**
* Constructs a new compound control type.
- * @param name the name of the new compound control type
+ *
+ * @param name the name of the new compound control type
*/
- protected Type(String name) {
+ protected Type(final String name) {
super(name);
}
- } // class Type
-
-} // class CompoundControl
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/Control.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/Control.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,121 +26,102 @@
package javax.sound.sampled;
/**
- * {@link Line Lines} often have a set of controls, such as gain and pan, that affect
- * the audio signal passing through the line. Java Sound's <code>Line</code> objects
- * let you obtain a particular control object by passing its class as the
- * argument to a {@link Line#getControl(Control.Type) getControl} method.
+ * {@link Line Lines} often have a set of controls, such as gain and pan, that
+ * affect the audio signal passing through the line. Java Sound's {@code Line}
+ * objects let you obtain a particular control object by passing its class as
+ * the argument to a {@link Line#getControl(Control.Type) getControl} method.
* <p>
* Because the various types of controls have different purposes and features,
- * all of their functionality is accessed from the subclasses that define
- * each kind of control.
+ * all of their functionality is accessed from the subclasses that define each
+ * kind of control.
*
* @author Kara Kytle
- *
* @see Line#getControls
* @see Line#isControlSupported
* @since 1.3
*/
public abstract class Control {
-
- // INSTANCE VARIABLES
-
/**
* The control type.
*/
private final Type type;
-
-
- // CONSTRUCTORS
-
/**
* Constructs a Control with the specified type.
- * @param type the kind of control desired
+ *
+ * @param type the kind of control desired
*/
protected Control(Type type) {
this.type = type;
}
-
- // METHODS
-
/**
* Obtains the control's type.
- * @return the control's type.
+ *
+ * @return the control's type
*/
public Type getType() {
return type;
}
-
- // ABSTRACT METHODS
-
/**
* Obtains a String describing the control type and its current state.
- * @return a String representation of the Control.
+ *
+ * @return a String representation of the Control
*/
+ @Override
public String toString() {
return new String(getType() + " Control");
}
-
/**
- * An instance of the <code>Type</code> class represents the type of
- * the control. Static instances are provided for the
- * common types.
+ * An instance of the {@code Type} class represents the type of the control.
+ * Static instances are provided for the common types.
*/
public static class Type {
- // CONTROL TYPE DEFINES
-
- // INSTANCE VARIABLES
-
/**
* Type name.
*/
private String name;
-
- // CONSTRUCTOR
-
/**
- * Constructs a new control type with the name specified.
- * The name should be a descriptive string appropriate for
- * labelling the control in an application, such as "Gain" or "Balance."
- * @param name the name of the new control type.
+ * Constructs a new control type with the name specified. The name
+ * should be a descriptive string appropriate for labelling the control
+ * in an application, such as "Gain" or "Balance".
+ *
+ * @param name the name of the new control type
*/
protected Type(String name) {
this.name = name;
}
-
- // METHODS
-
/**
- * Finalizes the equals method
+ * Finalizes the equals method.
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
/**
- * Finalizes the hashCode method
+ * Finalizes the hashCode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
/**
- * Provides the <code>String</code> representation of the control type. This <code>String</code> is
- * the same name that was passed to the constructor.
+ * Provides the {@code String} representation of the control type. This
+ * {@code String} is the same name that was passed to the constructor.
*
* @return the control type name
*/
+ @Override
public final String toString() {
return name;
}
- } // class Type
-
-} // class Control
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/DataLine.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/DataLine.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,40 +28,35 @@
import java.util.Arrays;
/**
- * <code>DataLine</code> adds media-related functionality to its
- * superinterface, <code>{@link Line}</code>. This functionality includes
- * transport-control methods that start, stop, drain, and flush
- * the audio data that passes through the line. A data line can also
- * report the current position, volume, and audio format of the media.
- * Data lines are used for output of audio by means of the
- * subinterfaces <code>{@link SourceDataLine}</code> or
- * <code>{@link Clip}</code>, which allow an application program to write data. Similarly,
- * audio input is handled by the subinterface <code>{@link TargetDataLine}</code>,
- * which allows data to be read.
+ * {@code DataLine} adds media-related functionality to its superinterface,
+ * {@code Line}. This functionality includes transport-control methods that
+ * start, stop, drain, and flush the audio data that passes through the line. A
+ * data line can also report the current position, volume, and audio format of
+ * the media. Data lines are used for output of audio by means of the
+ * subinterfaces {@link SourceDataLine} or {@link Clip}, which allow an
+ * application program to write data. Similarly, audio input is handled by the
+ * subinterface {@link TargetDataLine}, which allows data to be read.
* <p>
- * A data line has an internal buffer in which
- * the incoming or outgoing audio data is queued. The
- * <code>{@link #drain()}</code> method blocks until this internal buffer
- * becomes empty, usually because all queued data has been processed. The
- * <code>{@link #flush()}</code> method discards any available queued data
- * from the internal buffer.
+ * A data line has an internal buffer in which the incoming or outgoing audio
+ * data is queued. The {@link #drain()} method blocks until this internal buffer
+ * becomes empty, usually because all queued data has been processed. The
+ * {@link #flush()} method discards any available queued data from the internal
+ * buffer.
* <p>
- * A data line produces <code>{@link LineEvent.Type#START START}</code> and
- * <code>{@link LineEvent.Type#STOP STOP}</code> events whenever
- * it begins or ceases active presentation or capture of data. These events
- * can be generated in response to specific requests, or as a result of
- * less direct state changes. For example, if <code>{@link #start()}</code> is called
- * on an inactive data line, and data is available for capture or playback, a
- * <code>START</code> event will be generated shortly, when data playback
- * or capture actually begins. Or, if the flow of data to an active data
- * line is constricted so that a gap occurs in the presentation of data,
- * a <code>STOP</code> event is generated.
+ * A data line produces {@link LineEvent.Type#START START} and
+ * {@link LineEvent.Type#STOP STOP} events whenever it begins or ceases active
+ * presentation or capture of data. These events can be generated in response to
+ * specific requests, or as a result of less direct state changes. For example,
+ * if {@link #start()} is called on an inactive data line, and data is available
+ * for capture or playback, a {@code START} event will be generated shortly,
+ * when data playback or capture actually begins. Or, if the flow of data to an
+ * active data line is constricted so that a gap occurs in the presentation of
+ * data, a {@code STOP} event is generated.
* <p>
* Mixers often support synchronized control of multiple data lines.
* Synchronization can be established through the Mixer interface's
- * <code>{@link Mixer#synchronize synchronize}</code> method.
- * See the description of the <code>{@link Mixer Mixer}</code> interface
- * for a more complete description.
+ * {@link Mixer#synchronize synchronize} method. See the description of the
+ * {@link Mixer Mixer} interface for a more complete description.
*
* @author Kara Kytle
* @see LineEvent
@@ -69,220 +64,217 @@
*/
public interface DataLine extends Line {
-
/**
- * Drains queued data from the line by continuing data I/O until the
- * data line's internal buffer has been emptied.
- * This method blocks until the draining is complete. Because this is a
- * blocking method, it should be used with care. If <code>drain()</code>
- * is invoked on a stopped line that has data in its queue, the method will
- * block until the line is running and the data queue becomes empty. If
- * <code>drain()</code> is invoked by one thread, and another continues to
- * fill the data queue, the operation will not complete.
- * This method always returns when the data line is closed.
+ * Drains queued data from the line by continuing data I/O until the data
+ * line's internal buffer has been emptied. This method blocks until the
+ * draining is complete. Because this is a blocking method, it should be
+ * used with care. If {@code drain()} is invoked on a stopped line that has
+ * data in its queue, the method will block until the line is running and
+ * the data queue becomes empty. If {@code drain()} is invoked by one
+ * thread, and another continues to fill the data queue, the operation will
+ * not complete. This method always returns when the data line is closed.
*
* @see #flush()
*/
- public void drain();
+ void drain();
/**
- * Flushes queued data from the line. The flushed data is discarded.
- * In some cases, not all queued data can be discarded. For example, a
- * mixer can flush data from the buffer for a specific input line, but any
- * unplayed data already in the output buffer (the result of the mix) will
- * still be played. You can invoke this method after pausing a line (the
- * normal case) if you want to skip the "stale" data when you restart
- * playback or capture. (It is legal to flush a line that is not stopped,
- * but doing so on an active line is likely to cause a discontinuity in the
- * data, resulting in a perceptible click.)
+ * Flushes queued data from the line. The flushed data is discarded. In some
+ * cases, not all queued data can be discarded. For example, a mixer can
+ * flush data from the buffer for a specific input line, but any unplayed
+ * data already in the output buffer (the result of the mix) will still be
+ * played. You can invoke this method after pausing a line (the normal case)
+ * if you want to skip the "stale" data when you restart playback or
+ * capture. (It is legal to flush a line that is not stopped, but doing so
+ * on an active line is likely to cause a discontinuity in the data,
+ * resulting in a perceptible click.)
*
* @see #stop()
* @see #drain()
*/
- public void flush();
+ void flush();
/**
- * Allows a line to engage in data I/O. If invoked on a line
- * that is already running, this method does nothing. Unless the data in
- * the buffer has been flushed, the line resumes I/O starting
- * with the first frame that was unprocessed at the time the line was
- * stopped. When audio capture or playback starts, a
- * <code>{@link LineEvent.Type#START START}</code> event is generated.
+ * Allows a line to engage in data I/O. If invoked on a line that is already
+ * running, this method does nothing. Unless the data in the buffer has been
+ * flushed, the line resumes I/O starting with the first frame that was
+ * unprocessed at the time the line was stopped. When audio capture or
+ * playback starts, a {@link LineEvent.Type#START START} event is generated.
*
* @see #stop()
* @see #isRunning()
* @see LineEvent
*/
- public void start();
+ void start();
/**
- * Stops the line. A stopped line should cease I/O activity.
- * If the line is open and running, however, it should retain the resources required
- * to resume activity. A stopped line should retain any audio data in its buffer
- * instead of discarding it, so that upon resumption the I/O can continue where it left off,
- * if possible. (This doesn't guarantee that there will never be discontinuities beyond the
- * current buffer, of course; if the stopped condition continues
- * for too long, input or output samples might be dropped.) If desired, the retained data can be
- * discarded by invoking the <code>flush</code> method.
- * When audio capture or playback stops, a <code>{@link LineEvent.Type#STOP STOP}</code> event is generated.
+ * Stops the line. A stopped line should cease I/O activity. If the line is
+ * open and running, however, it should retain the resources required to
+ * resume activity. A stopped line should retain any audio data in its
+ * buffer instead of discarding it, so that upon resumption the I/O can
+ * continue where it left off, if possible. (This doesn't guarantee that
+ * there will never be discontinuities beyond the current buffer, of course;
+ * if the stopped condition continues for too long, input or output samples
+ * might be dropped.) If desired, the retained data can be discarded by
+ * invoking the {@code flush} method. When audio capture or playback stops,
+ * a {@link LineEvent.Type#STOP STOP} event is generated.
*
* @see #start()
* @see #isRunning()
* @see #flush()
* @see LineEvent
*/
- public void stop();
+ void stop();
/**
- * Indicates whether the line is running. The default is <code>false</code>.
- * An open line begins running when the first data is presented in response to an
- * invocation of the <code>start</code> method, and continues
- * until presentation ceases in response to a call to <code>stop</code> or
- * because playback completes.
- * @return <code>true</code> if the line is running, otherwise <code>false</code>
+ * Indicates whether the line is running. The default is {@code false}. An
+ * open line begins running when the first data is presented in response to
+ * an invocation of the {@code start} method, and continues until
+ * presentation ceases in response to a call to {@code stop} or because
+ * playback completes.
+ *
+ * @return {@code true} if the line is running, otherwise {@code false}
* @see #start()
* @see #stop()
*/
- public boolean isRunning();
+ boolean isRunning();
/**
- * Indicates whether the line is engaging in active I/O (such as playback
- * or capture). When an inactive line becomes active, it sends a
- * <code>{@link LineEvent.Type#START START}</code> event to its listeners. Similarly, when
- * an active line becomes inactive, it sends a
- * <code>{@link LineEvent.Type#STOP STOP}</code> event.
- * @return <code>true</code> if the line is actively capturing or rendering
- * sound, otherwise <code>false</code>
+ * Indicates whether the line is engaging in active I/O (such as playback or
+ * capture). When an inactive line becomes active, it sends a
+ * {@link LineEvent.Type#START START} event to its listeners. Similarly,
+ * when an active line becomes inactive, it sends a
+ * {@link LineEvent.Type#STOP STOP} event.
+ *
+ * @return {@code true} if the line is actively capturing or rendering
+ * sound, otherwise {@code false}
* @see #isOpen
* @see #addLineListener
* @see #removeLineListener
* @see LineEvent
* @see LineListener
*/
- public boolean isActive();
+ boolean isActive();
/**
* Obtains the current format (encoding, sample rate, number of channels,
* etc.) of the data line's audio data.
- *
- * <p>If the line is not open and has never been opened, it returns
- * the default format. The default format is an implementation
- * specific audio format, or, if the <code>DataLine.Info</code>
- * object, which was used to retrieve this <code>DataLine</code>,
- * specifies at least one fully qualified audio format, the
- * last one will be used as the default format. Opening the
- * line with a specific audio format (e.g.
- * {@link SourceDataLine#open(AudioFormat)}) will override the
- * default format.
+ * <p>
+ * If the line is not open and has never been opened, it returns the default
+ * format. The default format is an implementation specific audio format,
+ * or, if the {@code DataLine.Info} object, which was used to retrieve this
+ * {@code DataLine}, specifies at least one fully qualified audio format,
+ * the last one will be used as the default format. Opening the line with a
+ * specific audio format (e.g. {@link SourceDataLine#open(AudioFormat)})
+ * will override the default format.
*
* @return current audio data format
* @see AudioFormat
*/
- public AudioFormat getFormat();
+ AudioFormat getFormat();
/**
- * Obtains the maximum number of bytes of data that will fit in the data line's
- * internal buffer. For a source data line, this is the size of the buffer to
- * which data can be written. For a target data line, it is the size of
- * the buffer from which data can be read. Note that
- * the units used are bytes, but will always correspond to an integral
- * number of sample frames of audio data.
+ * Obtains the maximum number of bytes of data that will fit in the data
+ * line's internal buffer. For a source data line, this is the size of the
+ * buffer to which data can be written. For a target data line, it is the
+ * size of the buffer from which data can be read. Note that the units used
+ * are bytes, but will always correspond to an integral number of sample
+ * frames of audio data.
*
* @return the size of the buffer in bytes
*/
- public int getBufferSize();
+ int getBufferSize();
/**
* Obtains the number of bytes of data currently available to the
- * application for processing in the data line's internal buffer. For a
+ * application for processing in the data line's internal buffer. For a
* source data line, this is the amount of data that can be written to the
- * buffer without blocking. For a target data line, this is the amount of data
- * available to be read by the application. For a clip, this value is always
- * 0 because the audio data is loaded into the buffer when the clip is opened,
- * and persists without modification until the clip is closed.
+ * buffer without blocking. For a target data line, this is the amount of
+ * data available to be read by the application. For a clip, this value is
+ * always 0 because the audio data is loaded into the buffer when the clip
+ * is opened, and persists without modification until the clip is closed.
* <p>
- * Note that the units used are bytes, but will always
- * correspond to an integral number of sample frames of audio data.
+ * Note that the units used are bytes, but will always correspond to an
+ * integral number of sample frames of audio data.
* <p>
- * An application is guaranteed that a read or
- * write operation of up to the number of bytes returned from
- * <code>available()</code> will not block; however, there is no guarantee
- * that attempts to read or write more data will block.
+ * An application is guaranteed that a read or write operation of up to the
+ * number of bytes returned from {@code available()} will not block;
+ * however, there is no guarantee that attempts to read or write more data
+ * will block.
*
* @return the amount of data available, in bytes
*/
- public int available();
+ int available();
/**
- * Obtains the current position in the audio data, in sample frames.
- * The frame position measures the number of sample
- * frames captured by, or rendered from, the line since it was opened.
- * This return value will wrap around after 2^31 frames. It is recommended
- * to use <code>getLongFramePosition</code> instead.
+ * Obtains the current position in the audio data, in sample frames. The
+ * frame position measures the number of sample frames captured by, or
+ * rendered from, the line since it was opened. This return value will wrap
+ * around after 2^31 frames. It is recommended to use
+ * {@code getLongFramePosition} instead.
*
* @return the number of frames already processed since the line was opened
* @see #getLongFramePosition()
*/
- public int getFramePosition();
-
+ int getFramePosition();
/**
- * Obtains the current position in the audio data, in sample frames.
- * The frame position measures the number of sample
- * frames captured by, or rendered from, the line since it was opened.
+ * Obtains the current position in the audio data, in sample frames. The
+ * frame position measures the number of sample frames captured by, or
+ * rendered from, the line since it was opened.
*
* @return the number of frames already processed since the line was opened
* @since 1.5
*/
- public long getLongFramePosition();
-
+ long getLongFramePosition();
/**
- * Obtains the current position in the audio data, in microseconds.
- * The microsecond position measures the time corresponding to the number
- * of sample frames captured by, or rendered from, the line since it was opened.
- * The level of precision is not guaranteed. For example, an implementation
- * might calculate the microsecond position from the current frame position
- * and the audio sample frame rate. The precision in microseconds would
- * then be limited to the number of microseconds per sample frame.
+ * Obtains the current position in the audio data, in microseconds. The
+ * microsecond position measures the time corresponding to the number of
+ * sample frames captured by, or rendered from, the line since it was
+ * opened. The level of precision is not guaranteed. For example, an
+ * implementation might calculate the microsecond position from the current
+ * frame position and the audio sample frame rate. The precision in
+ * microseconds would then be limited to the number of microseconds per
+ * sample frame.
*
- * @return the number of microseconds of data processed since the line was opened
+ * @return the number of microseconds of data processed since the line was
+ * opened
*/
- public long getMicrosecondPosition();
+ long getMicrosecondPosition();
/**
- * Obtains the current volume level for the line. This level is a measure
- * of the signal's current amplitude, and should not be confused with the
- * current setting of a gain control. The range is from 0.0 (silence) to
- * 1.0 (maximum possible amplitude for the sound waveform). The units
- * measure linear amplitude, not decibels.
+ * Obtains the current volume level for the line. This level is a measure of
+ * the signal's current amplitude, and should not be confused with the
+ * current setting of a gain control. The range is from 0.0 (silence) to 1.0
+ * (maximum possible amplitude for the sound waveform). The units measure
+ * linear amplitude, not decibels.
*
* @return the current amplitude of the signal in this line, or
- * <code>{@link AudioSystem#NOT_SPECIFIED}</code>
+ * {@link AudioSystem#NOT_SPECIFIED}
*/
- public float getLevel();
+ float getLevel();
/**
* Besides the class information inherited from its superclass,
- * <code>DataLine.Info</code> provides additional information specific to data lines.
- * This information includes:
+ * {@code DataLine.Info} provides additional information specific to data
+ * lines. This information includes:
* <ul>
* <li> the audio formats supported by the data line
* <li> the minimum and maximum sizes of its internal buffer
* </ul>
- * Because a <code>Line.Info</code> knows the class of the line its describes, a
- * <code>DataLine.Info</code> object can describe <code>DataLine</code>
- * subinterfaces such as <code>{@link SourceDataLine}</code>,
- * <code>{@link TargetDataLine}</code>, and <code>{@link Clip}</code>.
- * You can query a mixer for lines of any of these types, passing an appropriate
- * instance of <code>DataLine.Info</code> as the argument to a method such as
- * <code>{@link Mixer#getLine Mixer.getLine(Line.Info)}</code>.
+ * Because a {@code Line.Info} knows the class of the line its describes, a
+ * {@code DataLine.Info} object can describe {@code DataLine} subinterfaces
+ * such as {@link SourceDataLine}, {@link TargetDataLine}, and {@link Clip}.
+ * You can query a mixer for lines of any of these types, passing an
+ * appropriate instance of {@code DataLine.Info} as the argument to a method
+ * such as {@link Mixer#getLine(Line.Info)}.
*
* @see Line.Info
* @author Kara Kytle
* @since 1.3
*/
- public static class Info extends Line.Info {
+ class Info extends Line.Info {
private final AudioFormat[] formats;
private final int minBufferSize;
@@ -290,14 +282,17 @@
/**
* Constructs a data line's info object from the specified information,
- * which includes a set of supported audio formats and a range for the buffer size.
- * This constructor is typically used by mixer implementations
- * when returning information about a supported line.
+ * which includes a set of supported audio formats and a range for the
+ * buffer size. This constructor is typically used by mixer
+ * implementations when returning information about a supported line.
*
- * @param lineClass the class of the data line described by the info object
- * @param formats set of formats supported
- * @param minBufferSize minimum buffer size supported by the data line, in bytes
- * @param maxBufferSize maximum buffer size supported by the data line, in bytes
+ * @param lineClass the class of the data line described by the info
+ * object
+ * @param formats set of formats supported
+ * @param minBufferSize minimum buffer size supported by the data
+ * line, in bytes
+ * @param maxBufferSize maximum buffer size supported by the data
+ * line, in bytes
*/
public Info(Class<?> lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize) {
@@ -313,16 +308,16 @@
this.maxBufferSize = maxBufferSize;
}
-
/**
* Constructs a data line's info object from the specified information,
- * which includes a single audio format and a desired buffer size.
- * This constructor is typically used by an application to
- * describe a desired line.
+ * which includes a single audio format and a desired buffer size. This
+ * constructor is typically used by an application to describe a desired
+ * line.
*
- * @param lineClass the class of the data line described by the info object
- * @param format desired format
- * @param bufferSize desired buffer size in bytes
+ * @param lineClass the class of the data line described by the info
+ * object
+ * @param format desired format
+ * @param bufferSize desired buffer size in bytes
*/
public Info(Class<?> lineClass, AudioFormat format, int bufferSize) {
@@ -338,39 +333,36 @@
this.maxBufferSize = bufferSize;
}
-
/**
* Constructs a data line's info object from the specified information,
- * which includes a single audio format.
- * This constructor is typically used by an application to
- * describe a desired line.
+ * which includes a single audio format. This constructor is typically
+ * used by an application to describe a desired line.
*
- * @param lineClass the class of the data line described by the info object
- * @param format desired format
+ * @param lineClass the class of the data line described by the info
+ * object
+ * @param format desired format
*/
public Info(Class<?> lineClass, AudioFormat format) {
this(lineClass, format, AudioSystem.NOT_SPECIFIED);
}
-
/**
- * Obtains a set of audio formats supported by the data line.
- * Note that <code>isFormatSupported(AudioFormat)</code> might return
- * <code>true</code> for certain additional formats that are missing from
- * the set returned by <code>getFormats()</code>. The reverse is not
- * the case: <code>isFormatSupported(AudioFormat)</code> is guaranteed to return
- * <code>true</code> for all formats returned by <code>getFormats()</code>.
- *
+ * Obtains a set of audio formats supported by the data line. Note that
+ * {@code isFormatSupported(AudioFormat)} might return {@code true} for
+ * certain additional formats that are missing from the set returned by
+ * {@code getFormats()}. The reverse is not the case:
+ * {@code isFormatSupported(AudioFormat)} is guaranteed to return
+ * {@code true} for all formats returned by {@code getFormats()}.
+ * <p>
* Some fields in the AudioFormat instances can be set to
* {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED NOT_SPECIFIED}
- * if that field does not apply to the format,
- * or if the format supports a wide range of values for that field.
- * For example, a multi-channel device supporting up to
- * 64 channels, could set the channel field in the
- * <code>AudioFormat</code> instances returned by this
- * method to <code>NOT_SPECIFIED</code>.
+ * if that field does not apply to the format, or if the format supports
+ * a wide range of values for that field. For example, a multi-channel
+ * device supporting up to 64 channels, could set the channel field in
+ * the {@code AudioFormat} instances returned by this method to
+ * {@code NOT_SPECIFIED}.
*
- * @return a set of supported audio formats.
+ * @return a set of supported audio formats
* @see #isFormatSupported(AudioFormat)
*/
public AudioFormat[] getFormats() {
@@ -379,11 +371,12 @@
/**
* Indicates whether this data line supports a particular audio format.
- * The default implementation of this method simply returns <code>true</code> if
- * the specified format matches any of the supported formats.
+ * The default implementation of this method simply returns {@code true}
+ * if the specified format matches any of the supported formats.
*
- * @param format the audio format for which support is queried.
- * @return <code>true</code> if the format is supported, otherwise <code>false</code>
+ * @param format the audio format for which support is queried
+ * @return {@code true} if the format is supported, otherwise
+ * {@code false}
* @see #getFormats
* @see AudioFormat#matches
*/
@@ -400,32 +393,36 @@
/**
* Obtains the minimum buffer size supported by the data line.
- * @return minimum buffer size in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
+ *
+ * @return minimum buffer size in bytes, or
+ * {@code AudioSystem.NOT_SPECIFIED}
*/
public int getMinBufferSize() {
return minBufferSize;
}
-
/**
* Obtains the maximum buffer size supported by the data line.
- * @return maximum buffer size in bytes, or <code>AudioSystem.NOT_SPECIFIED</code>
+ *
+ * @return maximum buffer size in bytes, or
+ * {@code AudioSystem.NOT_SPECIFIED}
*/
public int getMaxBufferSize() {
return maxBufferSize;
}
-
/**
- * Determines whether the specified info object matches this one.
- * To match, the superclass match requirements must be met. In
- * addition, this object's minimum buffer size must be at least as
- * large as that of the object specified, its maximum buffer size must
- * be at most as large as that of the object specified, and all of its
- * formats must match formats supported by the object specified.
- * @return <code>true</code> if this object matches the one specified,
- * otherwise <code>false</code>.
+ * Determines whether the specified info object matches this one. To
+ * match, the superclass match requirements must be met. In addition,
+ * this object's minimum buffer size must be at least as large as that
+ * of the object specified, its maximum buffer size must be at most as
+ * large as that of the object specified, and all of its formats must
+ * match formats supported by the object specified.
+ *
+ * @return {@code true} if this object matches the one specified,
+ * otherwise {@code false}
*/
+ @Override
public boolean matches(Line.Info info) {
if (! (super.matches(info)) ) {
@@ -467,8 +464,10 @@
/**
* Obtains a textual description of the data line info.
+ *
* @return a string description
*/
+ @Override
public String toString() {
StringBuffer buf = new StringBuffer();
@@ -489,6 +488,5 @@
return new String(super.toString() + buf);
}
- } // class Info
-
-} // interface DataLine
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/EnumControl.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/EnumControl.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,83 +26,63 @@
package javax.sound.sampled;
/**
- * A <code>EnumControl</code> provides control over a set of
- * discrete possible values, each represented by an object. In a
- * graphical user interface, such a control might be represented
- * by a set of buttons, each of which chooses one value or setting. For
- * example, a reverb control might provide several preset reverberation
- * settings, instead of providing continuously adjustable parameters
- * of the sort that would be represented by <code>{@link FloatControl}</code>
+ * A {@code EnumControl} provides control over a set of discrete possible values
+ * , each represented by an object. In a graphical user interface, such a
+ * control might be represented by a set of buttons, each of which chooses one
+ * value or setting. For example, a reverb control might provide several preset
+ * reverberation settings, instead of providing continuously adjustable
+ * parameters of the sort that would be represented by {@link FloatControl}
* objects.
* <p>
- * Controls that provide a choice between only two settings can often be implemented
- * instead as a <code>{@link BooleanControl}</code>, and controls that provide
- * a set of values along some quantifiable dimension might be implemented
- * instead as a <code>FloatControl</code> with a coarse resolution.
- * However, a key feature of <code>EnumControl</code> is that the returned values
- * are arbitrary objects, rather than numerical or boolean values. This means that each
- * returned object can provide further information. As an example, the settings
- * of a <code>{@link EnumControl.Type#REVERB REVERB}</code> control are instances of
- * <code>{@link ReverbType}</code> that can be queried for the parameter values
- * used for each setting.
+ * Controls that provide a choice between only two settings can often be
+ * implemented instead as a {@link BooleanControl}, and controls that provide a
+ * set of values along some quantifiable dimension might be implemented instead
+ * as a {@code FloatControl} with a coarse resolution. However, a key feature of
+ * {@code EnumControl} is that the returned values are arbitrary objects, rather
+ * than numerical or boolean values. This means that each returned object can
+ * provide further information. As an example, the settings of a
+ * {@link EnumControl.Type#REVERB REVERB} control are instances of
+ * {@link ReverbType} that can be queried for the parameter values used for each
+ * setting.
*
* @author Kara Kytle
* @since 1.3
*/
public abstract class EnumControl extends Control {
-
- // TYPE DEFINES
-
-
- // INSTANCE VARIABLES
-
-
/**
* The set of possible values.
*/
private Object[] values;
-
/**
* The current value.
*/
private Object value;
-
-
- // CONSTRUCTORS
-
-
/**
* Constructs a new enumerated control object with the given parameters.
*
- * @param type the type of control represented this enumerated control object
- * @param values the set of possible values for the control
- * @param value the initial control value
+ * @param type the type of control represented this enumerated control
+ * object
+ * @param values the set of possible values for the control
+ * @param value the initial control value
*/
protected EnumControl(Type type, Object[] values, Object value) {
-
super(type);
-
this.values = values;
this.value = value;
}
-
-
- // METHODS
-
-
/**
- * Sets the current value for the control. The default implementation
- * simply sets the value as indicated. If the value indicated is not
- * supported, an IllegalArgumentException is thrown.
- * Some controls require that their line be open before they can be affected
- * by setting a value.
- * @param value the desired new value
+ * Sets the current value for the control. The default implementation simply
+ * sets the value as indicated. If the value indicated is not supported, an
+ * {@code IllegalArgumentException} is thrown. Some controls require that
+ * their line be open before they can be affected by setting a value.
+ *
+ * @param value the desired new value
* @throws IllegalArgumentException if the value indicated does not fall
- * within the allowable range
+ * within the allowable range
*/
public void setValue(Object value) {
if (!isValueSupported(value)) {
@@ -112,18 +92,18 @@
this.value = value;
}
-
/**
* Obtains this control's current value.
+ *
* @return the current value
*/
public Object getValue() {
return value;
}
-
/**
* Returns the set of possible values for this control.
+ *
* @return the set of possible values
*/
public Object[] getValues() {
@@ -137,12 +117,11 @@
return localArray;
}
-
/**
* Indicates whether the value specified is supported.
- * @param value the value for which support is queried
- * @return <code>true</code> if the value is supported,
- * otherwise <code>false</code>
+ *
+ * @param value the value for which support is queried
+ * @return {@code true} if the value is supported, otherwise {@code false}
*/
private boolean isValueSupported(Object value) {
@@ -157,58 +136,43 @@
return false;
}
-
-
- // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
/**
* Provides a string representation of the control.
+ *
* @return a string description
*/
+ @Override
public String toString() {
return new String(getType() + " with current value: " + getValue());
}
-
- // INNER CLASSES
-
-
/**
- * An instance of the <code>EnumControl.Type</code> inner class identifies one kind of
- * enumerated control. Static instances are provided for the
- * common types.
- *
- * @see EnumControl
+ * An instance of the {@code EnumControl.Type} inner class identifies one
+ * kind of enumerated control. Static instances are provided for the common
+ * types.
*
* @author Kara Kytle
+ * @see EnumControl
* @since 1.3
*/
public static class Type extends Control.Type {
-
- // TYPE DEFINES
-
/**
* Represents a control over a set of possible reverberation settings.
* Each reverberation setting is described by an instance of the
- * {@link ReverbType} class. (To access these settings,
- * invoke <code>{@link EnumControl#getValues}</code> on an
- * enumerated control of type <code>REVERB</code>.)
+ * {@link ReverbType} class. (To access these settings, invoke
+ * {@link EnumControl#getValues} on an enumerated control of type
+ * {@code REVERB}.)
*/
public static final Type REVERB = new Type("Reverb");
-
- // CONSTRUCTOR
-
-
/**
* Constructs a new enumerated control type.
- * @param name the name of the new enumerated control type
+ *
+ * @param name the name of the new enumerated control type
*/
- protected Type(String name) {
+ protected Type(final String name) {
super(name);
}
- } // class Type
-
-} // class EnumControl
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/FloatControl.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/FloatControl.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,39 +26,31 @@
package javax.sound.sampled;
/**
- * A <code>FloatControl</code> object provides control over a range of
- * floating-point values. Float controls are often
- * represented in graphical user interfaces by continuously
- * adjustable objects such as sliders or rotary knobs. Concrete subclasses
- * of <code>FloatControl</code> implement controls, such as gain and pan, that
- * affect a line's audio signal in some way that an application can manipulate.
- * The <code>{@link FloatControl.Type}</code>
- * inner class provides static instances of types that are used to
- * identify some common kinds of float control.
+ * A {@code FloatControl} object provides control over a range of floating-point
+ * values. Float controls are often represented in graphical user interfaces by
+ * continuously adjustable objects such as sliders or rotary knobs. Concrete
+ * subclasses of {@code FloatControl} implement controls, such as gain and pan,
+ * that affect a line's audio signal in some way that an application can
+ * manipulate. The {@link FloatControl.Type} inner class provides static
+ * instances of types that are used to identify some common kinds of float
+ * control.
* <p>
- * The <code>FloatControl</code> abstract class provides methods to set and get
- * the control's current floating-point value. Other methods obtain the possible
+ * The {@code FloatControl} abstract class provides methods to set and get the
+ * control's current floating-point value. Other methods obtain the possible
* range of values and the control's resolution (the smallest increment between
- * returned values). Some float controls allow ramping to a
- * new value over a specified period of time. <code>FloatControl</code> also
- * includes methods that return string labels for the minimum, maximum, and midpoint
- * positions of the control.
- *
- * @see Line#getControls
- * @see Line#isControlSupported
+ * returned values). Some float controls allow ramping to a new value over a
+ * specified period of time. {@code FloatControl} also includes methods that
+ * return string labels for the minimum, maximum, and midpoint positions of the
+ * control.
*
* @author David Rivas
* @author Kara Kytle
+ * @see Line#getControls
+ * @see Line#isControlSupported
* @since 1.3
*/
public abstract class FloatControl extends Control {
-
- // INSTANCE VARIABLES
-
-
- // FINAL VARIABLES
-
/**
* The minimum supported value.
*/
@@ -75,66 +67,60 @@
private float precision;
/**
- * The smallest time increment in which a value change
- * can be effected during a value shift, in microseconds.
+ * The smallest time increment in which a value change can be effected
+ * during a value shift, in microseconds.
*/
private int updatePeriod;
-
/**
- * A label for the units in which the control values are expressed,
- * such as "dB" for decibels.
+ * A label for the units in which the control values are expressed, such as
+ * "dB" for decibels.
*/
private final String units;
/**
- * A label for the minimum value, such as "Left."
+ * A label for the minimum value, such as "Left".
*/
private final String minLabel;
/**
- * A label for the maximum value, such as "Right."
+ * A label for the maximum value, such as "Right".
*/
private final String maxLabel;
/**
- * A label for the mid-point value, such as "Center."
+ * A label for the mid-point value, such as "Center".
*/
private final String midLabel;
-
- // STATE VARIABLES
-
/**
* The current value.
*/
private float value;
-
-
- // CONSTRUCTORS
-
-
/**
- * Constructs a new float control object with the given parameters
+ * Constructs a new float control object with the given parameters.
*
- * @param type the kind of control represented by this float control object
- * @param minimum the smallest value permitted for the control
- * @param maximum the largest value permitted for the control
- * @param precision the resolution or granularity of the control.
- * This is the size of the increment between discrete valid values.
- * @param updatePeriod the smallest time interval, in microseconds, over which the control
- * can change from one discrete value to the next during a {@link #shift(float,float,int) shift}
- * @param initialValue the value that the control starts with when constructed
- * @param units the label for the units in which the control's values are expressed,
- * such as "dB" or "frames per second"
- * @param minLabel the label for the minimum value, such as "Left" or "Off"
- * @param midLabel the label for the midpoint value, such as "Center" or "Default"
- * @param maxLabel the label for the maximum value, such as "Right" or "Full"
- *
- * @throws IllegalArgumentException if {@code minimum} is greater
- * than {@code maximum} or {@code initialValue} does not fall
- * within the allowable range
+ * @param type the kind of control represented by this float control object
+ * @param minimum the smallest value permitted for the control
+ * @param maximum the largest value permitted for the control
+ * @param precision the resolution or granularity of the control. This is
+ * the size of the increment between discrete valid values.
+ * @param updatePeriod the smallest time interval, in microseconds, over
+ * which the control can change from one discrete value to the next
+ * during a {@link #shift(float,float,int) shift}
+ * @param initialValue the value that the control starts with when
+ * constructed
+ * @param units the label for the units in which the control's values are
+ * expressed, such as "dB" or "frames per second"
+ * @param minLabel the label for the minimum value, such as "Left" or "Off"
+ * @param midLabel the label for the midpoint value, such as "Center" or
+ * "Default"
+ * @param maxLabel the label for the maximum value, such as "Right" or
+ * "Full"
+ * @throws IllegalArgumentException if {@code minimum} is greater than
+ * {@code maximum} or {@code initialValue} does not fall within the
+ * allowable range
*/
protected FloatControl(Type type, float minimum, float maximum,
float precision, int updatePeriod, float initialValue,
@@ -169,26 +155,26 @@
this.maxLabel = ( (maxLabel == null) ? "" : maxLabel);
}
-
/**
- * Constructs a new float control object with the given parameters.
- * The labels for the minimum, maximum, and mid-point values are set
- * to zero-length strings.
+ * Constructs a new float control object with the given parameters. The
+ * labels for the minimum, maximum, and mid-point values are set to
+ * zero-length strings.
*
- * @param type the kind of control represented by this float control object
- * @param minimum the smallest value permitted for the control
- * @param maximum the largest value permitted for the control
- * @param precision the resolution or granularity of the control.
- * This is the size of the increment between discrete valid values.
- * @param updatePeriod the smallest time interval, in microseconds, over which the control
- * can change from one discrete value to the next during a {@link #shift(float,float,int) shift}
- * @param initialValue the value that the control starts with when constructed
- * @param units the label for the units in which the control's values are expressed,
- * such as "dB" or "frames per second"
- *
- * @throws IllegalArgumentException if {@code minimum} is greater
- * than {@code maximum} or {@code initialValue} does not fall
- * within the allowable range
+ * @param type the kind of control represented by this float control object
+ * @param minimum the smallest value permitted for the control
+ * @param maximum the largest value permitted for the control
+ * @param precision the resolution or granularity of the control. This is
+ * the size of the increment between discrete valid values.
+ * @param updatePeriod the smallest time interval, in microseconds, over
+ * which the control can change from one discrete value to the next
+ * during a {@link #shift(float,float,int) shift}
+ * @param initialValue the value that the control starts with when
+ * constructed
+ * @param units the label for the units in which the control's values are
+ * expressed, such as "dB" or "frames per second"
+ * @throws IllegalArgumentException if {@code minimum} is greater than
+ * {@code maximum} or {@code initialValue} does not fall within the
+ * allowable range
*/
protected FloatControl(Type type, float minimum, float maximum,
float precision, int updatePeriod, float initialValue, String units) {
@@ -196,21 +182,16 @@
initialValue, units, "", "", "");
}
-
-
- // METHODS
-
-
/**
- * Sets the current value for the control. The default implementation
- * simply sets the value as indicated. If the value indicated is greater
- * than the maximum value, or smaller than the minimum value, an
- * IllegalArgumentException is thrown.
- * Some controls require that their line be open before they can be affected
- * by setting a value.
- * @param newValue desired new value
+ * Sets the current value for the control. The default implementation simply
+ * sets the value as indicated. If the value indicated is greater than the
+ * maximum value, or smaller than the minimum value, an
+ * {@code IllegalArgumentException} is thrown. Some controls require that
+ * their line be open before they can be affected by setting a value.
+ *
+ * @param newValue desired new value
* @throws IllegalArgumentException if the value indicated does not fall
- * within the allowable range
+ * within the allowable range
*/
public void setValue(float newValue) {
@@ -225,113 +206,114 @@
value = newValue;
}
-
/**
* Obtains this control's current value.
+ *
* @return the current value
*/
public float getValue() {
return value;
}
-
/**
* Obtains the maximum value permitted.
+ *
* @return the maximum allowable value
*/
public float getMaximum() {
return maximum;
}
-
/**
* Obtains the minimum value permitted.
+ *
* @return the minimum allowable value
*/
public float getMinimum() {
return minimum;
}
-
/**
- * Obtains the label for the units in which the control's values are expressed,
- * such as "dB" or "frames per second."
+ * Obtains the label for the units in which the control's values are
+ * expressed, such as "dB" or "frames per second."
+ *
* @return the units label, or a zero-length string if no label
*/
public String getUnits() {
return units;
}
-
/**
- * Obtains the label for the minimum value, such as "Left" or "Off."
- * @return the minimum value label, or a zero-length string if no label * has been set
+ * Obtains the label for the minimum value, such as "Left" or "Off".
+ *
+ * @return the minimum value label, or a zero-length string if no label has
+ * been set
*/
public String getMinLabel() {
return minLabel;
}
-
/**
- * Obtains the label for the mid-point value, such as "Center" or "Default."
- * @return the mid-point value label, or a zero-length string if no label * has been set
+ * Obtains the label for the mid-point value, such as "Center" or "Default".
+ *
+ * @return the mid-point value label, or a zero-length string if no label
+ * has been set
*/
public String getMidLabel() {
return midLabel;
}
-
/**
- * Obtains the label for the maximum value, such as "Right" or "Full."
- * @return the maximum value label, or a zero-length string if no label * has been set
+ * Obtains the label for the maximum value, such as "Right" or "Full".
+ *
+ * @return the maximum value label, or a zero-length string if no label has
+ * been set
*/
public String getMaxLabel() {
return maxLabel;
}
-
/**
- * Obtains the resolution or granularity of the control, in the units
- * that the control measures.
- * The precision is the size of the increment between discrete valid values
- * for this control, over the set of supported floating-point values.
+ * Obtains the resolution or granularity of the control, in the units that
+ * the control measures. The precision is the size of the increment between
+ * discrete valid values for this control, over the set of supported
+ * floating-point values.
+ *
* @return the control's precision
*/
public float getPrecision() {
return precision;
}
-
/**
- * Obtains the smallest time interval, in microseconds, over which the control's value can
- * change during a shift. The update period is the inverse of the frequency with which
- * the control updates its value during a shift. If the implementation does not support value shifting over
- * time, it should set the control's value to the final value immediately
- * and return -1 from this method.
+ * Obtains the smallest time interval, in microseconds, over which the
+ * control's value can change during a shift. The update period is the
+ * inverse of the frequency with which the control updates its value during
+ * a shift. If the implementation does not support value shifting over time,
+ * it should set the control's value to the final value immediately and
+ * return -1 from this method.
*
- * @return update period in microseconds, or -1 if shifting over time is unsupported
+ * @return update period in microseconds, or -1 if shifting over time is
+ * unsupported
* @see #shift
*/
public int getUpdatePeriod() {
return updatePeriod;
}
-
/**
- * Changes the control value from the initial value to the final
- * value linearly over the specified time period, specified in microseconds.
- * This method returns without blocking; it does not wait for the shift
- * to complete. An implementation should complete the operation within the time
- * specified. The default implementation simply changes the value
- * to the final value immediately.
+ * Changes the control value from the initial value to the final value
+ * linearly over the specified time period, specified in microseconds. This
+ * method returns without blocking; it does not wait for the shift to
+ * complete. An implementation should complete the operation within the time
+ * specified. The default implementation simply changes the value to the
+ * final value immediately.
*
- * @param from initial value at the beginning of the shift
- * @param to final value after the shift
- * @param microseconds maximum duration of the shift in microseconds
- *
+ * @param from initial value at the beginning of the shift
+ * @param to final value after the shift
+ * @param microseconds maximum duration of the shift in microseconds
* @throws IllegalArgumentException if either {@code from} or {@code to}
- * value does not fall within the allowable range
- *
+ * value does not fall within the allowable range
* @see #getUpdatePeriod
*/
public void shift(float from, float to, int microseconds) {
@@ -347,12 +329,9 @@
setValue(to);
}
-
- // ABSTRACT METHOD IMPLEMENTATIONS: CONTROL
-
-
/**
- * Provides a string representation of the control
+ * Provides a string representation of the control.
+ *
* @return a string description
*/
public String toString() {
@@ -360,55 +339,45 @@
" (range: " + minimum + " - " + maximum + ")");
}
-
- // INNER CLASSES
-
-
/**
- * An instance of the <code>FloatControl.Type</code> inner class identifies one kind of
- * float control. Static instances are provided for the
- * common types.
+ * An instance of the {@code FloatControl.Type} inner class identifies one
+ * kind of float control. Static instances are provided for the common
+ * types.
*
* @author Kara Kytle
* @since 1.3
*/
public static class Type extends Control.Type {
-
- // TYPE DEFINES
-
-
- // GAIN TYPES
-
/**
* Represents a control for the overall gain on a line.
* <p>
* Gain is a quantity in decibels (dB) that is added to the intrinsic
- * decibel level of the audio signal--that is, the level of
- * the signal before it is altered by the gain control. A positive
- * gain amplifies (boosts) the signal's volume, and a negative gain
- * attenuates (cuts) it.
+ * decibel level of the audio signal--that is, the level of the signal
+ * before it is altered by the gain control. A positive gain amplifies
+ * (boosts) the signal's volume, and a negative gain attenuates(cuts)it.
* The gain setting defaults to a value of 0.0 dB, meaning the signal's
- * loudness is unaffected. Note that gain measures dB, not amplitude.
+ * loudness is unaffected. Note that gain measures dB, not amplitude.
* The relationship between a gain in decibels and the corresponding
* linear amplitude multiplier is:
*
- *<CENTER><CODE> linearScalar = pow(10.0, gainDB/20.0) </CODE></CENTER>
+ * <CENTER>{@code linearScalar = pow(10.0, gainDB/20.0)}</CENTER>
* <p>
- * The <code>FloatControl</code> class has methods to impose a maximum and
- * minimum allowable value for gain. However, because an audio signal might
- * already be at a high amplitude, the maximum setting does not guarantee
- * that the signal will be undistorted when the gain is applied to it (unless
- * the maximum is zero or negative). To avoid numeric overflow from excessively
- * large gain settings, a gain control can implement
- * clipping, meaning that the signal's amplitude will be limited to the maximum
- * value representable by its audio format, instead of wrapping around.
+ * The {@code FloatControl} class has methods to impose a maximum and
+ * minimum allowable value for gain. However, because an audio signal
+ * might already be at a high amplitude, the maximum setting does not
+ * guarantee that the signal will be undistorted when the gain is
+ * applied to it (unless the maximum is zero or negative). To avoid
+ * numeric overflow from excessively large gain settings, a gain control
+ * can implement clipping, meaning that the signal's amplitude will be
+ * limited to the maximum value representable by its audio format,
+ * instead of wrapping around.
* <p>
- * These comments apply to gain controls in general, not just master gain controls.
- * A line can have more than one gain control. For example, a mixer (which is
- * itself a line) might have a master gain control, an auxiliary return control,
- * a reverb return control, and, on each of its source lines, an individual aux
- * send and reverb send.
+ * These comments apply to gain controls in general, not just master
+ * gain controls. A line can have more than one gain control. For
+ * example, a mixer (which is itself a line) might have a master gain
+ * control, an auxiliary return control, a reverb return control, and,
+ * on each of its source lines, an individual aux send and reverb send.
*
* @see #AUX_SEND
* @see #AUX_RETURN
@@ -435,9 +404,9 @@
public static final Type AUX_RETURN = new Type("AUX Return");
/**
- * Represents a control for the pre-reverb gain on a line.
- * This control may be used to affect how much
- * of a line's signal is directed to a mixer's internal reverberation unit.
+ * Represents a control for the pre-reverb gain on a line. This control
+ * may be used to affect how much of a line's signal is directed to a
+ * mixer's internal reverberation unit.
*
* @see #MASTER_GAIN
* @see #REVERB_RETURN
@@ -446,18 +415,15 @@
public static final Type REVERB_SEND = new Type("Reverb Send");
/**
- * Represents a control for the post-reverb gain on a line.
- * This control may be used to control the relative amplitude
- * of the signal returned from an internal reverberation unit.
+ * Represents a control for the post-reverb gain on a line. This control
+ * may be used to control the relative amplitude of the signal returned
+ * from an internal reverberation unit.
*
* @see #MASTER_GAIN
* @see #REVERB_SEND
*/
public static final Type REVERB_RETURN = new Type("Reverb Return");
-
- // VOLUME
-
/**
* Represents a control for the volume on a line.
*/
@@ -466,64 +432,52 @@
*/
public static final Type VOLUME = new Type("Volume");
-
- // PAN
-
/**
- * Represents a control for the relative pan (left-right positioning)
- * of the signal. The signal may be mono; the pan setting affects how
- * it is distributed by the mixer in a stereo mix. The valid range of values is -1.0
- * (left channel only) to 1.0 (right channel
- * only). The default is 0.0 (centered).
+ * Represents a control for the relative pan (left-right positioning) of
+ * the signal. The signal may be mono; the pan setting affects how it is
+ * distributed by the mixer in a stereo mix. The valid range of values
+ * is -1.0 (left channel only) to 1.0 (right channel only). The default
+ * is 0.0 (centered).
*
* @see #BALANCE
*/
public static final Type PAN = new Type("Pan");
-
- // BALANCE
-
/**
* Represents a control for the relative balance of a stereo signal
- * between two stereo speakers. The valid range of values is -1.0 (left channel only) to 1.0 (right channel
- * only). The default is 0.0 (centered).
+ * between two stereo speakers. The valid range of values is -1.0 (left
+ * channel only) to 1.0 (right channel only). The default is 0.0
+ * (centered).
*
* @see #PAN
*/
public static final Type BALANCE = new Type("Balance");
-
- // SAMPLE RATE
-
/**
- * Represents a control that changes the sample rate of audio playback. The net effect
- * of changing the sample rate depends on the relationship between
- * the media's natural rate and the rate that is set via this control.
- * The natural rate is the sample rate that is specified in the data line's
- * <code>AudioFormat</code> object. For example, if the natural rate
- * of the media is 11025 samples per second and the sample rate is set
- * to 22050 samples per second, the media will play back at twice the
- * normal speed.
+ * Represents a control that changes the sample rate of audio playback.
+ * The net effect of changing the sample rate depends on the
+ * relationship between the media's natural rate and the rate that is
+ * set via this control. The natural rate is the sample rate that is
+ * specified in the data line's {@code AudioFormat} object. For example,
+ * if the natural rate of the media is 11025 samples per second and the
+ * sample rate is set to 22050 samples per second, the media will play
+ * back at twice the normal speed.
* <p>
- * Changing the sample rate with this control does not affect the data line's
- * audio format. Also note that whenever you change a sound's sample rate, a
- * change in the sound's pitch results. For example, doubling the sample
- * rate has the effect of doubling the frequencies in the sound's spectrum,
- * which raises the pitch by an octave.
+ * Changing the sample rate with this control does not affect the data
+ * line's audio format. Also note that whenever you change a sound's
+ * sample rate, a change in the sound's pitch results. For example,
+ * doubling the sample rate has the effect of doubling the frequencies
+ * in the sound's spectrum, which raises the pitch by an octave.
*/
public static final Type SAMPLE_RATE = new Type("Sample Rate");
-
- // CONSTRUCTOR
-
/**
* Constructs a new float control type.
- * @param name the name of the new float control type
+ *
+ * @param name the name of the new float control type
*/
- protected Type(String name) {
+ protected Type(final String name) {
super(name);
}
-
- } // class Type
-
-} // class FloatControl
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/Line.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/Line.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,96 +26,90 @@
package javax.sound.sampled;
/**
- * The <code>Line</code> interface represents a mono or multi-channel
- * audio feed. A line is an element of the digital audio
- * "pipeline," such as a mixer, an input or output port,
- * or a data path into or out of a mixer.
+ * The {@code Line} interface represents a mono or multi-channel audio feed. A
+ * line is an element of the digital audio "pipeline," such as a mixer, an input
+ * or output port, or a data path into or out of a mixer.
* <p>
- * A line can have controls, such as gain, pan, and reverb.
- * The controls themselves are instances of classes that extend the
- * base <code>{@link Control}</code> class.
- * The <code>Line</code> interface provides two accessor methods for
- * obtaining the line's controls: <code>{@link #getControls getControls}</code> returns the
- * entire set, and <code>{@link #getControl getControl}</code> returns a single control of
- * specified type.
+ * A line can have controls, such as gain, pan, and reverb. The controls
+ * themselves are instances of classes that extend the base {@link Control}
+ * class. The {@code Line} interface provides two accessor methods for obtaining
+ * the line's controls: {@link #getControls getControls} returns the entire set,
+ * and {@link #getControl getControl} returns a single control of specified
+ * type.
* <p>
- * Lines exist in various states at different times. When a line opens, it reserves system
- * resources for itself, and when it closes, these resources are freed for
- * other objects or applications. The <code>{@link #isOpen()}</code> method lets
- * you discover whether a line is open or closed.
- * An open line need not be processing data, however. Such processing is
- * typically initiated by subinterface methods such as
- * <code>{@link SourceDataLine#write SourceDataLine.write}</code> and
- * <code>{@link TargetDataLine#read TargetDataLine.read}</code>.
- *<p>
- * You can register an object to receive notifications whenever the line's
- * state changes. The object must implement the <code>{@link LineListener}</code>
- * interface, which consists of the single method
- * <code>{@link LineListener#update update}</code>.
- * This method will be invoked when a line opens and closes (and, if it's a
- * {@link DataLine}, when it starts and stops).
- *<p>
- * An object can be registered to listen to multiple lines. The event it
- * receives in its <code>update</code> method will specify which line created
- * the event, what type of event it was
- * (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>),
- * and how many sample frames the line had processed at the time the event occurred.
+ * Lines exist in various states at different times. When a line opens, it
+ * reserves system resources for itself, and when it closes, these resources are
+ * freed for other objects or applications. The {@link #isOpen()} method lets
+ * you discover whether a line is open or closed. An open line need not be
+ * processing data, however. Such processing is typically initiated by
+ * subinterface methods such as
+ * {@link SourceDataLine#write SourceDataLine.write} and
+ * {@link TargetDataLine#read TargetDataLine.read}.
+ * <p>
+ * You can register an object to receive notifications whenever the line's state
+ * changes. The object must implement the {@link LineListener} interface, which
+ * consists of the single method {@link LineListener#update update}. This method
+ * will be invoked when a line opens and closes (and, if it's a {@link DataLine}
+ * , when it starts and stops).
+ * <p>
+ * An object can be registered to listen to multiple lines. The event it
+ * receives in its {@code update} method will specify which line created the
+ * event, what type of event it was ({@code OPEN}, {@code CLOSE}, {@code START},
+ * or {@code STOP}), and how many sample frames the line had processed at the
+ * time the event occurred.
* <p>
* Certain line operations, such as open and close, can generate security
* exceptions if invoked by unprivileged code when the line is a shared audio
* resource.
*
* @author Kara Kytle
- *
* @see LineEvent
* @since 1.3
*/
public interface Line extends AutoCloseable {
/**
- * Obtains the <code>Line.Info</code> object describing this
- * line.
+ * Obtains the {@code Line.Info} object describing this line.
+ *
* @return description of the line
*/
- public Line.Info getLineInfo();
+ Line.Info getLineInfo();
/**
- * Opens the line, indicating that it should acquire any required
- * system resources and become operational.
- * If this operation
- * succeeds, the line is marked as open, and an <code>OPEN</code> event is dispatched
- * to the line's listeners.
+ * Opens the line, indicating that it should acquire any required system
+ * resources and become operational. If this operation succeeds, the line is
+ * marked as open, and an {@code OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Note that some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in an <code>LineUnavailableException</code>.
+ * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+ * such a line will always result in an {@code LineUnavailableException}.
* <p>
- * Some types of lines have configurable properties that may affect
- * resource allocation. For example, a <code>DataLine</code> must
- * be opened with a particular format and buffer size. Such lines
- * should provide a mechanism for configuring these properties, such
- * as an additional <code>open</code> method or methods which allow
- * an application to specify the desired settings.
+ * Some types of lines have configurable properties that may affect resource
+ * allocation. For example, a {@code DataLine} must be opened with a
+ * particular format and buffer size. Such lines should provide a mechanism
+ * for configuring these properties, such as an additional {@code open}
+ * method or methods which allow an application to specify the desired
+ * settings.
* <p>
* This method takes no arguments, and opens the line with the current
- * settings. For <code>{@link SourceDataLine}</code> and
- * <code>{@link TargetDataLine}</code> objects, this means that the line is
- * opened with default settings. For a <code>{@link Clip}</code>, however,
- * the buffer size is determined when data is loaded. Since this method does not
- * allow the application to specify any data to load, an IllegalArgumentException
- * is thrown. Therefore, you should instead use one of the <code>open</code> methods
- * provided in the <code>Clip</code> interface to load data into the <code>Clip</code>.
+ * settings. For {@link SourceDataLine} and {@link TargetDataLine} objects,
+ * this means that the line is opened with default settings. For a
+ * {@link Clip}, however, the buffer size is determined when data is loaded.
+ * Since this method does not allow the application to specify any data to
+ * load, an {@code IllegalArgumentException} is thrown. Therefore, you
+ * should instead use one of the {@code open} methods provided in the
+ * {@code Clip} interface to load data into the {@code Clip}.
* <p>
- * For <code>DataLine</code>'s, if the <code>DataLine.Info</code>
- * object which was used to retrieve the line, specifies at least
- * one fully qualified audio format, the last one will be used
- * as the default format.
+ * For {@code DataLine}'s, if the {@code DataLine.Info} object which was
+ * used to retrieve the line, specifies at least one fully qualified audio
+ * format, the last one will be used as the default format.
*
- * @throws IllegalArgumentException if this method is called on a Clip instance.
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions.
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions.
- *
+ * @throws IllegalArgumentException if this method is called on a Clip
+ * instance
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #close
* @see #isOpen
* @see LineEvent
@@ -123,133 +117,128 @@
* @see Clip#open(AudioFormat, byte[], int, int)
* @see Clip#open(AudioInputStream)
*/
- public void open() throws LineUnavailableException;
-
+ void open() throws LineUnavailableException;
/**
- * Closes the line, indicating that any system resources
- * in use by the line can be released. If this operation
- * succeeds, the line is marked closed and a <code>CLOSE</code> event is dispatched
- * to the line's listeners.
- * @throws SecurityException if the line cannot be
- * closed due to security restrictions.
+ * Closes the line, indicating that any system resources in use by the line
+ * can be released. If this operation succeeds, the line is marked closed
+ * and a {@code CLOSE} event is dispatched to the line's listeners.
*
+ * @throws SecurityException if the line cannot be closed due to security
+ * restrictions
* @see #open
* @see #isOpen
* @see LineEvent
*/
- public void close();
-
-
+ @Override
+ void close();
/**
- * Indicates whether the line is open, meaning that it has reserved
- * system resources and is operational, although it might not currently be
- * playing or capturing sound.
- * @return <code>true</code> if the line is open, otherwise <code>false</code>
+ * Indicates whether the line is open, meaning that it has reserved system
+ * resources and is operational, although it might not currently be playing
+ * or capturing sound.
*
+ * @return {@code true} if the line is open, otherwise {@code false}
* @see #open()
* @see #close()
*/
- public boolean isOpen();
-
+ boolean isOpen();
/**
- * Obtains the set of controls associated with this line.
- * Some controls may only be available when the line is open.
- * If there are no controls, this method returns an array of length 0.
+ * Obtains the set of controls associated with this line. Some controls may
+ * only be available when the line is open. If there are no controls, this
+ * method returns an array of length 0.
+ *
* @return the array of controls
* @see #getControl
*/
- public Control[] getControls();
+ Control[] getControls();
/**
- * Indicates whether the line supports a control of the specified type.
- * Some controls may only be available when the line is open.
- * @param control the type of the control for which support is queried
- * @return <code>true</code> if at least one control of the specified type is
- * supported, otherwise <code>false</code>.
+ * Indicates whether the line supports a control of the specified type. Some
+ * controls may only be available when the line is open.
+ *
+ * @param control the type of the control for which support is queried
+ * @return {@code true} if at least one control of the specified type is
+ * supported, otherwise {@code false}
*/
- public boolean isControlSupported(Control.Type control);
-
+ boolean isControlSupported(Control.Type control);
/**
- * Obtains a control of the specified type,
- * if there is any.
- * Some controls may only be available when the line is open.
- * @param control the type of the requested control
+ * Obtains a control of the specified type, if there is any. Some controls
+ * may only be available when the line is open.
+ *
+ * @param control the type of the requested control
* @return a control of the specified type
- * @throws IllegalArgumentException if a control of the specified type
- * is not supported
+ * @throws IllegalArgumentException if a control of the specified type is
+ * not supported
* @see #getControls
* @see #isControlSupported(Control.Type control)
*/
- public Control getControl(Control.Type control);
-
+ Control getControl(Control.Type control);
/**
- * Adds a listener to this line. Whenever the line's status changes, the
- * listener's <code>update()</code> method is called with a <code>LineEvent</code> object
- * that describes the change.
- * @param listener the object to add as a listener to this line
+ * Adds a listener to this line. Whenever the line's status changes, the
+ * listener's {@code update()} method is called with a {@code LineEvent}
+ * object that describes the change.
+ *
+ * @param listener the object to add as a listener to this line
* @see #removeLineListener
* @see LineListener#update
* @see LineEvent
*/
- public void addLineListener(LineListener listener);
-
+ void addLineListener(LineListener listener);
/**
* Removes the specified listener from this line's list of listeners.
- * @param listener listener to remove
+ *
+ * @param listener listener to remove
* @see #addLineListener
*/
- public void removeLineListener(LineListener listener);
-
+ void removeLineListener(LineListener listener);
/**
- * A <code>Line.Info</code> object contains information about a line.
- * The only information provided by <code>Line.Info</code> itself
- * is the Java class of the line.
- * A subclass of <code>Line.Info</code> adds other kinds of information
- * about the line. This additional information depends on which <code>Line</code>
- * subinterface is implemented by the kind of line that the <code>Line.Info</code>
- * subclass describes.
+ * A {@code Line.Info} object contains information about a line. The only
+ * information provided by {@code Line.Info} itself is the Java class of the
+ * line. A subclass of {@code Line.Info} adds other kinds of information
+ * about the line. This additional information depends on which {@code Line}
+ * subinterface is implemented by the kind of line that the
+ * {@code Line.Info} subclass describes.
* <p>
- * A <code>Line.Info</code> can be retrieved using various methods of
- * the <code>Line</code>, <code>Mixer</code>, and <code>AudioSystem</code>
- * interfaces. Other such methods let you pass a <code>Line.Info</code> as
- * an argument, to learn whether lines matching the specified configuration
- * are available and to obtain them.
+ * A {@code Line.Info} can be retrieved using various methods of the
+ * {@code Line}, {@code Mixer}, and {@code AudioSystem} interfaces. Other
+ * such methods let you pass a {@code Line.Info} as an argument, to learn
+ * whether lines matching the specified configuration are available and to
+ * obtain them.
*
* @author Kara Kytle
- *
- * @see Line#getLineInfo
- * @see Mixer#getSourceLineInfo
- * @see Mixer#getTargetLineInfo
- * @see Mixer#getLine <code>Mixer.getLine(Line.Info)</code>
- * @see Mixer#getSourceLineInfo(Line.Info) <code>Mixer.getSourceLineInfo(Line.Info)</code>
- * @see Mixer#getSourceLineInfo(Line.Info) <code>Mixer.getTargetLineInfo(Line.Info)</code>
- * @see Mixer#isLineSupported <code>Mixer.isLineSupported(Line.Info)</code>
- * @see AudioSystem#getLine <code>AudioSystem.getLine(Line.Info)</code>
- * @see AudioSystem#getSourceLineInfo <code>AudioSystem.getSourceLineInfo(Line.Info)</code>
- * @see AudioSystem#getTargetLineInfo <code>AudioSystem.getTargetLineInfo(Line.Info)</code>
- * @see AudioSystem#isLineSupported <code>AudioSystem.isLineSupported(Line.Info)</code>
+ * @see Line#getLineInfo()
+ * @see Mixer#getSourceLineInfo()
+ * @see Mixer#getTargetLineInfo()
+ * @see Mixer#getLine(Line.Info)
+ * @see Mixer#getSourceLineInfo(Line.Info)
+ * @see Mixer#getTargetLineInfo(Line.Info)
+ * @see Mixer#isLineSupported(Line.Info)
+ * @see AudioSystem#getLine(Line.Info)
+ * @see AudioSystem#getSourceLineInfo(Line.Info)
+ * @see AudioSystem#getTargetLineInfo(Line.Info)
+ * @see AudioSystem#isLineSupported(Line.Info)
* @since 1.3
*/
- public static class Info {
+ class Info {
/**
* The class of the line described by the info object.
*/
private final Class lineClass;
-
/**
- * Constructs an info object that describes a line of the specified class.
- * This constructor is typically used by an application to
+ * Constructs an info object that describes a line of the specified
+ * class. This constructor is typically used by an application to
* describe a desired line.
- * @param lineClass the class of the line that the new Line.Info object describes
+ *
+ * @param lineClass the class of the line that the new Line.Info object
+ * describes
*/
public Info(Class<?> lineClass) {
@@ -260,33 +249,29 @@
}
}
-
-
/**
* Obtains the class of the line that this Line.Info object describes.
+ *
* @return the described line's class
*/
public Class<?> getLineClass() {
return lineClass;
}
-
/**
- * Indicates whether the specified info object matches this one.
- * To match, the specified object must be identical to or
- * a special case of this one. The specified info object
- * must be either an instance of the same class as this one,
- * or an instance of a sub-type of this one. In addition, the
- * attributes of the specified object must be compatible with the
- * capabilities of this one. Specifically, the routing configuration
- * for the specified info object must be compatible with that of this
- * one.
- * Subclasses may add other criteria to determine whether the two objects
- * match.
+ * Indicates whether the specified info object matches this one. To
+ * match, the specified object must be identical to or a special case of
+ * this one. The specified info object must be either an instance of
+ * the same class as this one, or an instance of a sub-type of this one.
+ * In addition, the attributes of the specified object must be
+ * compatible with the capabilities of this one. Specifically, the
+ * routing configuration for the specified info object must be
+ * compatible with that of this one. Subclasses may add other criteria
+ * to determine whether the two objects match.
*
- * @param info the info object which is being compared to this one
- * @return <code>true</code> if the specified object matches this one,
- * <code>false</code> otherwise
+ * @param info the info object which is being compared to this one
+ * @return {@code true} if the specified object matches this one,
+ * {@code false} otherwise
*/
public boolean matches(Info info) {
@@ -320,7 +305,6 @@
return false;
}
-
// this.isAssignableFrom(that) => this is same or super to that
// => this is at least as general as that
// => that may be subtype of this
@@ -332,11 +316,12 @@
return true;
}
-
/**
* Obtains a textual description of the line info.
+ *
* @return a string description
*/
+ @Override
public String toString() {
String fullPackagePath = "javax.sound.sampled.";
@@ -353,7 +338,5 @@
return finalString;
}
-
- } // class Info
-
-} // interface Line
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/LineEvent.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/LineEvent.java Wed Jun 04 17:14:56 2014 +0400
@@ -25,61 +25,64 @@
package javax.sound.sampled;
+import java.util.EventObject;
+
/**
- * The <code>LineEvent</code> class encapsulates information that a line
- * sends its listeners whenever the line opens, closes, starts, or stops.
- * Each of these four state changes is represented by a corresponding
- * type of event. A listener receives the event as a parameter to its
- * {@link LineListener#update update} method. By querying the event,
- * the listener can learn the type of event, the line responsible for
- * the event, and how much data the line had processed when the event occurred.
- *
- * <p>Although this class implements Serializable, attempts to
- * serialize a <code>LineEvent</code> object will fail.
+ * The {@code LineEvent} class encapsulates information that a line sends its
+ * listeners whenever the line opens, closes, starts, or stops. Each of these
+ * four state changes is represented by a corresponding type of event. A
+ * listener receives the event as a parameter to its
+ * {@link LineListener#update update} method. By querying the event, the
+ * listener can learn the type of event, the line responsible for the event, and
+ * how much data the line had processed when the event occurred.
+ * <p>
+ * Although this class implements Serializable, attempts to serialize a
+ * {@code LineEvent} object will fail.
*
* @author Kara Kytle
- *
* @see Line
* @see LineListener#update
* @since 1.3
*
* @serial exclude
*/
-public class LineEvent extends java.util.EventObject {
+public class LineEvent extends EventObject {
+
private static final long serialVersionUID = -1274246333383880410L;
- // INSTANCE VARIABLES
-
/**
- * The kind of line event (<code>OPEN</code>, <code>CLOSE</code>,
- * <code>START</code>, or <code>STOP</code>).
+ * The kind of line event ({@code OPEN}, {@code CLOSE}, {@code START}, or
+ * {@code STOP}).
+ *
+ * @serial
* @see #getType
- * @serial
*/
private final Type type;
/**
* The media position when the event occurred, expressed in sample frames.
- * Note that this field is only relevant to certain events generated by
- * data lines, such as <code>START</code> and <code>STOP</code>. For
- * events generated by lines that do not count sample frames, and for any
- * other events for which this value is not known, the position value
- * should be {@link AudioSystem#NOT_SPECIFIED}.
+ * Note that this field is only relevant to certain events generated by data
+ * lines, such as {@code START} and {@code STOP}. For events generated by
+ * lines that do not count sample frames, and for any other events for which
+ * this value is not known, the position value should be
+ * {@link AudioSystem#NOT_SPECIFIED}.
+ *
* @serial
* @see #getFramePosition
*/
private final long position;
-
/**
- * Constructs a new event of the specified type, originating from the specified line.
- * @param line the source of this event
- * @param type the event type (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>)
- * @param position the number of sample frames that the line had already processed when the event occurred,
- * or {@link AudioSystem#NOT_SPECIFIED}
+ * Constructs a new event of the specified type, originating from the
+ * specified line.
*
- * @throws IllegalArgumentException if <code>line</code> is
- * <code>null</code>.
+ * @param line the source of this event
+ * @param type the event type ({@code OPEN}, {@code CLOSE}, {@code START},
+ * or {@code STOP})
+ * @param position the number of sample frames that the line had already
+ * processed when the event occurred, or
+ * {@link AudioSystem#NOT_SPECIFIED}
+ * @throws IllegalArgumentException if {@code line} is {@code null}.
*/
public LineEvent(Line line, Type type, long position) {
@@ -90,6 +93,7 @@
/**
* Obtains the audio line that is the source of this event.
+ *
* @return the line responsible for this event
*/
public final Line getLine() {
@@ -97,11 +101,11 @@
return (Line)getSource();
}
-
/**
* Obtains the event's type.
+ *
* @return this event's type ({@link Type#OPEN}, {@link Type#CLOSE},
- * {@link Type#START}, or {@link Type#STOP})
+ * {@link Type#START}, or {@link Type#STOP})
*/
public final Type getType() {
@@ -109,21 +113,24 @@
}
/**
- * Obtains the position in the line's audio data when the event occurred, expressed in sample frames.
- * For example, if a source line had already played back 14 sample frames at the time it was
- * paused, the pause event would report the line's position as 14. The next frame to be processed
- * would be frame number 14 using zero-based numbering, or 15 using one-based numbering.
+ * Obtains the position in the line's audio data when the event occurred,
+ * expressed in sample frames. For example, if a source line had already
+ * played back 14 sample frames at the time it was paused, the pause event
+ * would report the line's position as 14. The next frame to be processed
+ * would be frame number 14 using zero-based numbering, or 15 using
+ * one-based numbering.
* <p>
- * Note that this field is relevant only to certain events generated by
- * data lines, such as <code>START</code> and <code>STOP</code>. For
- * events generated by lines that do not count sample frames, and for any
- * other events for which this value is not known, the position value
- * should be {@link AudioSystem#NOT_SPECIFIED}.
+ * Note that this field is relevant only to certain events generated by data
+ * lines, such as {@code START} and {@code STOP}. For events generated by
+ * lines that do not count sample frames, and for any other events for which
+ * this value is not known, the position value should be
+ * {@link AudioSystem#NOT_SPECIFIED}.
*
* @return the line's position as a sample frame number
*/
/*
- * $$kk: 04.20.99: note to myself: should make sure our implementation is consistent with this.
+ * $$kk: 04.20.99: note to myself: should make sure our implementation is
+ * consistent with this.
* which is a reasonable definition....
*/
public final long getFramePosition() {
@@ -132,10 +139,12 @@
}
/**
- * Obtains a string representation of the event. The contents of the string may vary
- * between implementations of Java Sound.
- * @return a string describing the event.
+ * Obtains a string representation of the event. The contents of the string
+ * may vary between implementations of Java Sound.
+ *
+ * @return a string describing the event
*/
+ @Override
public String toString() {
String sType = "";
if (type != null) sType = type.toString()+" ";
@@ -148,16 +157,15 @@
return new String(sType + "event from line " + sLine);
}
-
/**
- * The LineEvent.Type inner class identifies what kind of event occurred on a line.
- * Static instances are provided for the common types (OPEN, CLOSE, START, and STOP).
+ * The LineEvent.Type inner class identifies what kind of event occurred on
+ * a line. Static instances are provided for the common types (OPEN, CLOSE,
+ * START, and STOP).
*
* @see LineEvent#getType()
*/
public static class Type {
-
/**
* Type name.
*/
@@ -166,82 +174,84 @@
/**
* Constructs a new event type.
- * @param name name of the type
+ *
+ * @param name name of the type
*/
protected Type(String name) {
this.name = name;
}
+ //$$fb 2002-11-26: fix for 4695001: SPEC: description of equals() method contains typo
- //$$fb 2002-11-26: fix for 4695001: SPEC: description of equals() method contains typo
/**
* Indicates whether the specified object is equal to this event type,
- * returning <code>true</code> if the objects are identical.
- * @param obj the reference object with which to compare
- * @return <code>true</code> if this event type is the same as
- * <code>obj</code>; <code>false</code> otherwise
+ * returning {@code true} if the objects are identical.
+ *
+ * @param obj the reference object with which to compare
+ * @return {@code true} if this event type is the same as {@code obj};
+ * {@code false} otherwise
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
-
/**
* Finalizes the hashcode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
-
/**
* Returns the type name as the string representation.
*/
+ @Override
public String toString() {
return name;
}
-
// LINE EVENT TYPE DEFINES
/**
* A type of event that is sent when a line opens, reserving system
* resources for itself.
+ *
* @see #CLOSE
* @see Line#open
*/
public static final Type OPEN = new Type("Open");
-
/**
* A type of event that is sent when a line closes, freeing the system
* resources it had obtained when it was opened.
+ *
* @see #OPEN
* @see Line#close
*/
public static final Type CLOSE = new Type("Close");
-
/**
* A type of event that is sent when a line begins to engage in active
* input or output of audio data in response to a
* {@link DataLine#start start} request.
+ *
* @see #STOP
* @see DataLine#start
*/
public static final Type START = new Type("Start");
-
/**
- * A type of event that is sent when a line ceases active input or output
- * of audio data in response to a {@link DataLine#stop stop} request,
- * or because the end of media has been reached.
+ * A type of event that is sent when a line ceases active input or
+ * output of audio data in response to a {@link DataLine#stop stop}
+ * request, or because the end of media has been reached.
+ *
* @see #START
* @see DataLine#stop
*/
public static final Type STOP = new Type("Stop");
-
/**
* A type of event that is sent when a line ceases to engage in active
* input or output of audio data because the end of media has been reached.
@@ -255,7 +265,6 @@
*/
//public static final Type EOM = new Type("EOM");
-
/**
* A type of event that is sent when a line begins to engage in active
* input or output of audio data. Examples of when this happens are
@@ -268,7 +277,6 @@
*/
//public static final Type ACTIVE = new Type("ACTIVE");
-
/**
* A type of event that is sent when a line ceases active input or output
* of audio data.
@@ -276,7 +284,5 @@
* @see DataLine#stop
*/
//public static final Type INACTIVE = new Type("INACTIVE");
-
- } // class Type
-
-} // class LineEvent
+ }
+}
--- a/jdk/src/share/classes/javax/sound/sampled/LineListener.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/LineListener.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,44 +25,27 @@
package javax.sound.sampled;
-
+import java.util.EventListener;
/**
- * Instances of classes that implement the <code>LineListener</code> interface can register to
- * receive events when a line's status changes.
+ * Instances of classes that implement the {@code LineListener} interface can
+ * register to receive events when a line's status changes.
*
* @author Kara Kytle
- *
* @see Line
* @see Line#addLineListener
* @see Line#removeLineListener
* @see LineEvent
- *
* @since 1.3
*/
-/*
- * Instances of classes that implement the <code>LineListener</code> interface can register to
- * receive events when a line's status changes.
- *
- * @see Line
- * @see Line#addLineListener
- * @see Line#removeLineListener
- * @see LineEvent
- *
- * @author Kara Kytle
- */
-public interface LineListener extends java.util.EventListener {
+public interface LineListener extends EventListener {
/**
- * Informs the listener that a line's state has changed. The listener can then invoke
- * <code>LineEvent</code> methods to obtain information about the event.
- * @param event a line event that describes the change
+ * Informs the listener that a line's state has changed. The listener can
+ * then invoke {@code LineEvent} methods to obtain information about the
+ * event.
+ *
+ * @param event a line event that describes the change
*/
- /*
- * Informs the listener that a line's state has changed. The listener can then invoke
- * <code>LineEvent</code> methods to obtain information about the event.
- * @param event a line event that describes the change
- */
- public void update(LineEvent event);
-
-} // interface LineListener
+ void update(LineEvent event);
+}
--- a/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/LineUnavailableException.java Wed Jun 04 17:14:56 2014 +0400
@@ -26,43 +26,32 @@
package javax.sound.sampled;
/**
- * A <code>LineUnavailableException</code> is an exception indicating that a
- * line cannot be opened because it is unavailable. This situation
- * arises most commonly when a requested line is already in use
- * by another application.
+ * A {@code LineUnavailableException} is an exception indicating that a line
+ * cannot be opened because it is unavailable. This situation arises most
+ * commonly when a requested line is already in use by another application.
*
* @author Kara Kytle
* @since 1.3
*/
-/*
- * A <code>LinenavailableException</code> is an exception indicating that a
- * line annot be opened because it is unavailable. This situation
- * arises most commonly when a line is requested when it is already in use
- * by another application.
- *
- * @author Kara Kytle
- */
+public class LineUnavailableException extends Exception {
-public class LineUnavailableException extends Exception {
private static final long serialVersionUID = -2046718279487432130L;
/**
- * Constructs a <code>LineUnavailableException</code> that has
- * <code>null</code> as its error detail message.
+ * Constructs a {@code LineUnavailableException} that has {@code null} as
+ * its error detail message.
*/
public LineUnavailableException() {
-
super();
}
/**
- * Constructs a <code>LineUnavailableException</code> that has
- * the specified detail message.
+ * Constructs a {@code LineUnavailableException} that has the specified
+ * detail message.
*
- * @param message a string containing the error detail message
+ * @param message a string containing the error detail message
*/
- public LineUnavailableException(String message) {
-
+ public LineUnavailableException(final String message) {
super(message);
}
}
--- a/jdk/src/share/classes/javax/sound/sampled/Mixer.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/Mixer.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,30 +25,27 @@
package javax.sound.sampled;
-
/**
- * A mixer is an audio device with one or more lines. It need not be
- * designed for mixing audio signals. A mixer that actually mixes audio
- * has multiple input (source) lines and at least one output (target) line.
- * The former are often instances of classes that implement
- * <code>{@link SourceDataLine}</code>,
- * and the latter, <code>{@link TargetDataLine}</code>. <code>{@link Port}</code>
- * objects, too, are either source lines or target lines.
- * A mixer can accept prerecorded, loopable sound as input, by having
- * some of its source lines be instances of objects that implement the
- * <code>{@link Clip}</code> interface.
+ * A mixer is an audio device with one or more lines. It need not be designed
+ * for mixing audio signals. A mixer that actually mixes audio has multiple
+ * input (source) lines and at least one output (target) line. The former are
+ * often instances of classes that implement {@link SourceDataLine}, and the
+ * latter, {@link TargetDataLine}. {@link Port} objects, too, are either source
+ * lines or target lines. A mixer can accept prerecorded, loopable sound as
+ * input, by having some of its source lines be instances of objects that
+ * implement the {@link Clip} interface.
* <p>
- * Through methods of the <code>Line</code> interface, which <code>Mixer</code> extends,
- * a mixer might provide a set of controls that are global to the mixer. For example,
- * the mixer can have a master gain control. These global controls are distinct
- * from the controls belonging to each of the mixer's individual lines.
+ * Through methods of the {@code Line} interface, which {@code Mixer} extends, a
+ * mixer might provide a set of controls that are global to the mixer. For
+ * example, the mixer can have a master gain control. These global controls are
+ * distinct from the controls belonging to each of the mixer's individual lines.
* <p>
- * Some mixers, especially
- * those with internal digital mixing capabilities, may provide
- * additional capabilities by implementing the <code>DataLine</code> interface.
+ * Some mixers, especially those with internal digital mixing capabilities, may
+ * provide additional capabilities by implementing the {@code DataLine}
+ * interface.
* <p>
- * A mixer can support synchronization of its lines. When one line in
- * a synchronized group is started or stopped, the other lines in the group
+ * A mixer can support synchronization of its lines. When one line in a
+ * synchronized group is started or stopped, the other lines in the group
* automatically start or stop simultaneously with the explicitly affected one.
*
* @author Kara Kytle
@@ -59,198 +56,201 @@
/**
* Obtains information about this mixer, including the product's name,
* version, vendor, etc.
+ *
* @return a mixer info object that describes this mixer
* @see Mixer.Info
*/
- public Info getMixerInfo();
-
+ Info getMixerInfo();
/**
- * Obtains information about the set of source lines supported
- * by this mixer.
- * Some source lines may only be available when this mixer is open.
- * @return array of <code>Line.Info</code> objects representing source lines
- * for this mixer. If no source lines are supported,
- * an array of length 0 is returned.
+ * Obtains information about the set of source lines supported by this
+ * mixer. Some source lines may only be available when this mixer is open.
+ *
+ * @return array of {@code Line.Info} objects representing source lines for
+ * this mixer. If no source lines are supported, an array of length
+ * 0 is returned.
*/
- public Line.Info[] getSourceLineInfo();
+ Line.Info[] getSourceLineInfo();
/**
- * Obtains information about the set of target lines supported
- * by this mixer.
- * Some target lines may only be available when this mixer is open.
- * @return array of <code>Line.Info</code> objects representing target lines
- * for this mixer. If no target lines are supported,
- * an array of length 0 is returned.
+ * Obtains information about the set of target lines supported by this
+ * mixer. Some target lines may only be available when this mixer is open.
+ *
+ * @return array of {@code Line.Info} objects representing target lines for
+ * this mixer. If no target lines are supported, an array of length
+ * 0 is returned.
*/
- public Line.Info[] getTargetLineInfo();
-
+ Line.Info[] getTargetLineInfo();
/**
- * Obtains information about source lines of a particular type supported
- * by the mixer.
- * Some source lines may only be available when this mixer is open.
- * @param info a <code>Line.Info</code> object describing lines about which information
- * is queried
- * @return an array of <code>Line.Info</code> objects describing source lines matching
- * the type requested. If no matching source lines are supported, an array of length 0
- * is returned.
+ * Obtains information about source lines of a particular type supported by
+ * the mixer. Some source lines may only be available when this mixer is
+ * open.
+ *
+ * @param info a {@code Line.Info} object describing lines about which
+ * information is queried
+ * @return an array of {@code Line.Info} objects describing source lines
+ * matching the type requested. If no matching source lines are
+ * supported, an array of length 0 is returned.
*/
- public Line.Info[] getSourceLineInfo(Line.Info info);
-
+ Line.Info[] getSourceLineInfo(Line.Info info);
/**
- * Obtains information about target lines of a particular type supported
- * by the mixer.
- * Some target lines may only be available when this mixer is open.
- * @param info a <code>Line.Info</code> object describing lines about which information
- * is queried
- * @return an array of <code>Line.Info</code> objects describing target lines matching
- * the type requested. If no matching target lines are supported, an array of length 0
- * is returned.
+ * Obtains information about target lines of a particular type supported by
+ * the mixer. Some target lines may only be available when this mixer is
+ * open.
+ *
+ * @param info a {@code Line.Info} object describing lines about which
+ * information is queried
+ * @return an array of {@code Line.Info} objects describing target lines
+ * matching the type requested. If no matching target lines are
+ * supported, an array of length 0 is returned.
*/
- public Line.Info[] getTargetLineInfo(Line.Info info);
-
+ Line.Info[] getTargetLineInfo(Line.Info info);
/**
- * Indicates whether the mixer supports a line (or lines) that match
- * the specified <code>Line.Info</code> object.
- * Some lines may only be supported when this mixer is open.
- * @param info describes the line for which support is queried
- * @return <code>true</code> if at least one matching line is
- * supported, <code>false</code> otherwise
+ * Indicates whether the mixer supports a line (or lines) that match the
+ * specified {@code Line.Info} object. Some lines may only be supported when
+ * this mixer is open.
+ *
+ * @param info describes the line for which support is queried
+ * @return {@code true} if at least one matching line is supported,
+ * {@code false} otherwise
*/
- public boolean isLineSupported(Line.Info info);
+ boolean isLineSupported(Line.Info info);
/**
* Obtains a line that is available for use and that matches the description
- * in the specified <code>Line.Info</code> object.
+ * in the specified {@code Line.Info} object.
+ * <p>
+ * If a {@code DataLine} is requested, and {@code info} is an instance of
+ * {@code DataLine.Info} specifying at least one fully qualified audio
+ * format, the last one will be used as the default format of the returned
+ * {@code DataLine}.
*
- * <p>If a <code>DataLine</code> is requested, and <code>info</code>
- * is an instance of <code>DataLine.Info</code> specifying at
- * least one fully qualified audio format, the last one
- * will be used as the default format of the returned
- * <code>DataLine</code>.
- *
- * @param info describes the desired line
+ * @param info describes the desired line
* @return a line that is available for use and that matches the description
- * in the specified {@code Line.Info} object
- * @throws LineUnavailableException if a matching line
- * is not available due to resource restrictions
- * @throws IllegalArgumentException if this mixer does
- * not support any lines matching the description
- * @throws SecurityException if a matching line
- * is not available due to security restrictions
+ * in the specified {@code Line.Info} object
+ * @throws LineUnavailableException if a matching line is not available due
+ * to resource restrictions
+ * @throws IllegalArgumentException if this mixer does not support any lines
+ * matching the description
+ * @throws SecurityException if a matching line is not available due to
+ * security restrictions
*/
- public Line getLine(Line.Info info) throws LineUnavailableException;
+ Line getLine(Line.Info info) throws LineUnavailableException;
//$$fb 2002-04-12: fix for 4667258: behavior of Mixer.getMaxLines(Line.Info) method doesn't match the spec
/**
- * Obtains the approximate maximum number of lines of the requested type that can be open
- * simultaneously on the mixer.
+ * Obtains the approximate maximum number of lines of the requested type
+ * that can be open simultaneously on the mixer.
*
- * Certain types of mixers do not have a hard bound and may allow opening more lines.
- * Since certain lines are a shared resource, a mixer may not be able to open the maximum
- * number of lines if another process has opened lines of this mixer.
+ * Certain types of mixers do not have a hard bound and may allow opening
+ * more lines. Since certain lines are a shared resource, a mixer may not be
+ * able to open the maximum number of lines if another process has opened
+ * lines of this mixer.
*
- * The requested type is any line that matches the description in
- * the provided <code>Line.Info</code> object. For example, if the info
- * object represents a speaker
- * port, and the mixer supports exactly one speaker port, this method
- * should return 1. If the info object represents a source data line
- * and the mixer supports the use of 32 source data lines simultaneously,
- * the return value should be 32.
- * If there is no limit, this function returns <code>AudioSystem.NOT_SPECIFIED</code>.
- * @param info a <code>Line.Info</code> that describes the line for which
- * the number of supported instances is queried
- * @return the maximum number of matching lines supported, or <code>AudioSystem.NOT_SPECIFIED</code>
+ * The requested type is any line that matches the description in the
+ * provided {@code Line.Info} object. For example, if the info object
+ * represents a speaker port, and the mixer supports exactly one speaker
+ * port, this method should return 1. If the info object represents a
+ * source data line and the mixer supports the use of 32 source data lines
+ * simultaneously, the return value should be 32. If there is no limit, this
+ * function returns {@code AudioSystem.NOT_SPECIFIED}.
+ *
+ * @param info a {@code Line.Info} that describes the line for which the
+ * number of supported instances is queried
+ * @return the maximum number of matching lines supported, or
+ * {@code AudioSystem.NOT_SPECIFIED}
*/
- public int getMaxLines(Line.Info info);
-
+ int getMaxLines(Line.Info info);
/**
* Obtains the set of all source lines currently open to this mixer.
*
- * @return the source lines currently open to the mixer.
- * If no source lines are currently open to this mixer, an
- * array of length 0 is returned.
- * @throws SecurityException if the matching lines
- * are not available due to security restrictions
+ * @return the source lines currently open to the mixer. If no source lines
+ * are currently open to this mixer, an array of length 0 is
+ * returned.
+ * @throws SecurityException if the matching lines are not available due to
+ * security restrictions
*/
- public Line[] getSourceLines();
+ Line[] getSourceLines();
/**
* Obtains the set of all target lines currently open from this mixer.
*
- * @return target lines currently open from the mixer.
- * If no target lines are currently open from this mixer, an
- * array of length 0 is returned.
- * @throws SecurityException if the matching lines
- * are not available due to security restrictions
+ * @return target lines currently open from the mixer. If no target lines
+ * are currently open from this mixer, an array of length 0 is
+ * returned.
+ * @throws SecurityException if the matching lines are not available due to
+ * security restrictions
*/
- public Line[] getTargetLines();
+ Line[] getTargetLines();
/**
- * Synchronizes two or more lines. Any subsequent command that starts or stops
- * audio playback or capture for one of these lines will exert the
- * same effect on the other lines in the group, so that they start or stop playing or
- * capturing data simultaneously.
+ * Synchronizes two or more lines. Any subsequent command that starts or
+ * stops audio playback or capture for one of these lines will exert the
+ * same effect on the other lines in the group, so that they start or stop
+ * playing or capturing data simultaneously.
*
- * @param lines the lines that should be synchronized
- * @param maintainSync <code>true</code> if the synchronization
- * must be precisely maintained (i.e., the synchronization must be sample-accurate)
- * at all times during operation of the lines , or <code>false</code>
- * if precise synchronization is required only during start and stop operations
- *
+ * @param lines the lines that should be synchronized
+ * @param maintainSync {@code true} if the synchronization must be
+ * precisely maintained (i.e., the synchronization must be
+ * sample-accurate) at all times during operation of the lines, or
+ * {@code false} if precise synchronization is required only during
+ * start and stop operations
* @throws IllegalArgumentException if the lines cannot be synchronized.
- * This may occur if the lines are of different types or have different
- * formats for which this mixer does not support synchronization, or if
- * all lines specified do not belong to this mixer.
+ * This may occur if the lines are of different types or have
+ * different formats for which this mixer does not support
+ * synchronization, or if all lines specified do not belong to this
+ * mixer.
*/
- public void synchronize(Line[] lines, boolean maintainSync);
+ void synchronize(Line[] lines, boolean maintainSync);
/**
- * Releases synchronization for the specified lines. The array must
- * be identical to one for which synchronization has already been
- * established; otherwise an exception may be thrown. However, <code>null</code>
- * may be specified, in which case all currently synchronized lines that belong
- * to this mixer are unsynchronized.
- * @param lines the synchronized lines for which synchronization should be
- * released, or <code>null</code> for all this mixer's synchronized lines
+ * Releases synchronization for the specified lines. The array must be
+ * identical to one for which synchronization has already been established;
+ * otherwise an exception may be thrown. However, {@code null} may be
+ * specified, in which case all currently synchronized lines that belong to
+ * this mixer are unsynchronized.
*
+ * @param lines the synchronized lines for which synchronization should be
+ * released, or {@code null} for all this mixer's synchronized
+ * lines
* @throws IllegalArgumentException if the lines cannot be unsynchronized.
- * This may occur if the argument specified does not exactly match a set
- * of lines for which synchronization has already been established.
+ * This may occur if the argument specified does not exactly match
+ * a set of lines for which synchronization has already been
+ * established.
*/
- public void unsynchronize(Line[] lines);
-
+ void unsynchronize(Line[] lines);
/**
- * Reports whether this mixer supports synchronization of the specified set of lines.
+ * Reports whether this mixer supports synchronization of the specified set
+ * of lines.
*
- * @param lines the set of lines for which synchronization support is queried
- * @param maintainSync <code>true</code> if the synchronization
- * must be precisely maintained (i.e., the synchronization must be sample-accurate)
- * at all times during operation of the lines , or <code>false</code>
- * if precise synchronization is required only during start and stop operations
- *
- * @return <code>true</code> if the lines can be synchronized, <code>false</code>
- * otherwise
+ * @param lines the set of lines for which synchronization support is
+ * queried
+ * @param maintainSync {@code true} if the synchronization must be
+ * precisely maintained (i.e., the synchronization must be
+ * sample-accurate) at all times during operation of the lines, or
+ * {@code false} if precise synchronization is required only during
+ * start and stop operations
+ * @return {@code true} if the lines can be synchronized, {@code false}
+ * otherwise
*/
- public boolean isSynchronizationSupported(Line[] lines, boolean maintainSync);
-
+ boolean isSynchronizationSupported(Line[] lines, boolean maintainSync);
/**
- * The <code>Mixer.Info</code> class represents information about an audio mixer,
+ * The {@code Mixer.Info} class represents information about an audio mixer,
* including the product's name, version, and vendor, along with a textual
- * description. This information may be retrieved through the
- * {@link Mixer#getMixerInfo() getMixerInfo}
- * method of the <code>Mixer</code> interface.
+ * description. This information may be retrieved through the
+ * {@link Mixer#getMixerInfo() getMixerInfo} method of the {@code Mixer}
+ * interface.
*
* @author Kara Kytle
* @since 1.3
*/
- public static class Info {
+ class Info {
/**
* Mixer name.
@@ -273,13 +273,14 @@
private final String version;
/**
- * Constructs a mixer's info object, passing it the given
- * textual information.
- * @param name the name of the mixer
- * @param vendor the company who manufactures or creates the hardware
- * or software mixer
- * @param description descriptive text about the mixer
- * @param version version information for the mixer
+ * Constructs a mixer's info object, passing it the given textual
+ * information.
+ *
+ * @param name the name of the mixer
+ * @param vendor the company who manufactures or creates the
+ * hardware or software mixer
+ * @param description descriptive text about the mixer
+ * @param version version information for the mixer
*/
protected Info(String name, String vendor, String description, String version) {
@@ -289,15 +290,16 @@
this.version = version;
}
-
/**
- * Indicates whether two info objects are equal, returning <code>true</code> if
- * they are identical.
- * @param obj the reference object with which to compare this info
- * object
- * @return <code>true</code> if this info object is the same as the
- * <code>obj</code> argument; <code>false</code> otherwise
+ * Indicates whether two info objects are equal, returning {@code true}
+ * if they are identical.
+ *
+ * @param obj the reference object with which to compare this info
+ * object
+ * @return {@code true} if this info object is the same as the
+ * {@code obj} argument; {@code false} otherwise
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
@@ -307,12 +309,14 @@
*
* @return the hashcode for this object
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
/**
* Obtains the name of the mixer.
+ *
* @return a string that names the mixer
*/
public final String getName() {
@@ -321,6 +325,7 @@
/**
* Obtains the vendor of the mixer.
+ *
* @return a string that names the mixer's vendor
*/
public final String getVendor() {
@@ -329,6 +334,7 @@
/**
* Obtains the description of the mixer.
+ *
* @return a textual description of the mixer
*/
public final String getDescription() {
@@ -337,6 +343,7 @@
/**
* Obtains the version of the mixer.
+ *
* @return textual version information for the mixer
*/
public final String getVersion() {
@@ -345,10 +352,12 @@
/**
* Provides a string representation of the mixer info.
+ *
* @return a string describing the info object
*/
+ @Override
public final String toString() {
return (name + ", version " + version);
}
- } // class Info
+ }
}
--- a/jdk/src/share/classes/javax/sound/sampled/Port.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/Port.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,41 +25,36 @@
package javax.sound.sampled;
-
/**
* Ports are simple lines for input or output of audio to or from audio devices.
- * Common examples of ports that act as source lines (mixer inputs) include the microphone,
- * line input, and CD-ROM drive. Ports that act as target lines (mixer outputs) include the
- * speaker, headphone, and line output. You can access port using a <code>{@link Port.Info}</code>
- * object.
+ * Common examples of ports that act as source lines (mixer inputs) include the
+ * microphone, line input, and CD-ROM drive. Ports that act as target lines
+ * (mixer outputs) include the speaker, headphone, and line output. You can
+ * access port using a {@link Port.Info} object.
*
* @author Kara Kytle
* @since 1.3
*/
public interface Port extends Line {
-
- // INNER CLASSES
-
-
/**
- * The <code>Port.Info</code> class extends <code>{@link Line.Info}</code>
- * with additional information specific to ports, including the port's name
- * and whether it is a source or a target for its mixer.
- * By definition, a port acts as either a source or a target to its mixer,
- * but not both. (Audio input ports are sources; audio output ports are targets.)
+ * The {@code Port.Info} class extends {@code Line.Info} with additional
+ * information specific to ports, including the port's name and whether it
+ * is a source or a target for its mixer. By definition, a port acts as
+ * either a source or a target to its mixer, but not both. (Audio input
+ * ports are sources; audio output ports are targets.)
* <p>
- * To learn what ports are available, you can retrieve port info objects through the
- * <code>{@link Mixer#getSourceLineInfo getSourceLineInfo}</code> and
- * <code>{@link Mixer#getTargetLineInfo getTargetLineInfo}</code>
- * methods of the <code>Mixer</code> interface. Instances of the
- * <code>Port.Info</code> class may also be constructed and used to obtain
- * lines matching the parameters specified in the <code>Port.Info</code> object.
+ * To learn what ports are available, you can retrieve port info objects
+ * through the {@link Mixer#getSourceLineInfo getSourceLineInfo} and
+ * {@link Mixer#getTargetLineInfo getTargetLineInfo} methods of the
+ * {@code Mixer} interface. Instances of the {@code Port.Info} class may
+ * also be constructed and used to obtain lines matching the parameters
+ * specified in the {@code Port.Info} object.
*
* @author Kara Kytle
* @since 1.3
*/
- public static class Info extends Line.Info {
+ class Info extends Line.Info {
// AUDIO PORT TYPE DEFINES
@@ -68,7 +63,8 @@
// SOURCE PORTS
/**
- * A type of port that gets audio from a built-in microphone or a microphone jack.
+ * A type of port that gets audio from a built-in microphone or a
+ * microphone jack.
*/
public static final Info MICROPHONE = new Info(Port.class,"MICROPHONE", true);
@@ -86,7 +82,8 @@
// TARGET PORTS
/**
- * A type of port that sends audio to a built-in speaker or a speaker jack.
+ * A type of port that sends audio to a built-in speaker or a speaker
+ * jack.
*/
public static final Info SPEAKER = new Info(Port.class,"SPEAKER", false);
@@ -113,19 +110,16 @@
private String name;
private boolean isSource;
-
- // CONSTRUCTOR
-
/**
- * Constructs a port's info object from the information given.
- * This constructor is typically used by an implementation
- * of Java Sound to describe a supported line.
+ * Constructs a port's info object from the information given. This
+ * constructor is typically used by an implementation of Java Sound to
+ * describe a supported line.
*
- * @param lineClass the class of the port described by the info object.
- * @param name the string that names the port
- * @param isSource <code>true</code> if the port is a source port (such
- * as a microphone), <code>false</code> if the port is a target port
- * (such as a speaker).
+ * @param lineClass the class of the port described by the info object
+ * @param name the string that names the port
+ * @param isSource {@code true} if the port is a source port (such as a
+ * microphone), {@code false} if the port is a target port
+ * (such as a speaker)
*/
public Info(Class<?> lineClass, String name, boolean isSource) {
@@ -134,11 +128,9 @@
this.isSource = isSource;
}
-
- // METHODS
-
/**
* Obtains the name of the port.
+ *
* @return the string that names the port
*/
public String getName() {
@@ -147,20 +139,23 @@
/**
* Indicates whether the port is a source or a target for its mixer.
- * @return <code>true</code> if the port is a source port (such
- * as a microphone), <code>false</code> if the port is a target port
- * (such as a speaker).
+ *
+ * @return {@code true} if the port is a source port (such as a
+ * microphone), {@code false} if the port is a target port
+ * (such as a speaker)
*/
public boolean isSource() {
return isSource;
}
/**
- * Indicates whether this info object specified matches this one.
- * To match, the match requirements of the superclass must be
- * met and the types must be equal.
- * @param info the info object for which the match is queried
+ * Indicates whether this info object specified matches this one. To
+ * match, the match requirements of the superclass must be met and the
+ * types must be equal.
+ *
+ * @param info the info object for which the match is queried
*/
+ @Override
public boolean matches(Line.Info info) {
if (! (super.matches(info)) ) {
@@ -178,31 +173,30 @@
return true;
}
-
/**
- * Finalizes the equals method
+ * Finalizes the equals method.
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
/**
- * Finalizes the hashCode method
+ * Finalizes the hashCode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
-
-
/**
- * Provides a <code>String</code> representation
- * of the port.
- * @return a string that describes the port
+ * Provides a {@code String} representation of the port.
+ *
+ * @return a string that describes the port
*/
+ @Override
public final String toString() {
return (name + ((isSource == true) ? " source" : " target") + " port");
}
-
- } // class Info
+ }
}
--- a/jdk/src/share/classes/javax/sound/sampled/ReverbType.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/ReverbType.java Wed Jun 04 17:14:56 2014 +0400
@@ -25,46 +25,41 @@
package javax.sound.sampled;
-
/**
- * The <code>ReverbType</code> class provides methods for
- * accessing various reverberation settings to be applied to
- * an audio signal.
+ * The {@code ReverbType} class provides methods for accessing various
+ * reverberation settings to be applied to an audio signal.
* <p>
- * Reverberation simulates the reflection of sound off of
- * the walls, ceiling, and floor of a room. Depending on
- * the size of the room, and how absorbent or reflective the materials in the
- * room's surfaces are, the sound might bounce around for a
- * long time before dying away.
+ * Reverberation simulates the reflection of sound off of the walls, ceiling,
+ * and floor of a room. Depending on the size of the room, and how absorbent or
+ * reflective the materials in the room's surfaces are, the sound might bounce
+ * around for a long time before dying away.
* <p>
- * The reverberation parameters provided by <code>ReverbType</code> consist
- * of the delay time and intensity of early reflections, the delay time and
- * intensity of late reflections, and an overall decay time.
- * Early reflections are the initial individual low-order reflections of the
- * direct signal off the surfaces in the room.
- * The late Reflections are the dense, high-order reflections that characterize
- * the room's reverberation.
- * The delay times for the start of these two reflection types give the listener
- * a sense of the overall size and complexity of the room's shape and contents.
- * The larger the room, the longer the reflection delay times.
- * The early and late reflections' intensities define the gain (in decibels) of the reflected
- * signals as compared to the direct signal. These intensities give the
- * listener an impression of the absorptive nature of the surfaces and objects
- * in the room.
+ * The reverberation parameters provided by {@code ReverbType} consist of the
+ * delay time and intensity of early reflections, the delay time and intensity
+ * of late reflections, and an overall decay time. Early reflections are the
+ * initial individual low-order reflections of the direct signal off the
+ * surfaces in the room. The late Reflections are the dense, high-order
+ * reflections that characterize the room's reverberation. The delay times for
+ * the start of these two reflection types give the listener a sense of the
+ * overall size and complexity of the room's shape and contents. The larger the
+ * room, the longer the reflection delay times. The early and late reflections'
+ * intensities define the gain (in decibels) of the reflected signals as
+ * compared to the direct signal. These intensities give the listener an
+ * impression of the absorptive nature of the surfaces and objects in the room.
* The decay time defines how long the reverberation takes to exponentially
- * decay until it is no longer perceptible ("effective zero").
- * The larger and less absorbent the surfaces, the longer the decay time.
+ * decay until it is no longer perceptible ("effective zero"). The larger and
+ * less absorbent the surfaces, the longer the decay time.
* <p>
- * The set of parameters defined here may not include all aspects of reverberation
- * as specified by some systems. For example, the Midi Manufacturer's Association
- * (MMA) has an Interactive Audio Special Interest Group (IASIG), which has a
- * 3-D Working Group that has defined a Level 2 Spec (I3DL2). I3DL2
- * supports filtering of reverberation and
- * control of reverb density. These properties are not included in the JavaSound 1.0
- * definition of a reverb control. In such a case, the implementing system
- * should either extend the defined reverb control to include additional
- * parameters, or else interpret the system's additional capabilities in a way that fits
- * the model described here.
+ * The set of parameters defined here may not include all aspects of
+ * reverberation as specified by some systems. For example, the Midi
+ * Manufacturer's Association (MMA) has an Interactive Audio Special Interest
+ * Group (IASIG), which has a 3-D Working Group that has defined a Level 2 Spec
+ * (I3DL2). I3DL2 supports filtering of reverberation and control of reverb
+ * density. These properties are not included in the JavaSound 1.0 definition of
+ * a reverb control. In such a case, the implementing system should either
+ * extend the defined reverb control to include additional parameters, or else
+ * interpret the system's additional capabilities in a way that fits the model
+ * described here.
* <p>
* If implementing JavaSound on a I3DL2-compliant device:
* <ul>
@@ -72,8 +67,8 @@
* <li>Density parameters are set to midway between minimum and maximum
* </ul>
* <p>
- * The following table shows what parameter values an implementation might use for a
- * representative set of reverberation settings.
+ * The following table shows what parameter values an implementation might use
+ * for a representative set of reverberation settings.
* <p>
*
* <b>Reverberation Types and Parameters</b>
@@ -142,7 +137,7 @@
public class ReverbType {
/**
- * Descriptive name of the reverb type..
+ * Descriptive name of the reverb type.
*/
private String name;
@@ -167,20 +162,25 @@
private float lateReflectionIntensity;
/**
- * Total decay time
+ * Total decay time.
*/
private int decayTime;
-
/**
* Constructs a new reverb type that has the specified reverberation
* parameter values.
- * @param name the name of the new reverb type, or a zero-length <code>String</code>
- * @param earlyReflectionDelay the new type's early reflection delay time in microseconds
- * @param earlyReflectionIntensity the new type's early reflection intensity in dB
- * @param lateReflectionDelay the new type's late reflection delay time in microseconds
- * @param lateReflectionIntensity the new type's late reflection intensity in dB
- * @param decayTime the new type's decay time in microseconds
+ *
+ * @param name the name of the new reverb type, or a zero-length
+ * {@code String}
+ * @param earlyReflectionDelay the new type's early reflection delay time
+ * in microseconds
+ * @param earlyReflectionIntensity the new type's early reflection
+ * intensity in dB
+ * @param lateReflectionDelay the new type's late reflection delay time in
+ * microseconds
+ * @param lateReflectionIntensity the new type's late reflection intensity
+ * in dB
+ * @param decayTime the new type's decay time in microseconds
*/
protected ReverbType(String name, int earlyReflectionDelay, float earlyReflectionIntensity, int lateReflectionDelay, float lateReflectionIntensity, int decayTime) {
@@ -192,9 +192,9 @@
this.decayTime = decayTime;
}
-
/**
* Obtains the name of this reverb type.
+ *
* @return the name of this reverb type
* @since 1.5
*/
@@ -202,89 +202,88 @@
return name;
}
-
/**
- * Returns the early reflection delay time in microseconds.
- * This is the amount of time between when the direct signal is
- * heard and when the first early reflections are heard.
- * @return early reflection delay time for this reverb type, in microseconds
+ * Returns the early reflection delay time in microseconds. This is the
+ * amount of time between when the direct signal is heard and when the first
+ * early reflections are heard.
+ *
+ * @return early reflection delay time for this reverb type, in microseconds
*/
public final int getEarlyReflectionDelay() {
return earlyReflectionDelay;
}
-
/**
- * Returns the early reflection intensity in decibels.
- * This is the amplitude attenuation of the first early reflections
- * relative to the direct signal.
- * @return early reflection intensity for this reverb type, in dB
+ * Returns the early reflection intensity in decibels. This is the amplitude
+ * attenuation of the first early reflections relative to the direct signal.
+ *
+ * @return early reflection intensity for this reverb type, in dB
*/
public final float getEarlyReflectionIntensity() {
return earlyReflectionIntensity;
}
-
/**
- * Returns the late reflection delay time in microseconds.
- * This is the amount of time between when the first early reflections
- * are heard and when the first late reflections are heard.
- * @return late reflection delay time for this reverb type, in microseconds
+ * Returns the late reflection delay time in microseconds. This is the
+ * amount of time between when the first early reflections are heard and
+ * when the first late reflections are heard.
+ *
+ * @return late reflection delay time for this reverb type, in microseconds
*/
public final int getLateReflectionDelay() {
return lateReflectionDelay;
}
-
/**
- * Returns the late reflection intensity in decibels.
- * This is the amplitude attenuation of the first late reflections
- * relative to the direct signal.
- * @return late reflection intensity for this reverb type, in dB
+ * Returns the late reflection intensity in decibels. This is the amplitude
+ * attenuation of the first late reflections relative to the direct signal.
+ *
+ * @return late reflection intensity for this reverb type, in dB
*/
public final float getLateReflectionIntensity() {
return lateReflectionIntensity;
}
-
/**
- * Obtains the decay time, which is the amount of time over which the
- * late reflections attenuate to effective zero. The effective zero
- * value is implementation-dependent.
- * @return the decay time of the late reflections, in microseconds
+ * Obtains the decay time, which is the amount of time over which the late
+ * reflections attenuate to effective zero. The effective zero value is
+ * implementation-dependent.
+ *
+ * @return the decay time of the late reflections, in microseconds
*/
public final int getDecayTime() {
return decayTime;
}
-
/**
* Indicates whether the specified object is equal to this reverb type,
- * returning <code>true</code> if the objects are identical.
- * @param obj the reference object with which to compare
- * @return <code>true</code> if this reverb type is the same as
- * <code>obj</code>; <code>false</code> otherwise
+ * returning {@code true} if the objects are identical.
+ *
+ * @param obj the reference object with which to compare
+ * @return {@code true} if this reverb type is the same as {@code obj};
+ * {@code false} otherwise
*/
+ @Override
public final boolean equals(Object obj) {
return super.equals(obj);
}
-
/**
* Finalizes the hashcode method.
*/
+ @Override
public final int hashCode() {
return super.hashCode();
}
-
/**
- * Provides a <code>String</code> representation of the reverb type,
- * including its name and its parameter settings.
- * The exact contents of the string may vary between implementations of
- * Java Sound.
+ * Provides a {@code String} representation of the reverb type, including
+ * its name and its parameter settings. The exact contents of the string may
+ * vary between implementations of Java Sound.
+ *
* @return reverberation type name and description
*/
+ @Override
public final String toString() {
//$$fb2001-07-20: fix for bug 4385060: The "name" attribute of class "ReverbType" is not accessible.
@@ -295,5 +294,4 @@
" ns, late reflection intensity " + lateReflectionIntensity +
" dB, decay time " + decayTime);
}
-
-} // class ReverbType
+}
--- a/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/SourceDataLine.java Wed Jun 04 17:14:56 2014 +0400
@@ -25,36 +25,35 @@
package javax.sound.sampled;
-
/**
- * A source data line is a data line to which data may be written. It acts as
- * a source to its mixer. An application writes audio bytes to a source data line,
- * which handles the buffering of the bytes and delivers them to the mixer.
- * The mixer may mix the samples with those from other sources and then deliver
- * the mix to a target such as an output port (which may represent an audio output
+ * A source data line is a data line to which data may be written. It acts as a
+ * source to its mixer. An application writes audio bytes to a source data line,
+ * which handles the buffering of the bytes and delivers them to the mixer. The
+ * mixer may mix the samples with those from other sources and then deliver the
+ * mix to a target such as an output port (which may represent an audio output
* device on a sound card).
* <p>
* Note that the naming convention for this interface reflects the relationship
- * between the line and its mixer. From the perspective of an application,
- * a source data line may act as a target for audio data.
+ * between the line and its mixer. From the perspective of an application, a
+ * source data line may act as a target for audio data.
* <p>
* A source data line can be obtained from a mixer by invoking the
- * <code>{@link Mixer#getLine getLine}</code> method of <code>Mixer</code> with
- * an appropriate <code>{@link DataLine.Info}</code> object.
+ * {@link Mixer#getLine getLine} method of {@code Mixer} with an appropriate
+ * {@link DataLine.Info} object.
* <p>
- * The <code>SourceDataLine</code> interface provides a method for writing
- * audio data to the data line's buffer. Applications that play or mix
- * audio should write data to the source data line quickly enough to keep the
- * buffer from underflowing (emptying), which could cause discontinuities in
- * the audio that are perceived as clicks. Applications can use the
- * <code>{@link DataLine#available available}</code> method defined in the
- * <code>DataLine</code> interface to determine the amount of data currently
- * queued in the data line's buffer. The amount of data which can be written
- * to the buffer without blocking is the difference between the buffer size
- * and the amount of queued data. If the delivery of audio output
- * stops due to underflow, a <code>{@link LineEvent.Type#STOP STOP}</code> event is
- * generated. A <code>{@link LineEvent.Type#START START}</code> event is generated
- * when the audio output resumes.
+ * The {@code SourceDataLine} interface provides a method for writing audio data
+ * to the data line's buffer. Applications that play or mix audio should write
+ * data to the source data line quickly enough to keep the buffer from
+ * underflowing (emptying), which could cause discontinuities in the audio that
+ * are perceived as clicks. Applications can use the
+ * {@link DataLine#available available} method defined in the {@code DataLine}
+ * interface to determine the amount of data currently queued in the data line's
+ * buffer. The amount of data which can be written to the buffer without
+ * blocking is the difference between the buffer size and the amount of queued
+ * data. If the delivery of audio output stops due to underflow, a
+ * {@link LineEvent.Type#STOP STOP} event is generated. A
+ * {@link LineEvent.Type#START START} event is generated when the audio output
+ * resumes.
*
* @author Kara Kytle
* @see Mixer
@@ -64,138 +63,130 @@
*/
public interface SourceDataLine extends DataLine {
-
/**
* Opens the line with the specified format and suggested buffer size,
- * causing the line to acquire any required
- * system resources and become operational.
+ * causing the line to acquire any required system resources and become
+ * operational.
* <p>
* The buffer size is specified in bytes, but must represent an integral
- * number of sample frames. Invoking this method with a requested buffer
+ * 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 <code>{@link DataLine#getBufferSize}</code>.
+ * {@code 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}.
* <p>
* If this operation succeeds, the line is marked as open, and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
- * line's listeners.
+ * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Invoking this method on a line which is already open is illegal
- * and may result in an <code>IllegalStateException</code>.
+ * Invoking this method on a line which is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Note that some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>LineUnavailableException</code>.
+ * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+ * such a line will always result in a {@code LineUnavailableException}.
*
- * @param format the desired audio format
- * @param bufferSize the desired buffer size
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IllegalArgumentException if the buffer size does not represent
- * an integral number of sample frames,
- * or if <code>format</code> is not fully specified or invalid
+ * @param format the desired audio format
+ * @param bufferSize the desired buffer size
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IllegalArgumentException if the buffer size does not represent an
+ * integral number of sample frames, or if {@code format} is not
+ * fully specified or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #open(AudioFormat)
* @see Line#open
* @see Line#close
* @see Line#isOpen
* @see LineEvent
*/
- public void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
-
+ void open(AudioFormat format, int bufferSize)
+ throws LineUnavailableException;
/**
* Opens the line with the specified format, causing the line to acquire any
* required system resources and become operational.
- *
* <p>
* The implementation chooses a buffer size, which is measured in bytes but
- * which encompasses an integral number of sample frames. The buffer size
+ * which encompasses an integral number of sample frames. The buffer size
* that the system has chosen may be queried by subsequently calling
- * <code>{@link DataLine#getBufferSize}</code>.
+ * {@link DataLine#getBufferSize}.
* <p>
* If this operation succeeds, the line is marked as open, and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
- * line's listeners.
+ * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Invoking this method on a line which is already open is illegal
- * and may result in an <code>IllegalStateException</code>.
+ * Invoking this method on a line which is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Note that some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>LineUnavailableException</code>.
+ * Note that some lines, once closed, cannot be reopened. Attempts to reopen
+ * such a line will always result in a {@code LineUnavailableException}.
*
- * @param format the desired audio format
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IllegalArgumentException if <code>format</code>
- * is not fully specified or invalid
+ * @param format the desired audio format
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IllegalArgumentException if {@code format} is not fully specified
+ * or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #open(AudioFormat, int)
* @see Line#open
* @see Line#close
* @see Line#isOpen
* @see LineEvent
*/
- public void open(AudioFormat format) throws LineUnavailableException;
-
+ void open(AudioFormat format) throws LineUnavailableException;
/**
- * Writes audio data to the mixer via this source data line. The requested
- * number of bytes of data are read from the specified array,
- * starting at the given offset into the array, and written to the data
- * line's buffer. If the caller attempts to write more data than can
- * currently be written (see <code>{@link DataLine#available available}</code>),
- * this method blocks until the requested amount of data has been written.
- * This applies even if the requested amount of data to write is greater
- * than the data line's buffer size. However, if the data line is closed,
- * stopped, or flushed before the requested amount has been written,
- * the method no longer blocks, but returns the number of bytes
- * written thus far.
+ * Writes audio data to the mixer via this source data line. The requested
+ * number of bytes of data are read from the specified array, starting at
+ * the given offset into the array, and written to the data line's buffer.
+ * If the caller attempts to write more data than can currently be written
+ * (see {@link DataLine#available available}), this method blocks until the
+ * requested amount of data has been written. This applies even if the
+ * requested amount of data to write is greater than the data line's buffer
+ * size. However, if the data line is closed, stopped, or flushed before the
+ * requested amount has been written, the method no longer blocks, but
+ * returns the number of bytes written thus far.
* <p>
- * The number of bytes that can be written without blocking can be ascertained
- * using the <code>{@link DataLine#available available}</code> method of the
- * <code>DataLine</code> interface. (While it is guaranteed that
- * this number of bytes can be written without blocking, there is no guarantee
- * that attempts to write additional data will block.)
+ * The number of bytes that can be written without blocking can be
+ * ascertained using the {@link DataLine#available available} method of the
+ * {@code DataLine} interface. (While it is guaranteed that this number of
+ * bytes can be written without blocking, there is no guarantee that
+ * attempts to write additional data will block.)
* <p>
- * The number of bytes to write must represent an integral number of
- * sample frames, such that:
+ * The number of bytes to write must represent an integral number of sample
+ * frames, such that:
* <br>
- * <center><code>[ bytes written ] % [frame size in bytes ] == 0</code></center>
+ * <center>{@code [ bytes written ] % [frame size in bytes ] == 0}</center>
* <br>
- * The return value will always meet this requirement. A request to write a
- * number of bytes representing a non-integral number of sample frames cannot
- * be fulfilled and may result in an <code>IllegalArgumentException</code>.
+ * The return value will always meet this requirement. A request to write a
+ * number of bytes representing a non-integral number of sample frames
+ * cannot be fulfilled and may result in an
+ * {@code IllegalArgumentException}.
*
- * @param b a byte array containing data to be written to the data line
- * @param len the length, in bytes, of the valid data in the array
- * (in other words, the requested amount of data to write, in bytes)
- * @param off the offset from the beginning of the array, in bytes
+ * @param b a byte array containing data to be written to the data line
+ * @param len the length, in bytes, of the valid data in the array (in
+ * other words, the requested amount of data to write, in bytes)
+ * @param off the offset from the beginning of the array, in bytes
* @return the number of bytes actually written
* @throws IllegalArgumentException if the requested number of bytes does
- * not represent an integral number of sample frames,
- * or if <code>len</code> is negative
- * @throws ArrayIndexOutOfBoundsException if <code>off</code> is negative,
- * or <code>off+len</code> is greater than the length of the array
- * <code>b</code>.
- *
+ * not represent an integral number of sample frames, or if
+ * {@code len} is negative
+ * @throws ArrayIndexOutOfBoundsException if {@code off} is negative, or
+ * {@code off+len} is greater than the length of the array {@code b}
* @see TargetDataLine#read
* @see DataLine#available
*/
- public int write(byte[] b, int off, int len);
+ int write(byte[] b, int off, int len);
/**
* Obtains the number of sample frames of audio data that can be written to
- * the mixer, via this data line, without blocking. Note that the return
+ * the mixer, via this data line, without blocking. Note that the return
* value measures sample frames, not bytes.
+ *
* @return the number of sample frames currently available for writing
* @see TargetDataLine#availableRead
*/
--- a/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/TargetDataLine.java Wed Jun 04 17:14:56 2014 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,29 +26,28 @@
package javax.sound.sampled;
/**
- * A target data line is a type of <code>{@link DataLine}</code> from which
- * audio data can be read. The most common example is a data line that gets
- * its data from an audio capture device. (The device is implemented as a
- * mixer that writes to the target data line.)
+ * A target data line is a type of {@link DataLine} from which audio data can be
+ * read. The most common example is a data line that gets its data from an audio
+ * capture device. (The device is implemented as a mixer that writes to the
+ * target data line.)
* <p>
* Note that the naming convention for this interface reflects the relationship
- * between the line and its mixer. From the perspective of an application,
- * a target data line may act as a source for audio data.
+ * between the line and its mixer. From the perspective of an application, a
+ * target data line may act as a source for audio data.
* <p>
* The target data line can be obtained from a mixer by invoking the
- * <code>{@link Mixer#getLine getLine}</code>
- * method of <code>Mixer</code> with an appropriate
- * <code>{@link DataLine.Info}</code> object.
+ * {@link Mixer#getLine getLine} method of {@code Mixer} with an appropriate
+ * {@link DataLine.Info} object.
* <p>
- * The <code>TargetDataLine</code> interface provides a method for reading the
- * captured data from the target data line's buffer.Applications
- * that record audio should read data from the target data line quickly enough
- * to keep the buffer from overflowing, which could cause discontinuities in
- * the captured data that are perceived as clicks. Applications can use the
- * <code>{@link DataLine#available available}</code> method defined in the
- * <code>DataLine</code> interface to determine the amount of data currently
- * queued in the data line's buffer. If the buffer does overflow,
- * the oldest queued data is discarded and replaced by new data.
+ * The {@code TargetDataLine} interface provides a method for reading the
+ * captured data from the target data line's buffer. Applications that record
+ * audio should read data from the target data line quickly enough to keep the
+ * buffer from overflowing, which could cause discontinuities in the captured
+ * data that are perceived as clicks. Applications can use the
+ * {@link DataLine#available available} method defined in the {@code DataLine}
+ * interface to determine the amount of data currently queued in the data line's
+ * buffer. If the buffer does overflow, the oldest queued data is discarded and
+ * replaced by new data.
*
* @author Kara Kytle
* @see Mixer
@@ -58,133 +57,126 @@
*/
public interface TargetDataLine extends DataLine {
-
/**
* Opens the line with the specified format and requested buffer size,
* causing the line to acquire any required system resources and become
* operational.
* <p>
* The buffer size is specified in bytes, but must represent an integral
- * number of sample frames. Invoking this method with a requested buffer
+ * 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 <code>{@link DataLine#getBufferSize}</code>
+ * {@code 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}
* <p>
* If this operation succeeds, the line is marked as open, and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
- * line's listeners.
+ * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Invoking this method on a line that is already open is illegal
- * and may result in an <code>IllegalStateException</code>.
+ * Invoking this method on a line that is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>LineUnavailableException</code>.
+ * Some lines, once closed, cannot be reopened. Attempts to reopen such a
+ * line will always result in a {@code LineUnavailableException}.
*
- * @param format the desired audio format
- * @param bufferSize the desired buffer size, in bytes.
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IllegalArgumentException if the buffer size does not represent
- * an integral number of sample frames,
- * or if <code>format</code> is not fully specified or invalid
+ * @param format the desired audio format
+ * @param bufferSize the desired buffer size, in bytes
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IllegalArgumentException if the buffer size does not represent an
+ * integral number of sample frames, or if {@code format} is not
+ * fully specified or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #open(AudioFormat)
* @see Line#open
* @see Line#close
* @see Line#isOpen
* @see LineEvent
*/
- public void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
-
+ void open(AudioFormat format, int bufferSize) throws LineUnavailableException;
/**
* Opens the line with the specified format, causing the line to acquire any
* required system resources and become operational.
- *
* <p>
* The implementation chooses a buffer size, which is measured in bytes but
- * which encompasses an integral number of sample frames. The buffer size
- * that the system has chosen may be queried by subsequently calling <code>{@link DataLine#getBufferSize}</code>
+ * which encompasses an integral number of sample frames. The buffer size
+ * that the system has chosen may be queried by subsequently calling
+ * {@link DataLine#getBufferSize}
* <p>
* If this operation succeeds, the line is marked as open, and an
- * <code>{@link LineEvent.Type#OPEN OPEN}</code> event is dispatched to the
- * line's listeners.
+ * {@link LineEvent.Type#OPEN OPEN} event is dispatched to the line's
+ * listeners.
* <p>
- * Invoking this method on a line that is already open is illegal
- * and may result in an <code>IllegalStateException</code>.
+ * Invoking this method on a line that is already open is illegal and may
+ * result in an {@code IllegalStateException}.
* <p>
- * Some lines, once closed, cannot be reopened. Attempts
- * to reopen such a line will always result in a
- * <code>LineUnavailableException</code>.
+ * Some lines, once closed, cannot be reopened. Attempts to reopen such a
+ * line will always result in a {@code LineUnavailableException}.
*
- * @param format the desired audio format
- * @throws LineUnavailableException if the line cannot be
- * opened due to resource restrictions
- * @throws IllegalArgumentException if <code>format</code>
- * is not fully specified or invalid
+ * @param format the desired audio format
+ * @throws LineUnavailableException if the line cannot be opened due to
+ * resource restrictions
+ * @throws IllegalArgumentException if {@code format} is not fully specified
+ * or invalid
* @throws IllegalStateException if the line is already open
- * @throws SecurityException if the line cannot be
- * opened due to security restrictions
- *
+ * @throws SecurityException if the line cannot be opened due to security
+ * restrictions
* @see #open(AudioFormat, int)
* @see Line#open
* @see Line#close
* @see Line#isOpen
* @see LineEvent
*/
- public void open(AudioFormat format) throws LineUnavailableException;
-
+ void open(AudioFormat format) throws LineUnavailableException;
/**
- * Reads audio data from the data line's input buffer. The requested
- * number of bytes is read into the specified array, starting at
- * the specified offset into the array in bytes. This method blocks until
- * the requested amount of data has been read. However, if the data line
- * is closed, stopped, drained, or flushed before the requested amount has
- * been read, the method no longer blocks, but returns the number of bytes
- * read thus far.
+ * Reads audio data from the data line's input buffer. The requested number
+ * of bytes is read into the specified array, starting at the specified
+ * offset into the array in bytes. This method blocks until the requested
+ * amount of data has been read. However, if the data line is closed,
+ * stopped, drained, or flushed before the requested amount has been read,
+ * the method no longer blocks, but returns the number of bytes read thus
+ * far.
* <p>
* The number of bytes that can be read without blocking can be ascertained
- * using the <code>{@link DataLine#available available}</code> method of the
- * <code>DataLine</code> interface. (While it is guaranteed that
- * this number of bytes can be read without blocking, there is no guarantee
- * that attempts to read additional data will block.)
+ * using the {@link DataLine#available available} method of the
+ * {@code DataLine} interface. (While it is guaranteed that this number of
+ * bytes can be read without blocking, there is no guarantee that attempts
+ * to read additional data will block.)
* <p>
* The number of bytes to be read must represent an integral number of
* sample frames, such that:
* <br>
- * <center><code>[ bytes read ] % [frame size in bytes ] == 0</code></center>
+ * <center>{@code [ bytes read ] % [frame size in bytes ] == 0}</center>
* <br>
- * The return value will always meet this requirement. A request to read a
- * number of bytes representing a non-integral number of sample frames cannot
- * be fulfilled and may result in an IllegalArgumentException.
+ * The return value will always meet this requirement. A request to read a
+ * number of bytes representing a non-integral number of sample frames
+ * cannot be fulfilled and may result in an IllegalArgumentException.
*
- * @param b a byte array that will contain the requested input data when
- * this method returns
- * @param off the offset from the beginning of the array, in bytes
- * @param len the requested number of bytes to read
+ * @param b a byte array that will contain the requested input data when
+ * this method returns
+ * @param off the offset from the beginning of the array, in bytes
+ * @param len the requested number of bytes to read
* @return the number of bytes actually read
* @throws IllegalArgumentException if the requested number of bytes does
- * not represent an integral number of sample frames.
- * or if <code>len</code> is negative.
- * @throws ArrayIndexOutOfBoundsException if <code>off</code> is negative,
- * or <code>off+len</code> is greater than the length of the array
- * <code>b</code>.
+ * not represent an integral number of sample frames, or if
+ * {@code len} is negative
+ * @throws ArrayIndexOutOfBoundsException if {@code off} is negative, or
+ * {@code off+len} is greater than the length of the array {@code b}
*
* @see SourceDataLine#write
* @see DataLine#available
*/
- public int read(byte[] b, int off, int len);
+ int read(byte[] b, int off, int len);
/**
* Obtains the number of sample frames of audio data that can be read from
- * the target data line without blocking. Note that the return value
+ * the target data line without blocking. Note that the return value
* measures sample frames, not bytes.
+ *
* @return the number of sample frames currently available for reading
* @see SourceDataLine#availableWrite
*/
--- a/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java Wed Jun 04 17:14:56 2014 +0400
@@ -26,33 +26,32 @@
package javax.sound.sampled;
/**
- * An <code>UnsupportedAudioFileException</code> is an exception indicating that an
- * operation failed because a file did not contain valid data of a recognized file
- * type and format.
+ * An {@code UnsupportedAudioFileException} is an exception indicating that an
+ * operation failed because a file did not contain valid data of a recognized
+ * file type and format.
*
* @author Kara Kytle
* @since 1.3
*/
public class UnsupportedAudioFileException extends Exception {
+
private static final long serialVersionUID = -139127412623160368L;
/**
- * Constructs a <code>UnsupportedAudioFileException</code> that has
- * <code>null</code> as its error detail message.
+ * Constructs a {@code UnsupportedAudioFileException} that has {@code null}
+ * as its error detail message.
*/
public UnsupportedAudioFileException() {
-
super();
}
/**
- * Constructs a <code>UnsupportedAudioFileException</code> that has
- * the specified detail message.
+ * Constructs a {@code UnsupportedAudioFileException} that has the specified
+ * detail message.
*
- * @param message a string containing the error detail message
+ * @param message a string containing the error detail message
*/
- public UnsupportedAudioFileException(String message) {
-
+ public UnsupportedAudioFileException(final String message) {
super(message);
}
}
--- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java Wed Jun 04 17:14:56 2014 +0400
@@ -108,7 +108,7 @@
* @param stream the input stream from which the {@code AudioInputStream}
* should be constructed
* @return an {@code AudioInputStream} object based on the audio file data
- * contained in the input stream.
+ * contained in the input stream
* @throws UnsupportedAudioFileException if the stream does not point to
* valid audio file data recognized by the system
* @throws IOException if an I/O exception occurs
--- a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java Wed Jun 04 16:55:06 2014 +0400
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java Wed Jun 04 17:14:56 2014 +0400
@@ -117,7 +117,7 @@
* are supported for this source format, an array of length 0 is returned.
*
* @param sourceFormat format of the incoming data
- * @return array of supported target format encodings.
+ * @return array of supported target format encodings
*/
public abstract Encoding[] getTargetEncodings(AudioFormat sourceFormat);
@@ -150,7 +150,7 @@
*
* @param targetEncoding desired encoding of the stream after processing
* @param sourceFormat format of the incoming data
- * @return array of supported target formats.
+ * @return array of supported target formats
*/
public abstract AudioFormat[] getTargetFormats(Encoding targetEncoding,
AudioFormat sourceFormat);
@@ -187,7 +187,7 @@
* @return stream from which processed data with the specified target
* encoding may be read
* @throws IllegalArgumentException if the format combination supplied is
- * not supported.
+ * not supported
*/
public abstract AudioInputStream getAudioInputStream(
Encoding targetEncoding, AudioInputStream sourceStream);
@@ -202,7 +202,7 @@
* @return stream from which processed data with the specified format may be
* read
* @throws IllegalArgumentException if the format combination supplied is
- * not supported.
+ * not supported
*/
public abstract AudioInputStream getAudioInputStream(
AudioFormat targetFormat, AudioInputStream sourceStream);