mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-04 11:26:44 -04:00
New SPI info.
This commit is contained in:
@@ -29,7 +29,6 @@
|
||||
package com.twelvemonkeys.imageio.plugins.pnm;
|
||||
|
||||
import com.twelvemonkeys.imageio.spi.ProviderInfo;
|
||||
import com.twelvemonkeys.imageio.util.IIOUtil;
|
||||
|
||||
import javax.imageio.ImageTypeSpecifier;
|
||||
import javax.imageio.ImageWriter;
|
||||
@@ -43,16 +42,16 @@ public final class PAMImageWriterSpi extends ImageWriterSpi {
|
||||
* Creates a {@code PAMImageWriterSpi}.
|
||||
*/
|
||||
public PAMImageWriterSpi() {
|
||||
this(IIOUtil.getProviderInfo(PAMImageWriterSpi.class));
|
||||
this(new PNMProviderInfo());
|
||||
}
|
||||
|
||||
private PAMImageWriterSpi(final ProviderInfo pProviderInfo) {
|
||||
super(
|
||||
pProviderInfo.getVendorName(),
|
||||
pProviderInfo.getVersion(),
|
||||
new String[]{"pam", "PAM"},
|
||||
new String[]{"pam"},
|
||||
new String[]{
|
||||
new String[] {"pam", "PAM"},
|
||||
new String[] {"pam"},
|
||||
new String[] {
|
||||
// No official IANA record exists, these are conventional
|
||||
"image/x-portable-arbitrarymap" // PAM
|
||||
},
|
||||
@@ -73,7 +72,8 @@ public final class PAMImageWriterSpi extends ImageWriterSpi {
|
||||
return new PNMImageWriter(this);
|
||||
}
|
||||
|
||||
@Override public String getDescription(final Locale locale) {
|
||||
@Override
|
||||
public String getDescription(final Locale locale) {
|
||||
return "NetPBM Portable Arbitrary Map (PAM) image writer";
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@
|
||||
package com.twelvemonkeys.imageio.plugins.pnm;
|
||||
|
||||
import com.twelvemonkeys.imageio.spi.ProviderInfo;
|
||||
import com.twelvemonkeys.imageio.util.IIOUtil;
|
||||
|
||||
import javax.imageio.ImageReader;
|
||||
import javax.imageio.spi.ImageReaderSpi;
|
||||
@@ -43,19 +42,19 @@ public final class PNMImageReaderSpi extends ImageReaderSpi {
|
||||
* Creates a {@code PNMImageReaderSpi}.
|
||||
*/
|
||||
public PNMImageReaderSpi() {
|
||||
this(IIOUtil.getProviderInfo(PNMImageReaderSpi.class));
|
||||
this(new PNMProviderInfo());
|
||||
}
|
||||
|
||||
private PNMImageReaderSpi(final ProviderInfo providerInfo) {
|
||||
super(
|
||||
providerInfo.getVendorName(),
|
||||
providerInfo.getVersion(),
|
||||
new String[]{
|
||||
"pnm", "pbm", "pgm", "ppm", "pam",
|
||||
"PNM", "PBM", "PGM", "PPM", "PAM"
|
||||
new String[] {
|
||||
"pnm", "pbm", "pgm", "ppm", "pam", "pfm",
|
||||
"PNM", "PBM", "PGM", "PPM", "PAM", "PFM"
|
||||
},
|
||||
new String[]{"pbm", "pgm", "ppm", "pam"},
|
||||
new String[]{
|
||||
new String[] {"pbm", "pgm", "ppm", "pam", "pfm"},
|
||||
new String[] {
|
||||
// No official IANA record exists, these are conventional
|
||||
"image/x-portable-pixmap",
|
||||
"image/x-portable-anymap",
|
||||
@@ -63,7 +62,7 @@ public final class PNMImageReaderSpi extends ImageReaderSpi {
|
||||
},
|
||||
"com.twelvemkonkeys.imageio.plugins.pnm.PNMImageReader",
|
||||
new Class[] {ImageInputStream.class},
|
||||
new String[]{
|
||||
new String[] {
|
||||
"com.twelvemkonkeys.imageio.plugins.pnm.PNMImageWriterSpi",
|
||||
"com.twelvemkonkeys.imageio.plugins.pnm.PAMImageWriterSpi"
|
||||
},
|
||||
@@ -76,7 +75,8 @@ public final class PNMImageReaderSpi extends ImageReaderSpi {
|
||||
);
|
||||
}
|
||||
|
||||
@Override public boolean canDecodeInput(final Object source) throws IOException {
|
||||
@Override
|
||||
public boolean canDecodeInput(final Object source) throws IOException {
|
||||
if (!(source instanceof ImageInputStream)) {
|
||||
return false;
|
||||
}
|
||||
@@ -109,11 +109,13 @@ public final class PNMImageReaderSpi extends ImageReaderSpi {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public ImageReader createReaderInstance(final Object extension) throws IOException {
|
||||
@Override
|
||||
public ImageReader createReaderInstance(final Object extension) throws IOException {
|
||||
return new PNMImageReader(this);
|
||||
}
|
||||
|
||||
@Override public String getDescription(final Locale locale) {
|
||||
@Override
|
||||
public String getDescription(final Locale locale) {
|
||||
return "NetPBM Portable Any Map (PNM and PAM) image reader";
|
||||
}
|
||||
}
|
||||
|
@@ -29,7 +29,6 @@
|
||||
package com.twelvemonkeys.imageio.plugins.pnm;
|
||||
|
||||
import com.twelvemonkeys.imageio.spi.ProviderInfo;
|
||||
import com.twelvemonkeys.imageio.util.IIOUtil;
|
||||
|
||||
import javax.imageio.ImageTypeSpecifier;
|
||||
import javax.imageio.ImageWriter;
|
||||
@@ -41,23 +40,24 @@ public final class PNMImageWriterSpi extends ImageWriterSpi {
|
||||
|
||||
// TODO: Consider one Spi for each sub-format, as it makes no sense for the writer to write PPM if client code requested PBM or PGM format.
|
||||
// ...Then again, what if user asks for PNM? :-P
|
||||
|
||||
/**
|
||||
* Creates a {@code PNMImageWriterSpi}.
|
||||
*/
|
||||
public PNMImageWriterSpi() {
|
||||
this(IIOUtil.getProviderInfo(PNMImageWriterSpi.class));
|
||||
this(new PNMProviderInfo());
|
||||
}
|
||||
|
||||
private PNMImageWriterSpi(final ProviderInfo pProviderInfo) {
|
||||
super(
|
||||
pProviderInfo.getVendorName(),
|
||||
pProviderInfo.getVersion(),
|
||||
new String[]{
|
||||
new String[] {
|
||||
"pnm", "pbm", "pgm", "ppm",
|
||||
"PNM", "PBM", "PGM", "PPM"
|
||||
},
|
||||
new String[]{"pbm", "pgm", "ppm"},
|
||||
new String[]{
|
||||
new String[] {"pbm", "pgm", "ppm"},
|
||||
new String[] {
|
||||
// No official IANA record exists, these are conventional
|
||||
"image/x-portable-pixmap",
|
||||
"image/x-portable-anymap"
|
||||
@@ -79,7 +79,8 @@ public final class PNMImageWriterSpi extends ImageWriterSpi {
|
||||
return new PNMImageWriter(this);
|
||||
}
|
||||
|
||||
@Override public String getDescription(final Locale locale) {
|
||||
@Override
|
||||
public String getDescription(final Locale locale) {
|
||||
return "NetPBM Portable Any Map (PNM) image writer";
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package com.twelvemonkeys.imageio.plugins.pnm;
|
||||
|
||||
import com.twelvemonkeys.imageio.spi.ProviderInfo;
|
||||
|
||||
/**
|
||||
* PNMProviderInfo.
|
||||
*
|
||||
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
|
||||
* @author last modified by $Author: harald.kuhr$
|
||||
* @version $Id: PNMProviderInfo.java,v 1.0 20/03/15 harald.kuhr Exp$
|
||||
*/
|
||||
class PNMProviderInfo extends ProviderInfo {
|
||||
// NOTE: Because the ReaderSpi and the two WriterSpis supports different formats,
|
||||
// we don't use the standard ImageReaderWriterProviderInfo superclass here.
|
||||
|
||||
public PNMProviderInfo() {
|
||||
super(PNMProviderInfo.class.getPackage());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user