jdk/src/share/classes/javax/imageio/ImageWriter.java
changeset 22584 eed64ee05369
parent 22260 c9185e010e03
child 23306 679ac7841e8d
equal deleted inserted replaced
22583:e7d5af0b11e9 22584:eed64ee05369
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2014, 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
   255      * @return an array of <code>Locale</code>s that may be used as
   255      * @return an array of <code>Locale</code>s that may be used as
   256      * arguments to <code>setLocale</code>, or <code>null</code>.
   256      * arguments to <code>setLocale</code>, or <code>null</code>.
   257      */
   257      */
   258     public Locale[] getAvailableLocales() {
   258     public Locale[] getAvailableLocales() {
   259         return (availableLocales == null) ?
   259         return (availableLocales == null) ?
   260             null : (Locale[])availableLocales.clone();
   260             null : availableLocales.clone();
   261     }
   261     }
   262 
   262 
   263     /**
   263     /**
   264      * Sets the current <code>Locale</code> of this
   264      * Sets the current <code>Locale</code> of this
   265      * <code>ImageWriter</code> to the given value.  A value of
   265      * <code>ImageWriter</code> to the given value.  A value of
  1752             return;
  1752             return;
  1753         }
  1753         }
  1754         int numListeners = progressListeners.size();
  1754         int numListeners = progressListeners.size();
  1755         for (int i = 0; i < numListeners; i++) {
  1755         for (int i = 0; i < numListeners; i++) {
  1756             IIOWriteProgressListener listener =
  1756             IIOWriteProgressListener listener =
  1757                 (IIOWriteProgressListener)progressListeners.get(i);
  1757                 progressListeners.get(i);
  1758             listener.imageStarted(this, imageIndex);
  1758             listener.imageStarted(this, imageIndex);
  1759         }
  1759         }
  1760     }
  1760     }
  1761 
  1761 
  1762     /**
  1762     /**
  1773             return;
  1773             return;
  1774         }
  1774         }
  1775         int numListeners = progressListeners.size();
  1775         int numListeners = progressListeners.size();
  1776         for (int i = 0; i < numListeners; i++) {
  1776         for (int i = 0; i < numListeners; i++) {
  1777             IIOWriteProgressListener listener =
  1777             IIOWriteProgressListener listener =
  1778                 (IIOWriteProgressListener)progressListeners.get(i);
  1778                 progressListeners.get(i);
  1779             listener.imageProgress(this, percentageDone);
  1779             listener.imageProgress(this, percentageDone);
  1780         }
  1780         }
  1781     }
  1781     }
  1782 
  1782 
  1783     /**
  1783     /**
  1791             return;
  1791             return;
  1792         }
  1792         }
  1793         int numListeners = progressListeners.size();
  1793         int numListeners = progressListeners.size();
  1794         for (int i = 0; i < numListeners; i++) {
  1794         for (int i = 0; i < numListeners; i++) {
  1795             IIOWriteProgressListener listener =
  1795             IIOWriteProgressListener listener =
  1796                 (IIOWriteProgressListener)progressListeners.get(i);
  1796                 progressListeners.get(i);
  1797             listener.imageComplete(this);
  1797             listener.imageComplete(this);
  1798         }
  1798         }
  1799     }
  1799     }
  1800 
  1800 
  1801     /**
  1801     /**
  1814             return;
  1814             return;
  1815         }
  1815         }
  1816         int numListeners = progressListeners.size();
  1816         int numListeners = progressListeners.size();
  1817         for (int i = 0; i < numListeners; i++) {
  1817         for (int i = 0; i < numListeners; i++) {
  1818             IIOWriteProgressListener listener =
  1818             IIOWriteProgressListener listener =
  1819                 (IIOWriteProgressListener)progressListeners.get(i);
  1819                 progressListeners.get(i);
  1820             listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
  1820             listener.thumbnailStarted(this, imageIndex, thumbnailIndex);
  1821         }
  1821         }
  1822     }
  1822     }
  1823 
  1823 
  1824     /**
  1824     /**
  1835             return;
  1835             return;
  1836         }
  1836         }
  1837         int numListeners = progressListeners.size();
  1837         int numListeners = progressListeners.size();
  1838         for (int i = 0; i < numListeners; i++) {
  1838         for (int i = 0; i < numListeners; i++) {
  1839             IIOWriteProgressListener listener =
  1839             IIOWriteProgressListener listener =
  1840                 (IIOWriteProgressListener)progressListeners.get(i);
  1840                 progressListeners.get(i);
  1841             listener.thumbnailProgress(this, percentageDone);
  1841             listener.thumbnailProgress(this, percentageDone);
  1842         }
  1842         }
  1843     }
  1843     }
  1844 
  1844 
  1845     /**
  1845     /**
  1853             return;
  1853             return;
  1854         }
  1854         }
  1855         int numListeners = progressListeners.size();
  1855         int numListeners = progressListeners.size();
  1856         for (int i = 0; i < numListeners; i++) {
  1856         for (int i = 0; i < numListeners; i++) {
  1857             IIOWriteProgressListener listener =
  1857             IIOWriteProgressListener listener =
  1858                 (IIOWriteProgressListener)progressListeners.get(i);
  1858                 progressListeners.get(i);
  1859             listener.thumbnailComplete(this);
  1859             listener.thumbnailComplete(this);
  1860         }
  1860         }
  1861     }
  1861     }
  1862 
  1862 
  1863     /**
  1863     /**
  1871             return;
  1871             return;
  1872         }
  1872         }
  1873         int numListeners = progressListeners.size();
  1873         int numListeners = progressListeners.size();
  1874         for (int i = 0; i < numListeners; i++) {
  1874         for (int i = 0; i < numListeners; i++) {
  1875             IIOWriteProgressListener listener =
  1875             IIOWriteProgressListener listener =
  1876                 (IIOWriteProgressListener)progressListeners.get(i);
  1876                 progressListeners.get(i);
  1877             listener.writeAborted(this);
  1877             listener.writeAborted(this);
  1878         }
  1878         }
  1879     }
  1879     }
  1880 
  1880 
  1881     /**
  1881     /**
  1900             throw new IllegalArgumentException("warning == null!");
  1900             throw new IllegalArgumentException("warning == null!");
  1901         }
  1901         }
  1902         int numListeners = warningListeners.size();
  1902         int numListeners = warningListeners.size();
  1903         for (int i = 0; i < numListeners; i++) {
  1903         for (int i = 0; i < numListeners; i++) {
  1904             IIOWriteWarningListener listener =
  1904             IIOWriteWarningListener listener =
  1905                 (IIOWriteWarningListener)warningListeners.get(i);
  1905                 warningListeners.get(i);
  1906 
  1906 
  1907             listener.warningOccurred(this, imageIndex, warning);
  1907             listener.warningOccurred(this, imageIndex, warning);
  1908         }
  1908         }
  1909     }
  1909     }
  1910 
  1910 
  1948             throw new IllegalArgumentException("keyword == null!");
  1948             throw new IllegalArgumentException("keyword == null!");
  1949         }
  1949         }
  1950         int numListeners = warningListeners.size();
  1950         int numListeners = warningListeners.size();
  1951         for (int i = 0; i < numListeners; i++) {
  1951         for (int i = 0; i < numListeners; i++) {
  1952             IIOWriteWarningListener listener =
  1952             IIOWriteWarningListener listener =
  1953                 (IIOWriteWarningListener)warningListeners.get(i);
  1953                 warningListeners.get(i);
  1954             Locale locale = (Locale)warningLocales.get(i);
  1954             Locale locale = warningLocales.get(i);
  1955             if (locale == null) {
  1955             if (locale == null) {
  1956                 locale = Locale.getDefault();
  1956                 locale = Locale.getDefault();
  1957             }
  1957             }
  1958 
  1958 
  1959             /**
  1959             /**