src/share/classes/javax/imageio/ImageWriteParam.java

Print this page




 960      * <code>UnsupportedOperationException</code> if not.  Otherwise,
 961      * it returns a clone of the <code>compressionTypes</code>
 962      * instance variable if it is non-<code>null</code>, or else
 963      * returns <code>null</code>.
 964      *
 965      * @return an array of <code>String</code>s containing the
 966      * (non-localized) names of available compression types, or
 967      * <code>null</code>.
 968      *
 969      * @exception UnsupportedOperationException if the writer does not
 970      * support compression.
 971      */
 972     public String[] getCompressionTypes() {
 973         if (!canWriteCompressed()) {
 974             throw new UnsupportedOperationException(
 975                 "Compression not supported");
 976         }
 977         if (compressionTypes == null) {
 978             return null;
 979         }
 980         return (String[])compressionTypes.clone();
 981     }
 982 
 983     /**
 984      * Sets the compression type to one of the values indicated by
 985      * <code>getCompressionTypes</code>.  If a value of
 986      * <code>null</code> is passed in, any previous setting is
 987      * removed.
 988      *
 989      * <p> The default implementation checks whether compression is
 990      * supported and the compression mode is
 991      * <code>MODE_EXPLICIT</code>.  If so, it calls
 992      * <code>getCompressionTypes</code> and checks if
 993      * <code>compressionType</code> is one of the legal values.  If it
 994      * is, the <code>compressionType</code> instance variable is set.
 995      * If <code>compressionType</code> is <code>null</code>, the
 996      * instance variable is set without performing any checking.
 997      *
 998      * @param compressionType one of the <code>String</code>s returned
 999      * by <code>getCompressionTypes</code>, or <code>null</code> to
1000      * remove any previous setting.




 960      * <code>UnsupportedOperationException</code> if not.  Otherwise,
 961      * it returns a clone of the <code>compressionTypes</code>
 962      * instance variable if it is non-<code>null</code>, or else
 963      * returns <code>null</code>.
 964      *
 965      * @return an array of <code>String</code>s containing the
 966      * (non-localized) names of available compression types, or
 967      * <code>null</code>.
 968      *
 969      * @exception UnsupportedOperationException if the writer does not
 970      * support compression.
 971      */
 972     public String[] getCompressionTypes() {
 973         if (!canWriteCompressed()) {
 974             throw new UnsupportedOperationException(
 975                 "Compression not supported");
 976         }
 977         if (compressionTypes == null) {
 978             return null;
 979         }
 980         return compressionTypes.clone();
 981     }
 982 
 983     /**
 984      * Sets the compression type to one of the values indicated by
 985      * <code>getCompressionTypes</code>.  If a value of
 986      * <code>null</code> is passed in, any previous setting is
 987      * removed.
 988      *
 989      * <p> The default implementation checks whether compression is
 990      * supported and the compression mode is
 991      * <code>MODE_EXPLICIT</code>.  If so, it calls
 992      * <code>getCompressionTypes</code> and checks if
 993      * <code>compressionType</code> is one of the legal values.  If it
 994      * is, the <code>compressionType</code> instance variable is set.
 995      * If <code>compressionType</code> is <code>null</code>, the
 996      * instance variable is set without performing any checking.
 997      *
 998      * @param compressionType one of the <code>String</code>s returned
 999      * by <code>getCompressionTypes</code>, or <code>null</code> to
1000      * remove any previous setting.