< prev index next >

src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java

Print this page




  96      * @param  stream for which file writing support is queried
  97      * @return {@code true} if the file type is supported for this audio input
  98      *         stream, otherwise {@code false}
  99      * @throws NullPointerException if {@code fileType} or {@code stream} are
 100      *         {@code null}
 101      */
 102     public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
 103         Objects.requireNonNull(fileType);
 104         Type types[] = getAudioFileTypes( stream );
 105 
 106         for(int i=0; i<types.length; i++) {
 107             if( fileType.equals( types[i] ) ) {
 108                 return true;
 109             }
 110         }
 111         return false;
 112     }
 113 
 114     /**
 115      * Writes a stream of bytes representing an audio file of the file type
 116      * indicated to the output stream provided. Some file types require that
 117      * the length be written into the file header, and cannot be written from
 118      * start to finish unless the length is known in advance. An attempt to
 119      * write such a file type will fail with an IOException if the length in the
 120      * audio file format is {@link AudioSystem#NOT_SPECIFIED}.
 121      *
 122      * @param  stream the audio input stream containing audio data to be written
 123      *         to the output stream
 124      * @param  fileType file type to be written to the output stream
 125      * @param  out stream to which the file data should be written
 126      * @return the number of bytes written to the output stream
 127      * @throws IOException if an I/O exception occurs
 128      * @throws IllegalArgumentException if the file type is not supported by the
 129      *         system
 130      * @throws NullPointerException if {@code stream} or {@code fileType} or
 131      *         {@code out} are {@code null}
 132      * @see #isFileTypeSupported(Type, AudioInputStream)
 133      * @see #getAudioFileTypes
 134      */
 135     public abstract int write(AudioInputStream stream, Type fileType,
 136                               OutputStream out) throws IOException;
 137 
 138     /**
 139      * Writes a stream of bytes representing an audio file of the file format


  96      * @param  stream for which file writing support is queried
  97      * @return {@code true} if the file type is supported for this audio input
  98      *         stream, otherwise {@code false}
  99      * @throws NullPointerException if {@code fileType} or {@code stream} are
 100      *         {@code null}
 101      */
 102     public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
 103         Objects.requireNonNull(fileType);
 104         Type types[] = getAudioFileTypes( stream );
 105 
 106         for(int i=0; i<types.length; i++) {
 107             if( fileType.equals( types[i] ) ) {
 108                 return true;
 109             }
 110         }
 111         return false;
 112     }
 113 
 114     /**
 115      * Writes a stream of bytes representing an audio file of the file type
 116      * indicated to the output stream provided. Some file types require that the
 117      * length be written into the file header, and cannot be written from start
 118      * to finish unless the length is known in advance. An attempt to write such
 119      * a file type will fail with an {@code IOException} if the length in the
 120      * audio file format is {@link AudioSystem#NOT_SPECIFIED}.
 121      *
 122      * @param  stream the audio input stream containing audio data to be written
 123      *         to the output stream
 124      * @param  fileType file type to be written to the output stream
 125      * @param  out stream to which the file data should be written
 126      * @return the number of bytes written to the output stream
 127      * @throws IOException if an I/O exception occurs
 128      * @throws IllegalArgumentException if the file type is not supported by the
 129      *         system
 130      * @throws NullPointerException if {@code stream} or {@code fileType} or
 131      *         {@code out} are {@code null}
 132      * @see #isFileTypeSupported(Type, AudioInputStream)
 133      * @see #getAudioFileTypes
 134      */
 135     public abstract int write(AudioInputStream stream, Type fileType,
 136                               OutputStream out) throws IOException;
 137 
 138     /**
 139      * Writes a stream of bytes representing an audio file of the file format
< prev index next >