feat(jdk8): move files to new folder to avoid resources compiled.

This commit is contained in:
2025-09-07 15:25:52 +08:00
parent 3f0047bf6f
commit 8c35cfb1c0
17415 changed files with 217 additions and 213 deletions

View File

@@ -0,0 +1,137 @@
/*
* Copyright (c) 1999, 2002, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.sound.sampled.spi;
import java.io.File;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.UnsupportedAudioFileException;
/**
* 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.
*
* @author Kara Kytle
* @since 1.3
*/
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
* 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
* @throws IOException if an I/O exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
*/
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
* @throws IOException if an I/O exception occurs
*/
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
* @throws IOException if an I/O exception occurs
*/
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
* 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
* @throws IOException if an I/O exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
*/
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
* @throws IOException if an I/O exception occurs
*/
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
* @throws IOException if an I/O exception occurs
*/
public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException;
}

View File

@@ -0,0 +1,147 @@
/*
* Copyright (c) 1999, 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
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;
/**
* Provider for audio file writing services. Classes providing concrete
* implementations can write one or more types of audio file from an audio
* stream.
*
* @author Kara Kytle
* @since 1.3
*/
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.
*/
public abstract AudioFileFormat.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>
*/
public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
AudioFileFormat.Type types[] = getAudioFileTypes();
for(int i=0; i<types.length; i++) {
if( fileType.equals( types[i] ) ) {
return true;
}
}
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.
*/
public abstract AudioFileFormat.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>
*/
public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) {
AudioFileFormat.Type types[] = getAudioFileTypes( stream );
for(int i=0; i<types.length; i++) {
if( fileType.equals( types[i] ) ) {
return true;
}
}
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
* 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
* @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)
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, AudioFileFormat.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
* @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
* @see #isFileTypeSupported
* @see #getAudioFileTypes
*/
public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException;
}

View File

@@ -0,0 +1,200 @@
/*
* Copyright (c) 1999, 2013, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.sound.sampled.spi;
import java.io.InputStream;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
/**
* 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.
* <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.
*
* @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.
* @return array of source format encodings. If for some reason provider
* does not provide any conversion services, an array of length 0 is
* returned.
*/
public abstract AudioFormat.Encoding[] getSourceEncodings();
/**
* 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.
*/
public abstract AudioFormat.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>
*/
public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){
AudioFormat.Encoding sourceEncodings[] = getSourceEncodings();
for(int i=0; i<sourceEncodings.length; i++) {
if( sourceEncoding.equals( sourceEncodings[i]) ) {
return true;
}
}
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>
*/
public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){
AudioFormat.Encoding targetEncodings[] = getTargetEncodings();
for(int i=0; i<targetEncodings.length; i++) {
if( targetEncoding.equals( targetEncodings[i]) ) {
return true;
}
}
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
* @return array of supported target format encodings.
*/
public abstract AudioFormat.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>
*/
public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
for(int i=0; i<targetEncodings.length; i++) {
if( targetEncoding.equals( targetEncodings[i]) ) {
return true;
}
}
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
* @return array of supported target formats.
*/
public abstract AudioFormat[] getTargetFormats(AudioFormat.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>
*/
public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){
AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat );
for(int i=0; i<targetFormats.length; i++) {
if( targetFormat.matches( targetFormats[i] ) ) {
return true;
}
}
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(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);
}

View File

@@ -0,0 +1,101 @@
/*
* Copyright (c) 1999, 2003, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
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.
*
* @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.
*
* @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) {
Mixer.Info infos[] = getMixerInfo();
for(int i=0; i<infos.length; i++){
if( info.equals( infos[i] ) ) {
return true;
}
}
return false;
}
/**
* 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.
*
* @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)
*/
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.
*
* @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.
* @see #getMixerInfo()
* @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
*/
public abstract Mixer getMixer(Mixer.Info info);
}