< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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

@@ -26,10 +26,11 @@
 package javax.sound.sampled.spi;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.Objects;
 
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 
 import static javax.sound.sampled.AudioFileFormat.Type;

@@ -58,12 +59,14 @@
      * 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}
+     * @throws NullPointerException if {@code fileType} is {@code null}
      */
     public boolean isFileTypeSupported(Type fileType) {
+        Objects.requireNonNull(fileType);
 
         Type types[] = getAudioFileTypes();
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {

@@ -79,10 +82,11 @@
      *
      * @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.
+     * @throws NullPointerException if {@code stream} is {@code null}
      */
     public abstract Type[] getAudioFileTypes(AudioInputStream stream);
 
     /**
      * Indicates whether an audio file of the type specified can be written from

@@ -90,13 +94,15 @@
      *
      * @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}
+     * @throws NullPointerException if {@code fileType} or {@code stream} are
+     *         {@code null}
      */
     public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
-
+        Objects.requireNonNull(fileType);
         Type types[] = getAudioFileTypes( stream );
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {
                 return true;

@@ -119,10 +125,12 @@
      * @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
+     * @throws NullPointerException if {@code stream} or {@code fileType} or
+     *         {@code out} are {@code null}
      * @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
      * @see #getAudioFileTypes
      */
     public abstract int write(AudioInputStream stream, Type fileType,
                               OutputStream out) throws IOException;

@@ -137,10 +145,12 @@
      * @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
+     * @throws NullPointerException if {@code stream} or {@code fileType} or
+     *         {@code out} are {@code null}
      * @see #isFileTypeSupported
      * @see #getAudioFileTypes
      */
     public abstract int write(AudioInputStream stream, Type fileType, File out)
             throws IOException;
< prev index next >