8042007: Javadoc cleanup of javax.sound.sampled.spi package
Reviewed-by: pchelko, bagiras
This commit is contained in:
parent
349b9794b1
commit
db84d6b169
@ -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
|
||||
@ -35,7 +35,7 @@ import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
|
||||
/**
|
||||
* Provider for audio file reading services. Classes providing concrete
|
||||
* Provider for audio file reading services. Classes providing concrete
|
||||
* implementations can parse the format information from one or more types of
|
||||
* audio file, and can produce audio input streams from files of these types.
|
||||
*
|
||||
@ -45,93 +45,106 @@ import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
public abstract class AudioFileReader {
|
||||
|
||||
/**
|
||||
* Obtains the audio file format of the input stream provided. The stream must
|
||||
* point to valid audio file data. In general, audio file readers may
|
||||
* Obtains the audio file format of the input stream provided. The stream
|
||||
* must point to valid audio file data. In general, audio file readers may
|
||||
* need to read some data from the stream before determining 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 this, 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 audio file format
|
||||
* @throws UnsupportedAudioFileException if the stream does not point to valid audio
|
||||
* file data recognized by the system
|
||||
* 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 this, 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 audio file
|
||||
* format
|
||||
* @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
|
||||
*/
|
||||
public abstract AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioFileFormat getAudioFileFormat(InputStream stream)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
||||
/**
|
||||
* Obtains the audio file format of the URL provided. 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 URL provided. 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 I/O exception occurs
|
||||
*/
|
||||
public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioFileFormat getAudioFileFormat(URL url)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
||||
/**
|
||||
* Obtains the audio file format of the <code>File</code> provided. 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 {@code File} provided.
|
||||
* 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 abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioFileFormat getAudioFileFormat(File file)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
||||
/**
|
||||
* Obtains an audio input stream from the input stream provided. The stream must
|
||||
* point to valid audio file data. In general, audio file readers may
|
||||
* Obtains an audio input stream from the input stream provided. The stream
|
||||
* must point to valid audio file data. In general, audio file readers may
|
||||
* need to read some data from the stream before determining 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 this, 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
|
||||
* 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 this, 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
|
||||
*/
|
||||
public abstract AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioInputStream getAudioInputStream(InputStream stream)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
||||
/**
|
||||
* 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 abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioInputStream getAudioInputStream(URL url)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
|
||||
/**
|
||||
* Obtains an audio input stream from the <code>File</code> provided. 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 File
|
||||
* @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 {@code File} provided.
|
||||
* 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 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 abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException;
|
||||
public abstract AudioInputStream getAudioInputStream(File file)
|
||||
throws UnsupportedAudioFileException, IOException;
|
||||
}
|
||||
|
@ -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,16 +26,15 @@
|
||||
package javax.sound.sampled.spi;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
|
||||
import static javax.sound.sampled.AudioFileFormat.Type;
|
||||
|
||||
/**
|
||||
* Provider for audio file writing services. Classes providing concrete
|
||||
* Provider for audio file writing services. Classes providing concrete
|
||||
* implementations can write one or more types of audio file from an audio
|
||||
* stream.
|
||||
*
|
||||
@ -47,22 +46,23 @@ public abstract class AudioFileWriter {
|
||||
/**
|
||||
* Obtains the file types for which file writing support is provided by this
|
||||
* audio file writer.
|
||||
* @return array of file types. If no file types are supported,
|
||||
* an array of length 0 is returned.
|
||||
*
|
||||
* @return array of file types. If no file types are supported, an array of
|
||||
* length 0 is returned.
|
||||
*/
|
||||
public abstract AudioFileFormat.Type[] getAudioFileTypes();
|
||||
|
||||
public abstract Type[] getAudioFileTypes();
|
||||
|
||||
/**
|
||||
* Indicates whether file writing support for the specified file type is provided
|
||||
* by this audio file writer.
|
||||
* @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 this audio file writer.
|
||||
*
|
||||
* @param fileType the file type for which write capabilities are queried
|
||||
* @return {@code true} if the file type is supported, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
|
||||
public boolean isFileTypeSupported(Type fileType) {
|
||||
|
||||
AudioFileFormat.Type types[] = getAudioFileTypes();
|
||||
Type types[] = getAudioFileTypes();
|
||||
|
||||
for(int i=0; i<types.length; i++) {
|
||||
if( fileType.equals( types[i] ) ) {
|
||||
@ -72,29 +72,29 @@ public abstract class AudioFileWriter {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the file types that this audio file writer 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.
|
||||
*
|
||||
* @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 abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
|
||||
|
||||
public abstract Type[] getAudioFileTypes(AudioInputStream stream);
|
||||
|
||||
/**
|
||||
* Indicates whether an audio file of the type specified can be written
|
||||
* from the audio input stream indicated.
|
||||
* @param fileType file type for which write capabilities are queried
|
||||
* @param 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>
|
||||
* Indicates whether an audio file of the type specified can be written from
|
||||
* the audio input stream indicated.
|
||||
*
|
||||
* @param fileType file type for which write capabilities are queried
|
||||
* @param 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 boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) {
|
||||
public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
|
||||
|
||||
AudioFileFormat.Type types[] = getAudioFileTypes( stream );
|
||||
Type types[] = getAudioFileTypes( stream );
|
||||
|
||||
for(int i=0; i<types.length; i++) {
|
||||
if( fileType.equals( types[i] ) ) {
|
||||
@ -104,44 +104,44 @@ public abstract class AudioFileWriter {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes a stream of bytes representing an audio file of the file type
|
||||
* indicated to the output stream provided. Some file types require that
|
||||
* indicated to the output stream provided. Some file types require that
|
||||
* the length be written into the file header, and cannot be written from
|
||||
* start to finish unless the length is known in advance. An attempt
|
||||
* to write such a file type will fail with an IOException if the length in
|
||||
* the audio file format is
|
||||
* {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED AudioSystem.NOT_SPECIFIED}.
|
||||
* @param stream the audio input stream containing audio data to be
|
||||
* written to the output stream
|
||||
* @param fileType file type to be written to the output stream
|
||||
* @param out stream to which the file data should be written
|
||||
* start to finish unless the length is known in advance. An attempt to
|
||||
* write such a file type will fail with an IOException if the length in the
|
||||
* audio file format is {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED
|
||||
* AudioSystem.NOT_SPECIFIED}.
|
||||
*
|
||||
* @param stream the audio input stream containing audio data to be written
|
||||
* to the output stream
|
||||
* @param fileType file type to be written to the output stream
|
||||
* @param out stream to which the file data should be written
|
||||
* @return the number of bytes written to the output stream
|
||||
* @throws IOException if an I/O exception occurs
|
||||
* @throws IllegalArgumentException if the file type is not supported by
|
||||
* the system
|
||||
* @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
|
||||
* @throws IllegalArgumentException if the file type is not supported by the
|
||||
* system
|
||||
* @see #isFileTypeSupported(Type, AudioInputStream)
|
||||
* @see #getAudioFileTypes
|
||||
*/
|
||||
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException;
|
||||
|
||||
public abstract int write(AudioInputStream stream, Type fileType,
|
||||
OutputStream out) throws IOException;
|
||||
|
||||
/**
|
||||
* Writes a stream of bytes representing an audio file of the file format
|
||||
* indicated to the external file provided.
|
||||
* @param stream the audio input stream containing audio data to be
|
||||
* written to the file
|
||||
* @param fileType file type to be written to the file
|
||||
* @param out external file 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 file type to be written to the file
|
||||
* @param out 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 format is not supported by
|
||||
* the system
|
||||
* the system
|
||||
* @see #isFileTypeSupported
|
||||
* @see #getAudioFileTypes
|
||||
*/
|
||||
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException;
|
||||
|
||||
|
||||
public abstract int write(AudioInputStream stream, Type fileType, File out)
|
||||
throws IOException;
|
||||
}
|
||||
|
@ -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,63 +25,62 @@
|
||||
|
||||
package javax.sound.sampled.spi;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
|
||||
import static javax.sound.sampled.AudioFormat.Encoding;
|
||||
|
||||
/**
|
||||
* A format conversion provider provides format conversion services
|
||||
* from one or more input formats to one or more output formats.
|
||||
* Converters include codecs, which encode and/or decode audio data,
|
||||
* as well as transcoders, etc. Format converters provide methods for
|
||||
* determining what conversions are supported and for obtaining an audio
|
||||
* stream from which converted data can be read.
|
||||
* A format conversion provider provides format conversion services from one or
|
||||
* more input formats to one or more output formats. Converters include codecs,
|
||||
* which encode and/or decode audio data, as well as transcoders, etc. Format
|
||||
* converters provide methods for determining what conversions are supported and
|
||||
* for obtaining an audio stream from which converted data can be read.
|
||||
* <p>
|
||||
* The source format represents the format of the incoming
|
||||
* audio data, which will be converted.
|
||||
* The source format represents the format of the incoming audio data, which
|
||||
* will be converted.
|
||||
* <p>
|
||||
* The target format represents the format of the processed, converted
|
||||
* audio data. This is the format of the data that can be read from
|
||||
* the stream returned by one of the <code>getAudioInputStream</code> methods.
|
||||
* The target format represents the format of the processed, converted audio
|
||||
* data. This is the format of the data that can be read from the stream
|
||||
* returned by one of the {@code getAudioInputStream} methods.
|
||||
*
|
||||
* @author Kara Kytle
|
||||
* @since 1.3
|
||||
*/
|
||||
public abstract class FormatConversionProvider {
|
||||
|
||||
|
||||
// NEW METHODS
|
||||
|
||||
/**
|
||||
* Obtains the set of source format encodings from which format
|
||||
* conversion services are provided by this provider.
|
||||
* Obtains the set of source format encodings from which format conversion
|
||||
* services are provided by this provider.
|
||||
*
|
||||
* @return array of source format encodings. If for some reason provider
|
||||
* does not provide any conversion services, an array of length 0 is
|
||||
* returned.
|
||||
* does not provide any conversion services, an array of length 0 is
|
||||
* returned.
|
||||
*/
|
||||
public abstract AudioFormat.Encoding[] getSourceEncodings();
|
||||
|
||||
public abstract Encoding[] getSourceEncodings();
|
||||
|
||||
/**
|
||||
* Obtains the set of target format encodings to which format
|
||||
* conversion services are provided by this provider.
|
||||
* Obtains the set of target format encodings to which format conversion
|
||||
* services are provided by this provider.
|
||||
*
|
||||
* @return array of target format encodings. If for some reason provider
|
||||
* does not provide any conversion services, an array of length 0 is
|
||||
* returned.
|
||||
* does not provide any conversion services, an array of length 0 is
|
||||
* returned.
|
||||
*/
|
||||
public abstract AudioFormat.Encoding[] getTargetEncodings();
|
||||
|
||||
public abstract Encoding[] getTargetEncodings();
|
||||
|
||||
/**
|
||||
* Indicates whether the format converter supports conversion from the
|
||||
* specified source format encoding.
|
||||
* @param sourceEncoding the source format encoding for which support is queried
|
||||
* @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
|
||||
*
|
||||
* @param sourceEncoding the source format encoding for which support is
|
||||
* queried
|
||||
* @return {@code true} if the encoding is supported, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){
|
||||
public boolean isSourceEncodingSupported(Encoding sourceEncoding) {
|
||||
|
||||
AudioFormat.Encoding sourceEncodings[] = getSourceEncodings();
|
||||
Encoding sourceEncodings[] = getSourceEncodings();
|
||||
|
||||
for(int i=0; i<sourceEncodings.length; i++) {
|
||||
if( sourceEncoding.equals( sourceEncodings[i]) ) {
|
||||
@ -91,16 +90,18 @@ public abstract class FormatConversionProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicates whether the format converter supports conversion to the
|
||||
* specified target format encoding.
|
||||
* @param targetEncoding the target format encoding for which support is queried
|
||||
* @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
|
||||
*
|
||||
* @param targetEncoding the target format encoding for which support is
|
||||
* queried
|
||||
* @return {@code true} if the encoding is supported, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){
|
||||
public boolean isTargetEncodingSupported(Encoding targetEncoding) {
|
||||
|
||||
AudioFormat.Encoding targetEncodings[] = getTargetEncodings();
|
||||
Encoding targetEncodings[] = getTargetEncodings();
|
||||
|
||||
for(int i=0; i<targetEncodings.length; i++) {
|
||||
if( targetEncoding.equals( targetEncodings[i]) ) {
|
||||
@ -110,28 +111,29 @@ public abstract class FormatConversionProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the set of target format encodings supported by the format converter
|
||||
* given a particular source format.
|
||||
* If no target format encodings are supported for this source format,
|
||||
* an array of length 0 is returned.
|
||||
* @param sourceFormat format of the incoming data
|
||||
* Obtains the set of target format encodings supported by the format
|
||||
* converter given a particular source format. If no target format encodings
|
||||
* 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.
|
||||
*/
|
||||
public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat);
|
||||
|
||||
public abstract Encoding[] getTargetEncodings(AudioFormat sourceFormat);
|
||||
|
||||
/**
|
||||
* Indicates whether the format converter supports conversion to a particular encoding
|
||||
* from a particular format.
|
||||
* @param targetEncoding desired encoding of the outgoing data
|
||||
* @param sourceFormat format of the incoming data
|
||||
* @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
|
||||
* Indicates whether the format converter supports conversion to a
|
||||
* particular encoding from a particular format.
|
||||
*
|
||||
* @param targetEncoding desired encoding of the outgoing data
|
||||
* @param sourceFormat format of the incoming data
|
||||
* @return {@code true} if the conversion is supported, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
|
||||
public boolean isConversionSupported(Encoding targetEncoding,
|
||||
AudioFormat sourceFormat) {
|
||||
|
||||
AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
|
||||
Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
|
||||
|
||||
for(int i=0; i<targetEncodings.length; i++) {
|
||||
if( targetEncoding.equals( targetEncodings[i]) ) {
|
||||
@ -141,27 +143,29 @@ public abstract class FormatConversionProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the set of target formats with the encoding specified
|
||||
* supported by the format converter
|
||||
* If no target formats with the specified encoding are supported
|
||||
* for this source format, an array of length 0 is returned.
|
||||
* @param targetEncoding desired encoding of the stream after processing
|
||||
* @param sourceFormat format of the incoming data
|
||||
* Obtains the set of target formats with the encoding specified supported
|
||||
* by the format converter If no target formats with the specified encoding
|
||||
* are supported for this source format, an array of length 0 is returned.
|
||||
*
|
||||
* @param targetEncoding desired encoding of the stream after processing
|
||||
* @param sourceFormat format of the incoming data
|
||||
* @return array of supported target formats.
|
||||
*/
|
||||
public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat);
|
||||
|
||||
public abstract AudioFormat[] getTargetFormats(Encoding targetEncoding,
|
||||
AudioFormat sourceFormat);
|
||||
|
||||
/**
|
||||
* Indicates whether the format converter supports conversion to one
|
||||
* particular format from another.
|
||||
* @param targetFormat desired format of outgoing data
|
||||
* @param sourceFormat format of the incoming data
|
||||
* @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
|
||||
*
|
||||
* @param targetFormat desired format of outgoing data
|
||||
* @param sourceFormat format of the incoming data
|
||||
* @return {@code true} if the conversion is supported, otherwise
|
||||
* {@code false}
|
||||
*/
|
||||
public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){
|
||||
public boolean isConversionSupported(AudioFormat targetFormat,
|
||||
AudioFormat sourceFormat) {
|
||||
|
||||
AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat );
|
||||
|
||||
@ -173,28 +177,33 @@ public abstract class FormatConversionProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains an audio input stream with the specified encoding from the given
|
||||
* audio input stream.
|
||||
*
|
||||
* @param targetEncoding desired encoding of the stream after processing
|
||||
* @param sourceStream stream from which data to be processed should be
|
||||
* read
|
||||
* @return stream from which processed data with the specified target
|
||||
* encoding may be read
|
||||
* @throws IllegalArgumentException if the format combination supplied is
|
||||
* not supported.
|
||||
*/
|
||||
public abstract AudioInputStream getAudioInputStream(
|
||||
Encoding targetEncoding, AudioInputStream sourceStream);
|
||||
|
||||
/**
|
||||
* Obtains an audio input stream with the specified encoding from the given audio
|
||||
* input stream.
|
||||
* @param targetEncoding desired encoding of the stream after processing
|
||||
* @param sourceStream stream from which data to be processed should be read
|
||||
* @return stream from which processed data with the specified target encoding may be read
|
||||
* Obtains an audio input stream with the specified format from the given
|
||||
* audio input stream.
|
||||
*
|
||||
* @param targetFormat desired data format of the stream after processing
|
||||
* @param sourceStream stream from which data to be processed should be
|
||||
* read
|
||||
* @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.Encoding targetEncoding, AudioInputStream sourceStream);
|
||||
|
||||
|
||||
/**
|
||||
* Obtains an audio input stream with the specified format from the given audio
|
||||
* input stream.
|
||||
* @param targetFormat desired data format of the stream after processing
|
||||
* @param sourceStream stream from which data to be processed should be read
|
||||
* @return stream from which processed data with the specified format may be read
|
||||
* @throws IllegalArgumentException if the format combination supplied is
|
||||
* not supported.
|
||||
*/
|
||||
public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream);
|
||||
|
||||
public abstract AudioInputStream getAudioInputStream(
|
||||
AudioFormat targetFormat, AudioInputStream sourceStream);
|
||||
}
|
||||
|
@ -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
|
||||
@ -28,28 +28,27 @@ package javax.sound.sampled.spi;
|
||||
import javax.sound.sampled.Mixer;
|
||||
|
||||
/**
|
||||
* A provider or factory for a particular mixer type.
|
||||
* This mechanism allows the implementation to determine
|
||||
* how resources are managed in creation / management of
|
||||
* a mixer.
|
||||
* A provider or factory for a particular mixer type. This mechanism allows the
|
||||
* implementation to determine how resources are managed in creation /
|
||||
* management of a mixer.
|
||||
*
|
||||
* @author Kara Kytle
|
||||
* @since 1.3
|
||||
*/
|
||||
public abstract class MixerProvider {
|
||||
|
||||
|
||||
/**
|
||||
* Indicates whether the mixer provider supports the mixer represented by
|
||||
* the specified mixer info object.
|
||||
* <p>
|
||||
* The full set of mixer info objects that represent the mixers supported
|
||||
* by this {@code MixerProvider} may be obtained
|
||||
* through the {@code getMixerInfo} method.
|
||||
* The full set of mixer info objects that represent the mixers supported by
|
||||
* this {@code MixerProvider} may be obtained through the
|
||||
* {@code getMixerInfo} method.
|
||||
*
|
||||
* @param info an info object that describes the mixer for which support is queried
|
||||
* @return {@code true} if the specified mixer is supported,
|
||||
* otherwise {@code false}
|
||||
* @param info an info object that describes the mixer for which support is
|
||||
* queried
|
||||
* @return {@code true} if the specified mixer is supported, otherwise
|
||||
* {@code false}
|
||||
* @see #getMixerInfo()
|
||||
*/
|
||||
public boolean isMixerSupported(Mixer.Info info) {
|
||||
@ -64,38 +63,34 @@ public abstract class MixerProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the set of info objects representing the mixer
|
||||
* or mixers provided by this MixerProvider.
|
||||
* Obtains the set of info objects representing the mixer or mixers provided
|
||||
* by this MixerProvider.
|
||||
* <p>
|
||||
* The {@code isMixerSupported} method returns {@code true}
|
||||
* for all the info objects returned by this method.
|
||||
* The corresponding mixer instances for the info objects
|
||||
* are returned by the {@code getMixer} method.
|
||||
* The {@code isMixerSupported} method returns {@code true} for all the info
|
||||
* objects returned by this method. The corresponding mixer instances for
|
||||
* the info objects are returned by the {@code getMixer} method.
|
||||
*
|
||||
* @return a set of mixer info objects
|
||||
* @see #getMixer(javax.sound.sampled.Mixer.Info) getMixer(Mixer.Info)
|
||||
* @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
|
||||
* @see #getMixer(Mixer.Info)
|
||||
* @see #isMixerSupported(Mixer.Info)
|
||||
*/
|
||||
public abstract Mixer.Info[] getMixerInfo();
|
||||
|
||||
|
||||
/**
|
||||
* Obtains an instance of the mixer represented by the info object.
|
||||
* <p>
|
||||
* The full set of the mixer info objects that represent the mixers
|
||||
* supported by this {@code MixerProvider} may be obtained
|
||||
* through the {@code getMixerInfo} method.
|
||||
* Use the {@code isMixerSupported} method to test whether
|
||||
* this {@code MixerProvider} supports a particular mixer.
|
||||
* supported by this {@code MixerProvider} may be obtained through the
|
||||
* {@code getMixerInfo} method. Use the {@code isMixerSupported} method to
|
||||
* test whether this {@code MixerProvider} supports a particular mixer.
|
||||
*
|
||||
* @param info an info object that describes the desired mixer
|
||||
* @param info an info object that describes the desired mixer
|
||||
* @return mixer instance
|
||||
* @throws IllegalArgumentException if the info object specified does not
|
||||
* match the info object for a mixer supported by this MixerProvider.
|
||||
* match the info object for a mixer supported by this MixerProvider
|
||||
* @see #getMixerInfo()
|
||||
* @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
|
||||
* @see #isMixerSupported(Mixer.Info)
|
||||
*/
|
||||
public abstract Mixer getMixer(Mixer.Info info);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user