mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 03:25:28 -04:00
TMI-IIO: Removed some deprecation warnings.
This commit is contained in:
parent
db0f8901dc
commit
38fa2189bc
@ -65,7 +65,7 @@ public class SVGImageReaderSpi extends ImageReaderSpi {
|
|||||||
SVG_READER_AVAILABLE ? new String[]{"svg"} : null, // Suffixes
|
SVG_READER_AVAILABLE ? new String[]{"svg"} : null, // Suffixes
|
||||||
SVG_READER_AVAILABLE ? new String[]{"image/svg", "image/x-svg", "image/svg+xml", "image/svg-xml"} : null, // Mime-types
|
SVG_READER_AVAILABLE ? new String[]{"image/svg", "image/x-svg", "image/svg+xml", "image/svg-xml"} : null, // Mime-types
|
||||||
"com.twelvemonkeys.imageio.plugins.svg.SVGImageReader", // Reader class name
|
"com.twelvemonkeys.imageio.plugins.svg.SVGImageReader", // Reader class name
|
||||||
ImageReaderSpi.STANDARD_INPUT_TYPE, // Output types
|
new Class[] {ImageInputStream.class}, // Input types
|
||||||
null, // Writer SPI names
|
null, // Writer SPI names
|
||||||
true, // Supports standard stream metadata format
|
true, // Supports standard stream metadata format
|
||||||
null, // Native stream metadata format name
|
null, // Native stream metadata format name
|
||||||
|
@ -65,8 +65,8 @@ public class WMFImageReaderSpi extends ImageReaderSpi {
|
|||||||
WMF_READER_AVAILABLE ? new String[]{"wmf", "WMF"} : new String[]{""}, // Names
|
WMF_READER_AVAILABLE ? new String[]{"wmf", "WMF"} : new String[]{""}, // Names
|
||||||
WMF_READER_AVAILABLE ? new String[]{"wmf", "emf"} : null, // Suffixes
|
WMF_READER_AVAILABLE ? new String[]{"wmf", "emf"} : null, // Suffixes
|
||||||
WMF_READER_AVAILABLE ? new String[]{"application/x-msmetafile", "image/x-wmf"} : null, // Mime-types
|
WMF_READER_AVAILABLE ? new String[]{"application/x-msmetafile", "image/x-wmf"} : null, // Mime-types
|
||||||
WMFImageReader.class.getName(), // Reader class name..?
|
"com.twelvemonkeys.imageio.plugins.wmf.WMFImageReader", // Reader class name..?
|
||||||
ImageReaderSpi.STANDARD_INPUT_TYPE, // Output types
|
new Class[] {ImageInputStream.class}, // Input types
|
||||||
null, // Writer SPI names
|
null, // Writer SPI names
|
||||||
true, // Supports standard stream metadata format
|
true, // Supports standard stream metadata format
|
||||||
null, // Native stream metadata format name
|
null, // Native stream metadata format name
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
package com.twelvemonkeys.imageio.util;
|
package com.twelvemonkeys.imageio.util;
|
||||||
|
|
||||||
|
import com.twelvemonkeys.imageio.stream.URLImageInputStreamSpi;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.InOrder;
|
import org.mockito.InOrder;
|
||||||
|
|
||||||
@ -35,12 +36,14 @@ import javax.imageio.ImageIO;
|
|||||||
import javax.imageio.ImageWriteParam;
|
import javax.imageio.ImageWriteParam;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.event.IIOWriteProgressListener;
|
import javax.imageio.event.IIOWriteProgressListener;
|
||||||
|
import javax.imageio.spi.IIORegistry;
|
||||||
import javax.imageio.stream.ImageOutputStream;
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.RenderedImage;
|
import java.awt.image.RenderedImage;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
@ -56,6 +59,12 @@ import static org.mockito.Mockito.*;
|
|||||||
*/
|
*/
|
||||||
public abstract class ImageWriterAbstractTestCase {
|
public abstract class ImageWriterAbstractTestCase {
|
||||||
|
|
||||||
|
// TODO: Move static block + getClassLoaderResource to common superclass for reader/writer test cases or delegate.
|
||||||
|
|
||||||
|
static {
|
||||||
|
IIORegistry.getDefaultInstance().registerServiceProvider(new URLImageInputStreamSpi());
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract ImageWriter createImageWriter();
|
protected abstract ImageWriter createImageWriter();
|
||||||
|
|
||||||
protected abstract List<? extends RenderedImage> getTestData();
|
protected abstract List<? extends RenderedImage> getTestData();
|
||||||
@ -85,6 +94,10 @@ public abstract class ImageWriterAbstractTestCase {
|
|||||||
return getTestData().get(index);
|
return getTestData().get(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected URL getClassLoaderResource(final String pName) {
|
||||||
|
return getClass().getResource(pName);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetOutput() throws IOException {
|
public void testSetOutput() throws IOException {
|
||||||
// Should just pass with no exceptions
|
// Should just pass with no exceptions
|
||||||
|
@ -59,7 +59,7 @@ public final class ICNSImageReaderSpi extends ImageReaderSpi{
|
|||||||
"image/x-apple-icons", // Common extension MIME
|
"image/x-apple-icons", // Common extension MIME
|
||||||
},
|
},
|
||||||
"com.twelvemonkeys.imageio.plugins.icns.ICNSImageReader",
|
"com.twelvemonkeys.imageio.plugins.icns.ICNSImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
null,
|
null,
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true,
|
true,
|
||||||
|
@ -61,7 +61,7 @@ public final class CURImageReaderSpi extends ImageReaderSpi {
|
|||||||
"image/cursor" // Unofficial, but common
|
"image/cursor" // Unofficial, but common
|
||||||
},
|
},
|
||||||
"com.twelvemonkeys.imageio.plugins.ico.CURImageReader",
|
"com.twelvemonkeys.imageio.plugins.ico.CURImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
null,
|
null,
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true,
|
true,
|
||||||
|
@ -61,7 +61,7 @@ public final class ICOImageReaderSpi extends ImageReaderSpi {
|
|||||||
"image/ico" // Unofficial, but common
|
"image/ico" // Unofficial, but common
|
||||||
},
|
},
|
||||||
"com.twelvemonkeys.imageio.plugins.ico.ICOImageReader",
|
"com.twelvemonkeys.imageio.plugins.ico.ICOImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
null,
|
null,
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true,
|
true,
|
||||||
|
@ -63,7 +63,7 @@ public class IFFImageReaderSpi extends ImageReaderSpi {
|
|||||||
new String[]{"iff", "lbm", "ham", "ham8", "ilbm"},
|
new String[]{"iff", "lbm", "ham", "ham8", "ilbm"},
|
||||||
new String[]{"image/iff", "image/x-iff"},
|
new String[]{"image/iff", "image/x-iff"},
|
||||||
"com.twelvemonkeys.imageio.plugins.iff.IFFImageReader",
|
"com.twelvemonkeys.imageio.plugins.iff.IFFImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
new String[]{"com.twelvemonkeys.imageio.plugins.iff.IFFImageWriterSpi"},
|
new String[]{"com.twelvemonkeys.imageio.plugins.iff.IFFImageWriterSpi"},
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true, null, null, null, null
|
true, null, null, null, null
|
||||||
|
@ -69,7 +69,7 @@ abstract class JMagickImageReaderSpiSupport extends ImageReaderSpi {
|
|||||||
AVAILABLE ? pSuffixes : null, // Suffixes
|
AVAILABLE ? pSuffixes : null, // Suffixes
|
||||||
AVAILABLE ? pMimeTypes : null, // Mime-types
|
AVAILABLE ? pMimeTypes : null, // Mime-types
|
||||||
pReaderClassName, // Reader class name
|
pReaderClassName, // Reader class name
|
||||||
ImageReaderSpi.STANDARD_INPUT_TYPE, // Output types
|
new Class[] {ImageInputStream.class}, // Input types
|
||||||
pWriterSpiNames, // Writer SPI names
|
pWriterSpiNames, // Writer SPI names
|
||||||
true, // Supports standard stream metadata format
|
true, // Supports standard stream metadata format
|
||||||
null, // Native stream metadata format name
|
null, // Native stream metadata format name
|
||||||
|
@ -30,9 +30,9 @@ package com.twelvemonkeys.imageio.plugins.jmagick;
|
|||||||
|
|
||||||
import javax.imageio.ImageTypeSpecifier;
|
import javax.imageio.ImageTypeSpecifier;
|
||||||
import javax.imageio.ImageWriter;
|
import javax.imageio.ImageWriter;
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
|
||||||
import javax.imageio.spi.ImageWriterSpi;
|
import javax.imageio.spi.ImageWriterSpi;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ abstract class JMagickImageWriterSpiSupport extends ImageWriterSpi {
|
|||||||
AVAILABLE ? pSuffixes : null, // Suffixes
|
AVAILABLE ? pSuffixes : null, // Suffixes
|
||||||
AVAILABLE ? pMimeTypes : null, // Mime-types
|
AVAILABLE ? pMimeTypes : null, // Mime-types
|
||||||
pWriterClassName, // Writer class name
|
pWriterClassName, // Writer class name
|
||||||
ImageReaderSpi.STANDARD_INPUT_TYPE, // Output types
|
new Class[] {ImageOutputStream.class}, // Output types
|
||||||
pReaderSpiNames, // Reader SPI names
|
pReaderSpiNames, // Reader SPI names
|
||||||
true, // Supports standard stream metadata format
|
true, // Supports standard stream metadata format
|
||||||
null, // Native stream metadata format name
|
null, // Native stream metadata format name
|
||||||
|
@ -36,6 +36,7 @@ import javax.imageio.ImageReader;
|
|||||||
import javax.imageio.metadata.IIOMetadataFormat;
|
import javax.imageio.metadata.IIOMetadataFormat;
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
import javax.imageio.spi.ServiceRegistry;
|
import javax.imageio.spi.ServiceRegistry;
|
||||||
|
import javax.imageio.stream.ImageInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ public class JPEGImageReaderSpi extends ImageReaderSpi {
|
|||||||
new String[]{"jpg", "jpeg"},
|
new String[]{"jpg", "jpeg"},
|
||||||
new String[]{"image/jpeg"},
|
new String[]{"image/jpeg"},
|
||||||
"com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader",
|
"com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
new String[] {"com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriterSpi"},
|
new String[] {"com.twelvemonkeys.imageio.plugins.jpeg.JPEGImageWriterSpi"},
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true, null, null, null, null
|
true, null, null, null, null
|
||||||
|
@ -62,7 +62,7 @@ public class PICTImageReaderSpi extends ImageReaderSpi {
|
|||||||
new String[]{"pct", "pict"},
|
new String[]{"pct", "pict"},
|
||||||
new String[]{"image/pict", "image/x-pict"},
|
new String[]{"image/pict", "image/x-pict"},
|
||||||
"com.twelvemkonkeys.imageio.plugins.pict.PICTImageReader",
|
"com.twelvemkonkeys.imageio.plugins.pict.PICTImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
new String[]{"com.twelvemkonkeys.imageio.plugins.pict.PICTImageWriterSpi"},
|
new String[]{"com.twelvemkonkeys.imageio.plugins.pict.PICTImageWriterSpi"},
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true, null, null, null, null
|
true, null, null, null, null
|
||||||
|
@ -64,7 +64,7 @@ public class PSDImageReaderSpi extends ImageReaderSpi {
|
|||||||
"image/x-psd", "application/x-photoshop", "image/x-photoshop"
|
"image/x-psd", "application/x-photoshop", "image/x-photoshop"
|
||||||
},
|
},
|
||||||
"com.twelvemkonkeys.imageio.plugins.psd.PSDImageReader",
|
"com.twelvemkonkeys.imageio.plugins.psd.PSDImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
// new String[]{"com.twelvemkonkeys.imageio.plugins.psd.PSDImageWriterSpi"},
|
// new String[]{"com.twelvemkonkeys.imageio.plugins.psd.PSDImageWriterSpi"},
|
||||||
null,
|
null,
|
||||||
true, // supports standard stream metadata
|
true, // supports standard stream metadata
|
||||||
|
@ -65,8 +65,8 @@ public class ThumbsDBImageReaderSpi extends ImageReaderSpi {
|
|||||||
new String[]{"thumbs", "THUMBS", "Thumbs DB"},
|
new String[]{"thumbs", "THUMBS", "Thumbs DB"},
|
||||||
new String[]{"db"},
|
new String[]{"db"},
|
||||||
new String[]{"image/x-thumbs-db", "application/octet-stream"}, // TODO: Check IANA et al...
|
new String[]{"image/x-thumbs-db", "application/octet-stream"}, // TODO: Check IANA et al...
|
||||||
ThumbsDBImageReader.class.getName(),
|
"com.twelvemonkeys.imageio.plugins.thumbsdb.ThumbsDBImageReader",
|
||||||
STANDARD_INPUT_TYPE,
|
new Class[] {ImageInputStream.class},
|
||||||
null,
|
null,
|
||||||
true, null, null, null, null,
|
true, null, null, null, null,
|
||||||
true, null, null, null, null
|
true, null, null, null, null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user