本文整理汇总了Java中javax.imageio.spi.ImageTranscoderSpi类的典型用法代码示例。如果您正苦于以下问题:Java ImageTranscoderSpi类的具体用法?Java ImageTranscoderSpi怎么用?Java ImageTranscoderSpi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageTranscoderSpi类属于javax.imageio.spi包,在下文中一共展示了ImageTranscoderSpi类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImageTranscoders
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
/**
* Returns an <code>Iterator</code> containing all currently
* registered <code>ImageTranscoder</code>s that claim to be
* able to transcode between the metadata of the given
* <code>ImageReader</code> and <code>ImageWriter</code>.
*
* @param reader an <code>ImageReader</code>.
* @param writer an <code>ImageWriter</code>.
*
* @return an <code>Iterator</code> containing
* <code>ImageTranscoder</code>s.
*
* @exception IllegalArgumentException if <code>reader</code> or
* <code>writer</code> is <code>null</code>.
*/
public static Iterator<ImageTranscoder>
getImageTranscoders(ImageReader reader, ImageWriter writer)
{
if (reader == null) {
throw new IllegalArgumentException("reader == null!");
}
if (writer == null) {
throw new IllegalArgumentException("writer == null!");
}
ImageReaderSpi readerSpi = reader.getOriginatingProvider();
ImageWriterSpi writerSpi = writer.getOriginatingProvider();
ServiceRegistry.Filter filter =
new TranscoderFilter(readerSpi, writerSpi);
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
filter, true);
} catch (IllegalArgumentException e) {
return Collections.emptyIterator();
}
return new ImageTranscoderIterator(iter);
}
示例2: getImageTranscoders
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
/**
* Returns an {@code Iterator} containing all currently
* registered {@code ImageTranscoder}s that claim to be
* able to transcode between the metadata of the given
* {@code ImageReader} and {@code ImageWriter}.
*
* @param reader an {@code ImageReader}.
* @param writer an {@code ImageWriter}.
*
* @return an {@code Iterator} containing
* {@code ImageTranscoder}s.
*
* @exception IllegalArgumentException if {@code reader} or
* {@code writer} is {@code null}.
*/
public static Iterator<ImageTranscoder>
getImageTranscoders(ImageReader reader, ImageWriter writer)
{
if (reader == null) {
throw new IllegalArgumentException("reader == null!");
}
if (writer == null) {
throw new IllegalArgumentException("writer == null!");
}
ImageReaderSpi readerSpi = reader.getOriginatingProvider();
ImageWriterSpi writerSpi = writer.getOriginatingProvider();
ServiceRegistry.Filter filter =
new TranscoderFilter(readerSpi, writerSpi);
Iterator<ImageTranscoderSpi> iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
filter, true);
} catch (IllegalArgumentException e) {
return Collections.emptyIterator();
}
return new ImageTranscoderIterator(iter);
}
示例3: getImageTranscoders
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
/**
* Returns an <code>Iterator</code> containing all currently registered <code>ImageTranscoder</code>s that
* claim to be able to transcode between the metadata of the given <code>ImageReader</code> and
* <code>ImageWriter</code>.
*
* @param reader
* an <code>ImageReader</code>.
* @param writer
* an <code>ImageWriter</code>.
*
* @return an <code>Iterator</code> containing <code>ImageTranscoder</code>s.
*
* @exception IllegalArgumentException
* if <code>reader</code> or <code>writer</code> is <code>null</code>.
*/
public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) {
if (reader == null) {
throw new IllegalArgumentException("reader == null!");
}
if (writer == null) {
throw new IllegalArgumentException("writer == null!");
}
ImageReaderSpi readerSpi = reader.getOriginatingProvider();
ImageWriterSpi writerSpi = writer.getOriginatingProvider();
ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi);
Iterator iter;
// Ensure category is present
try {
iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true);
} catch (IllegalArgumentException e) {
return new HashSet().iterator();
}
return new ImageTranscoderIterator(iter);
}
示例4: filter
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
public boolean filter(Object elt) {
ImageTranscoderSpi spi = (ImageTranscoderSpi)elt;
String readerName = spi.getReaderServiceProviderName();
String writerName = spi.getWriterServiceProviderName();
return (readerName.equals(readerSpiName) &&
writerName.equals(writerSpiName));
}
示例5: filter
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
public boolean filter(Object provider)
{
if (provider instanceof ImageTranscoderSpi)
{
ImageTranscoderSpi spi = (ImageTranscoderSpi) provider;
if (spi.getReaderServiceProviderName().equals
(reader.getOriginatingProvider().getClass().getName())
&& spi.getWriterServiceProviderName().equals
(writer.getOriginatingProvider().getClass().getName()))
return true;
}
return false;
}
示例6: getImageTranscoders
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
/**
* Retrieve an iterator over a collection of image transcoders that
* support transcoding from the given image reader's metadata format
* to the given writer's metadata format.
*
* @param reader an image reader
* @param writer an image writer
*
* @return an iterator over a collection of image transcoders
*
* @exception IllegalArgumentException if either reader or writer is
* null
*/
public static Iterator<ImageTranscoder> getImageTranscoders (ImageReader reader,
ImageWriter writer)
{
if (reader == null || writer == null)
throw new IllegalArgumentException ("null argument");
final Iterator<ImageTranscoderSpi> spiIterator
= getRegistry().getServiceProviders (ImageTranscoderSpi.class,
new TranscoderFilter (reader,
writer),
true);
return new Iterator<ImageTranscoder>()
{
public boolean hasNext()
{
return spiIterator.hasNext();
}
public ImageTranscoder next()
{
return spiIterator.next().createTranscoderInstance();
}
public void remove()
{
throw new UnsupportedOperationException();
}
};
}
示例7: filter
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
public boolean filter(Object provider)
{
if (provider instanceof ImageTranscoderSpi)
{
ImageTranscoderSpi spi = (ImageTranscoderSpi) provider;
if (spi.getReaderServiceProviderName().equals
(reader.getOriginatingProvider().getClass().getName())
&& spi.getWriterServiceProviderName().equals
(writer.getOriginatingProvider().getClass().getName()))
return true;
}
return false;
}
示例8: getImageTranscoders
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
/**
* Retrieve an iterator over a collection of image transcoders that
* support transcoding from the given image reader's metadata format
* to the given writer's metadata format.
*
* @param reader an image reader
* @param writer an image writer
*
* @return an iterator over a collection of image transcoders
*
* @exception IllegalArgumentException if either reader or writer is
* null
*/
public static Iterator<ImageTranscoder> getImageTranscoders (ImageReader reader,
ImageWriter writer)
{
if (reader == null || writer == null)
throw new IllegalArgumentException ("null argument");
final Iterator<ImageTranscoderSpi> spiIterator
= getRegistry().getServiceProviders (ImageTranscoderSpi.class,
new TranscoderFilter (reader,
writer),
true);
return new Iterator<ImageTranscoder>()
{
public boolean hasNext()
{
return spiIterator.hasNext();
}
public ImageTranscoder next()
{
return spiIterator.next().createTranscoderInstance();
}
public void remove()
{
throw new UnsupportedOperationException();
}
};
}
示例9: ImageTranscoderIterator
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
public ImageTranscoderIterator(Iterator<ImageTranscoderSpi> iter) {
this.iter = iter;
}
示例10: next
import javax.imageio.spi.ImageTranscoderSpi; //导入依赖的package包/类
public ImageTranscoder next() {
ImageTranscoderSpi spi = null;
spi = iter.next();
return spi.createTranscoderInstance();
}