< prev index next >

src/java.desktop/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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 @@
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Objects;
 
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 import javax.sound.sampled.AudioSystem;
 import javax.sound.sampled.AudioFormat.Encoding;

@@ -536,10 +537,11 @@
                 Encoding.PCM_FLOAT };
     }
 
     public AudioFormat[] getTargetFormats(Encoding targetEncoding,
             AudioFormat sourceFormat) {
+        Objects.requireNonNull(targetEncoding);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return new AudioFormat[0];
         int channels = sourceFormat.getChannels();
 
         ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();

@@ -590,10 +592,11 @@
         return formats.toArray(new AudioFormat[formats.size()]);
     }
 
     public boolean isConversionSupported(AudioFormat targetFormat,
             AudioFormat sourceFormat) {
+        Objects.requireNonNull(targetFormat);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return false;
         if (AudioFloatConverter.getConverter(targetFormat) == null)
             return false;
         if (sourceFormat.getChannels() <= 0)

@@ -603,10 +606,11 @@
         return true;
     }
 
     public boolean isConversionSupported(Encoding targetEncoding,
             AudioFormat sourceFormat) {
+        Objects.requireNonNull(targetEncoding);
         if (AudioFloatConverter.getConverter(sourceFormat) == null)
             return false;
         for (int i = 0; i < formats.length; i++) {
             if (targetEncoding.equals(formats[i]))
                 return true;
< prev index next >