2018-06-11 22:41:11 +02:00
|
|
|
package ar.com.hjg.pngj;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Trivial extension of {@link PngReader} that uses {@link ImageLineInt}.
|
|
|
|
* <p>
|
2018-09-22 11:17:30 +02:00
|
|
|
* In the current implementation this is quite dummy/redundant, because (for
|
|
|
|
* backward compatibility) PngReader already
|
2018-06-11 22:41:11 +02:00
|
|
|
* uses a {@link ImageLineInt}.
|
|
|
|
* <p>
|
2018-09-22 11:17:30 +02:00
|
|
|
* The factory is set at construction time. Remember that this could still be
|
|
|
|
* changed at runtime.
|
2018-06-11 22:41:11 +02:00
|
|
|
*/
|
|
|
|
public class PngReaderInt extends PngReader {
|
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
public PngReaderInt(final File file) {
|
|
|
|
super(file); // not necessary to set factory, PngReader already does that
|
|
|
|
}
|
2018-06-11 22:41:11 +02:00
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
public PngReaderInt(final InputStream inputStream) {
|
|
|
|
super(inputStream);
|
|
|
|
}
|
2018-06-11 22:41:11 +02:00
|
|
|
|
2018-09-22 11:17:30 +02:00
|
|
|
/**
|
|
|
|
* Utility method that casts the IImageLine to a ImageLineInt
|
|
|
|
*
|
|
|
|
* This only make sense for this concrete class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public ImageLineInt readRowInt() {
|
|
|
|
final IImageLine line = readRow();
|
|
|
|
if (line instanceof ImageLineInt)
|
|
|
|
return (ImageLineInt) line;
|
|
|
|
else
|
|
|
|
throw new PngjException("This is not a ImageLineInt : " + line.getClass());
|
|
|
|
}
|
2018-06-11 22:41:11 +02:00
|
|
|
}
|