< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 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(AudioFileFormat.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
 140      * indicated to the external file provided.
 141      *
 142      * @param  stream the audio input stream containing audio data to be written
 143      *         to the file
 144      * @param  fileType file type to be written to the file
 145      * @param  out external file to which the file data should be written
 146      * @return the number of bytes written to the file
 147      * @throws IOException if an I/O exception occurs
 148      * @throws IllegalArgumentException if the file format is not supported by
 149      *         the system
 150      * @throws NullPointerException if {@code stream} or {@code fileType} or
 151      *         {@code out} are {@code null}
 152      * @see #isFileTypeSupported
 153      * @see #getAudioFileTypes
 154      */
 155     public abstract int write(AudioInputStream stream, Type fileType, File out)
 156             throws IOException;
 157 }
   1 /*
   2  * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 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
 140      * indicated to the external file provided.
 141      *
 142      * @param  stream the audio input stream containing audio data to be written
 143      *         to the file
 144      * @param  fileType file type to be written to the file
 145      * @param  out external file to which the file data should be written
 146      * @return the number of bytes written to the file
 147      * @throws IOException if an I/O exception occurs
 148      * @throws IllegalArgumentException if the file format is not supported by
 149      *         the system
 150      * @throws NullPointerException if {@code stream} or {@code fileType} or
 151      *         {@code out} are {@code null}
 152      * @see #isFileTypeSupported(Type, AudioInputStream)
 153      * @see #getAudioFileTypes
 154      */
 155     public abstract int write(AudioInputStream stream, Type fileType, File out)
 156             throws IOException;
 157 }
< prev index next >