src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
changeset 49500 3c68768d3904
parent 47216 71c04702a3d5
child 50489 580159eeac07
equal deleted inserted replaced
49499:58d26b495f24 49500:3c68768d3904
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   301 
   301 
   302     public int getNumThumbnailsSupported(ImageTypeSpecifier imageType,
   302     public int getNumThumbnailsSupported(ImageTypeSpecifier imageType,
   303                                          ImageWriteParam param,
   303                                          ImageWriteParam param,
   304                                          IIOMetadata streamMetadata,
   304                                          IIOMetadata streamMetadata,
   305                                          IIOMetadata imageMetadata) {
   305                                          IIOMetadata imageMetadata) {
       
   306         // Check whether sufficient data is available.
       
   307         if (imageType == null && imageMetadata == null) {
       
   308             // The method has been invoked with insufficient data. Henceforth
       
   309             // we return -1 as recommended by ImageWriter specification.
       
   310             return -1;
       
   311         }
       
   312 
       
   313         // Check if the image type and metadata are JFIF compatible.
   306         if (jfifOK(imageType, param, streamMetadata, imageMetadata)) {
   314         if (jfifOK(imageType, param, streamMetadata, imageMetadata)) {
   307             return Integer.MAX_VALUE;
   315             return Integer.MAX_VALUE;
   308         }
   316         }
   309         return 0;
   317         return 0;
   310     }
   318     }