You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/04/26 21:52:36 UTC
(commons-imaging) 03/03: Rename abstract classes to Abstract*
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit faef3de29cdf5bfd41bcb7079edd693d12181dbf
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Apr 26 17:49:13 2025 -0400
Rename abstract classes to Abstract*
---
src/conf/spotbugs-exclude-filter.xml | 2 +-
...Stream.java => AbstractBinaryOutputStream.java} | 6 +--
.../common/BigEndianBinaryOutputStream.java | 2 +-
.../common/LittleEndianBinaryOutputStream.java | 2 +-
.../imaging/formats/bmp/BmpImageParser.java | 4 +-
.../commons/imaging/formats/bmp/BmpWriter.java | 4 +-
.../imaging/formats/bmp/BmpWriterPalette.java | 4 +-
.../commons/imaging/formats/bmp/BmpWriterRgb.java | 4 +-
.../imaging/formats/dcx/DcxImageParser.java | 4 +-
.../imaging/formats/gif/GifImageParser.java | 4 +-
.../imaging/formats/icns/IcnsImageParser.java | 4 +-
.../imaging/formats/ico/IcoImageParser.java | 6 +--
.../imaging/formats/jpeg/JpegImageParser.java | 8 ++--
.../imaging/formats/jpeg/iptc/IptcParser.java | 6 +--
...ricSegment.java => AbstractGenericSegment.java} | 8 ++--
.../imaging/formats/jpeg/segments/AppnSegment.java | 2 +-
.../imaging/formats/jpeg/segments/ComSegment.java | 2 +-
.../formats/jpeg/segments/UnknownSegment.java | 2 +-
.../commons/imaging/formats/pcx/PcxWriter.java | 8 ++--
.../commons/imaging/formats/pcx/RleWriter.java | 6 +--
.../imaging/formats/psd/PsdImageParser.java | 4 +-
.../{DataParser.java => AbstractDataParser.java} | 2 +-
.../formats/psd/dataparsers/DataParserBitmap.java | 2 +-
.../formats/psd/dataparsers/DataParserCmyk.java | 2 +-
.../psd/dataparsers/DataParserGrayscale.java | 2 +-
.../formats/psd/dataparsers/DataParserIndexed.java | 2 +-
.../formats/psd/dataparsers/DataParserLab.java | 2 +-
.../formats/psd/dataparsers/DataParserRgb.java | 2 +-
.../formats/psd/dataparsers/DataParserStub.java | 2 +-
.../psd/datareaders/CompressedDataReader.java | 6 +--
.../psd/datareaders/UncompressedDataReader.java | 6 +--
.../formats/tiff/AbstractTiffImageData.java | 22 +++++-----
...RasterData.java => AbstractTiffRasterData.java} | 4 +-
.../imaging/formats/tiff/TiffDirectory.java | 2 +-
.../imaging/formats/tiff/TiffImageParser.java | 51 +++++-----------------
.../formats/tiff/TiffImagingParameters.java | 8 ++--
.../imaging/formats/tiff/TiffRasterDataFloat.java | 2 +-
.../imaging/formats/tiff/TiffRasterDataInt.java | 2 +-
.../imaging/formats/tiff/TiffRasterStatistics.java | 2 +-
...ataReader.java => AbstractImageDataReader.java} | 16 +++----
.../formats/tiff/datareaders/DataReaderStrips.java | 16 +++----
.../formats/tiff/datareaders/DataReaderTiled.java | 21 ++++-----
...er.java => AbstractPhotometricInterpreter.java} | 4 +-
.../PhotometricInterpreterBiLevel.java | 2 +-
.../PhotometricInterpreterCieLab.java | 2 +-
.../PhotometricInterpreterCmyk.java | 2 +-
.../PhotometricInterpreterLogLuv.java | 2 +-
.../PhotometricInterpreterPalette.java | 2 +-
.../PhotometricInterpreterRgb.java | 2 +-
.../PhotometricInterpreterYCbCr.java | 2 +-
.../floatingpoint/PhotometricInterpreterFloat.java | 4 +-
.../tiff/write/AbstractTiffImageWriter.java | 6 +--
.../formats/tiff/write/AbstractTiffOutputItem.java | 6 +--
.../tiff/write/TiffImageWriterLossless.java | 6 +--
.../formats/tiff/write/TiffImageWriterLossy.java | 6 +--
.../formats/tiff/write/TiffOutputDirectory.java | 4 +-
.../formats/tiff/write/TiffOutputField.java | 4 +-
.../imaging/formats/webp/WebPChunkType.java | 6 +--
.../imaging/formats/webp/WebPImageParser.java | 16 +++----
.../{WebPChunk.java => AbstractWebPChunk.java} | 6 +--
.../imaging/formats/webp/chunks/WebPChunkAlph.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkAnim.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkAnmf.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkExif.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkIccp.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkVp8.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkVp8l.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkVp8x.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkXml.java | 2 +-
.../imaging/formats/webp/chunks/WebPChunkXyzw.java | 2 +-
.../tiff/ExampleReadFloatingPointData.java | 4 +-
.../{IcnsBaseTest.java => AbstractIcnsTest.java} | 4 +-
.../commons/imaging/formats/icns/IcnsReadTest.java | 2 +-
.../imaging/formats/icns/IcnsRoundTripTest.java | 20 ++++-----
.../imaging/formats/ico/IcoRoundtripTest.java | 39 ++++++++---------
.../{JpegBaseTest.java => AbstractJpegTest.java} | 4 +-
.../commons/imaging/formats/jpeg/JpegReadTest.java | 2 +-
.../{IptcBaseTest.java => AbstractIptcTest.java} | 4 +-
.../imaging/formats/jpeg/iptc/IptcAddTest.java | 2 +-
.../imaging/formats/jpeg/iptc/IptcDumpTest.java | 2 +-
.../imaging/formats/jpeg/iptc/IptcParserTest.java | 6 +--
.../imaging/formats/jpeg/iptc/IptcUpdateTest.java | 2 +-
.../{RgbeBaseTest.java => AbstractRgbeTest.java} | 4 +-
.../commons/imaging/formats/rgbe/RgbeReadTest.java | 2 +-
.../{TiffBaseTest.java => AbstractTiffTest.java} | 4 +-
.../imaging/formats/tiff/TiffBigTiffTest.java | 2 +-
.../imaging/formats/tiff/TiffCcittTest.java | 2 +-
.../tiff/TiffFloatingPointMultivariableTest.java | 4 +-
.../formats/tiff/TiffFloatingPointReadTest.java | 8 ++--
.../tiff/TiffFloatingPointRoundTripTest.java | 2 +-
.../commons/imaging/formats/tiff/TiffJpegTest.java | 2 +-
.../commons/imaging/formats/tiff/TiffLzwTest.java | 2 +-
.../formats/tiff/TiffRasterDataIntTest.java | 10 ++---
.../imaging/formats/tiff/TiffRasterDataTest.java | 8 ++--
.../formats/tiff/TiffRasterStatisticsTest.java | 4 +-
.../formats/tiff/TiffReadImageInfoTest.java | 2 +-
.../commons/imaging/formats/tiff/TiffReadTest.java | 2 +-
.../formats/tiff/TiffReadWriteTagsTest.java | 2 +-
.../formats/tiff/TiffRoundTripInt32Test.java | 6 +--
.../imaging/formats/tiff/TiffRoundtripTest.java | 2 +-
.../formats/tiff/TiffShortIntRoundTripTest.java | 6 +--
.../imaging/formats/tiff/TiffSubImageTest.java | 2 +-
.../{WbmpBaseTest.java => AbstractWbmpTest.java} | 4 +-
.../commons/imaging/formats/wbmp/WbmpReadTest.java | 2 +-
.../{WebPBaseTest.java => AbstractWebPTest.java} | 4 +-
.../commons/imaging/formats/webp/WebPDumpTest.java | 2 +-
.../imaging/formats/webp/WebPMetadataTest.java | 2 +-
.../commons/imaging/formats/webp/WebPReadTest.java | 2 +-
.../xbm/{XbmBaseTest.java => AbstractXbmTest.java} | 4 +-
.../commons/imaging/formats/xbm/XbmReadTest.java | 2 +-
110 files changed, 263 insertions(+), 294 deletions(-)
diff --git a/src/conf/spotbugs-exclude-filter.xml b/src/conf/spotbugs-exclude-filter.xml
index 03c58cad..c86373d3 100644
--- a/src/conf/spotbugs-exclude-filter.xml
+++ b/src/conf/spotbugs-exclude-filter.xml
@@ -80,7 +80,7 @@
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
- <Class name="org.apache.commons.imaging.formats.tiff.datareaders.ImageDataReader" />
+ <Class name="org.apache.commons.imaging.formats.tiff.datareaders.AbstractImageDataReader" />
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
diff --git a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java b/src/main/java/org/apache/commons/imaging/common/AbstractBinaryOutputStream.java
similarity index 88%
rename from src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
rename to src/main/java/org/apache/commons/imaging/common/AbstractBinaryOutputStream.java
index 994f8439..cc40f167 100644
--- a/src/main/java/org/apache/commons/imaging/common/BinaryOutputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/AbstractBinaryOutputStream.java
@@ -22,14 +22,14 @@ import java.io.OutputStream;
import java.nio.ByteOrder;
import java.util.Objects;
-public abstract class BinaryOutputStream extends FilterOutputStream {
+public abstract class AbstractBinaryOutputStream extends FilterOutputStream {
public static BigEndianBinaryOutputStream bigEndian(final OutputStream outputStream) {
return new BigEndianBinaryOutputStream(outputStream);
}
@SuppressWarnings("resource")
- public static BinaryOutputStream create(final OutputStream outputStream, final ByteOrder byteOrder) {
+ public static AbstractBinaryOutputStream create(final OutputStream outputStream, final ByteOrder byteOrder) {
Objects.requireNonNull(outputStream, "outputStream");
Objects.requireNonNull(byteOrder, "byteOrder");
if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
@@ -45,7 +45,7 @@ public abstract class BinaryOutputStream extends FilterOutputStream {
return new LittleEndianBinaryOutputStream(outputStream);
}
- public BinaryOutputStream(final OutputStream outputStream) {
+ public AbstractBinaryOutputStream(final OutputStream outputStream) {
super(outputStream);
}
diff --git a/src/main/java/org/apache/commons/imaging/common/BigEndianBinaryOutputStream.java b/src/main/java/org/apache/commons/imaging/common/BigEndianBinaryOutputStream.java
index df2e2ab5..22164bef 100644
--- a/src/main/java/org/apache/commons/imaging/common/BigEndianBinaryOutputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/BigEndianBinaryOutputStream.java
@@ -20,7 +20,7 @@ package org.apache.commons.imaging.common;
import java.io.IOException;
import java.io.OutputStream;
-final class BigEndianBinaryOutputStream extends BinaryOutputStream {
+final class BigEndianBinaryOutputStream extends AbstractBinaryOutputStream {
BigEndianBinaryOutputStream(final OutputStream os) {
super(os);
diff --git a/src/main/java/org/apache/commons/imaging/common/LittleEndianBinaryOutputStream.java b/src/main/java/org/apache/commons/imaging/common/LittleEndianBinaryOutputStream.java
index 026e275b..171f7ee8 100644
--- a/src/main/java/org/apache/commons/imaging/common/LittleEndianBinaryOutputStream.java
+++ b/src/main/java/org/apache/commons/imaging/common/LittleEndianBinaryOutputStream.java
@@ -20,7 +20,7 @@ package org.apache.commons.imaging.common;
import java.io.IOException;
import java.io.OutputStream;
-final class LittleEndianBinaryOutputStream extends BinaryOutputStream {
+final class LittleEndianBinaryOutputStream extends AbstractBinaryOutputStream {
LittleEndianBinaryOutputStream(final OutputStream os) {
super(os);
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
index 08333f76..c5468e3e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpImageParser.java
@@ -42,7 +42,7 @@ import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.PixelDensity;
import org.apache.commons.imaging.bytesource.ByteSource;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.ImageBuilder;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.palette.PaletteFactory;
@@ -633,7 +633,7 @@ public class BmpImageParser extends AbstractImageParser<BmpImagingParameters> {
}
final byte[] imageData = writer.getImageData(src);
- final BinaryOutputStream bos = BinaryOutputStream.littleEndian(os);
+ final AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(os);
// write BitmapFileHeader
os.write(0x42); // B, Windows 3.1x, 95, NT, Bitmap
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriter.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriter.java
index e95ce7c3..3c11484f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriter.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.bmp;
import java.awt.image.BufferedImage;
import java.io.IOException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
interface BmpWriter {
@@ -29,5 +29,5 @@ interface BmpWriter {
int getPaletteSize();
- void writePalette(BinaryOutputStream bos) throws IOException;
+ void writePalette(AbstractBinaryOutputStream bos) throws IOException;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterPalette.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterPalette.java
index 760e3595..aac332bf 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterPalette.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterPalette.java
@@ -20,7 +20,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.palette.SimplePalette;
final class BmpWriterPalette implements BmpWriter {
@@ -103,7 +103,7 @@ final class BmpWriterPalette implements BmpWriter {
}
@Override
- public void writePalette(final BinaryOutputStream bos) throws IOException {
+ public void writePalette(final AbstractBinaryOutputStream bos) throws IOException {
for (int i = 0; i < palette.length(); i++) {
final int rgb = palette.getEntry(i);
diff --git a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgb.java b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgb.java
index e7119b19..40a9005e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgb.java
+++ b/src/main/java/org/apache/commons/imaging/formats/bmp/BmpWriterRgb.java
@@ -20,7 +20,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
final class BmpWriterRgb implements BmpWriter {
// private final boolean alpha;
@@ -76,7 +76,7 @@ final class BmpWriterRgb implements BmpWriter {
}
@Override
- public void writePalette(final BinaryOutputStream bos) throws IOException {
+ public void writePalette(final AbstractBinaryOutputStream bos) throws IOException {
// no palette
}
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
index 773082ca..96498069 100644
--- a/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/dcx/DcxImageParser.java
@@ -34,8 +34,8 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.formats.pcx.PcxImageParser;
import org.apache.commons.imaging.formats.pcx.PcxImagingParameters;
@@ -175,7 +175,7 @@ public class DcxImageParser extends AbstractImageParser<PcxImagingParameters> {
public void writeImage(final BufferedImage src, final OutputStream os, final PcxImagingParameters params) throws ImagingException, IOException {
final int headerSize = 4 + 1024 * 4;
- final BinaryOutputStream bos = BinaryOutputStream.littleEndian(os);
+ final AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(os);
bos.write4Bytes(DcxHeader.DCX_ID);
// Some apps may need a full 1024 entry table
bos.write4Bytes(headerSize);
diff --git a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
index 90d5750d..1e635fc9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/gif/GifImageParser.java
@@ -37,9 +37,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.BinaryFunctions;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.ImageBuilder;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.common.XmpEmbeddable;
@@ -874,7 +874,7 @@ public class GifImageParser extends AbstractImageParser<GifImagingParameters> im
}
final int paletteSize = palette2.length() + (hasAlpha ? 1 : 0);
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(os)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(os)) {
// write Header
os.write(0x47); // G magic numbers
diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
index 7e8f6bea..782c4b9b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsImageParser.java
@@ -34,7 +34,7 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.ImageInfo;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.ImageMetadata;
public class IcnsImageParser extends AbstractImageParser<IcnsImagingParameters> {
@@ -244,7 +244,7 @@ public class IcnsImageParser extends AbstractImageParser<IcnsImagingParameters>
throw new ImagingException("Invalid/unsupported source width " + src.getWidth() + " and height " + src.getHeight());
}
- try (BinaryOutputStream bos = BinaryOutputStream.bigEndian(os)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(os)) {
bos.write4Bytes(ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 4 * imageType.getWidth() * imageType.getHeight() + 4 + 4 + imageType.getWidth() * imageType.getHeight());
diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
index 7a496f06..022d24e0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
@@ -40,8 +40,8 @@ import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.PixelDensity;
import org.apache.commons.imaging.bytesource.ByteSource;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.formats.bmp.BmpImageParser;
import org.apache.commons.imaging.palette.PaletteFactory;
@@ -423,7 +423,7 @@ public class IcoImageParser extends AbstractImageParser<IcoImagingParameters> {
final int bitmapSize = 14 + 56 + restOfFile.length;
final ByteArrayOutputStream baos = new ByteArrayOutputStream(Allocator.checkByteArray(bitmapSize));
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
bos.write('B');
bos.write('M');
bos.write4Bytes(bitmapSize);
@@ -625,7 +625,7 @@ public class IcoImageParser extends AbstractImageParser<IcoImagingParameters> {
bitCount = 8;
}
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(os)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(os)) {
int scanlineSize = (bitCount * src.getWidth() + 7) / 8;
if (scanlineSize % 4 != 0) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
index 9ca17038..f62f015e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
@@ -44,13 +44,13 @@ import org.apache.commons.imaging.common.XmpImagingParameters;
import org.apache.commons.imaging.formats.jpeg.decoder.JpegDecoder;
import org.apache.commons.imaging.formats.jpeg.iptc.IptcParser;
import org.apache.commons.imaging.formats.jpeg.iptc.PhotoshopApp13Data;
+import org.apache.commons.imaging.formats.jpeg.segments.AbstractGenericSegment;
import org.apache.commons.imaging.formats.jpeg.segments.AbstractSegment;
import org.apache.commons.imaging.formats.jpeg.segments.App13Segment;
import org.apache.commons.imaging.formats.jpeg.segments.App14Segment;
import org.apache.commons.imaging.formats.jpeg.segments.App2Segment;
import org.apache.commons.imaging.formats.jpeg.segments.ComSegment;
import org.apache.commons.imaging.formats.jpeg.segments.DqtSegment;
-import org.apache.commons.imaging.formats.jpeg.segments.GenericSegment;
import org.apache.commons.imaging.formats.jpeg.segments.JfifSegment;
import org.apache.commons.imaging.formats.jpeg.segments.SofnSegment;
import org.apache.commons.imaging.formats.jpeg.segments.UnknownSegment;
@@ -70,7 +70,7 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
private static final String DEFAULT_EXTENSION = ImageFormats.JPEG.getDefaultExtension();
private static final String[] ACCEPTED_EXTENSIONS = ImageFormats.JPEG.getExtensions();
- public static boolean isExifApp1Segment(final GenericSegment segment) {
+ public static boolean isExifApp1Segment(final AbstractGenericSegment segment) {
return JpegConstants.EXIF_IDENTIFIER_CODE.isStartOf(segment.getSegmentData());
}
@@ -190,7 +190,7 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
final List<AbstractSegment> result = new ArrayList<>();
for (final AbstractSegment s : abstractSegments) {
- final GenericSegment segment = (GenericSegment) s;
+ final AbstractGenericSegment segment = (AbstractGenericSegment) s;
if (isExifApp1Segment(segment)) {
result.add(segment);
}
@@ -264,7 +264,7 @@ public class JpegImageParser extends AbstractImageParser<JpegImagingParameters>
"Imaging currently can't parse EXIF metadata split across multiple APP1 segments. " + "Please send this image to the Imaging project.");
}
- final GenericSegment segment = (GenericSegment) exifSegments.get(0);
+ final AbstractGenericSegment segment = (AbstractGenericSegment) exifSegments.get(0);
final byte[] bytes = segment.getSegmentData();
// byte[] head = readBytearray("exif head", bytes, 0, 6);
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
index cac55442..1e63118d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
@@ -35,10 +35,10 @@ import java.util.logging.Logger;
import org.apache.commons.imaging.ImagingConstants;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.ImagingParameters;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.BinaryFileParser;
import org.apache.commons.imaging.common.BinaryFunctions;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.ByteConversions;
import org.apache.commons.imaging.formats.jpeg.JpegConstants;
import org.apache.commons.imaging.formats.jpeg.JpegImagingParameters;
@@ -396,7 +396,7 @@ public class IptcParser extends BinaryFileParser {
}
}
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.create(baos, getByteOrder())) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.create(baos, getByteOrder())) {
if (!charset.equals(DEFAULT_CHARSET)) {
bos.write(IptcConstants.IPTC_RECORD_TAG_MARKER);
bos.write(IptcConstants.IPTC_ENVELOPE_RECORD_NUMBER);
@@ -451,7 +451,7 @@ public class IptcParser extends BinaryFileParser {
public byte[] writePhotoshopApp13Segment(final PhotoshopApp13Data data) throws IOException, ImagingException {
try (ByteArrayOutputStream os = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(os)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(os)) {
JpegConstants.PHOTOSHOP_IDENTIFICATION_STRING.writeTo(bos);
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AbstractGenericSegment.java
similarity index 88%
rename from src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
rename to src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AbstractGenericSegment.java
index aea0c6fc..5e93ae0c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AbstractGenericSegment.java
@@ -23,16 +23,16 @@ import java.io.InputStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
-public abstract class GenericSegment extends AbstractSegment {
+public abstract class AbstractGenericSegment extends AbstractSegment {
private final byte[] segmentData;
- public GenericSegment(final int marker, final byte[] bytes) {
+ public AbstractGenericSegment(final int marker, final byte[] bytes) {
super(marker, bytes.length);
this.segmentData = bytes.clone();
}
- public GenericSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
+ public AbstractGenericSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
super(marker, markerLength);
segmentData = readBytes("Segment Data", is, markerLength, "Invalid Segment: insufficient data");
@@ -62,7 +62,7 @@ public abstract class GenericSegment extends AbstractSegment {
* Returns a specific byte of the segment's contents, excluding the marker and length bytes at the beginning.
*
* @param offset segment offset
- * @see GenericSegment#getSegmentData()
+ * @see AbstractGenericSegment#getSegmentData()
* @return the bye in the segment's contents
*/
protected byte getSegmentData(final int offset) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
index c6f3bd69..64bc653a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/AppnSegment.java
@@ -21,7 +21,7 @@ import java.io.InputStream;
import org.apache.commons.imaging.formats.jpeg.JpegConstants;
-public class AppnSegment extends GenericSegment {
+public class AppnSegment extends AbstractGenericSegment {
public AppnSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
super(marker, markerLength, is);
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
index 75cd9dd2..181d9dc5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
@@ -20,7 +20,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
-public class ComSegment extends GenericSegment {
+public class ComSegment extends AbstractGenericSegment {
public ComSegment(final int marker, final byte[] segmentData) {
super(marker, segmentData);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
index ca01be2c..94ea8013 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/UnknownSegment.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.jpeg.segments;
import java.io.IOException;
import java.io.InputStream;
-public class UnknownSegment extends GenericSegment {
+public class UnknownSegment extends AbstractGenericSegment {
public UnknownSegment(final int marker, final byte[] bytes) {
super(marker, bytes);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
index d933f40f..58a02d21 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
@@ -21,8 +21,8 @@ import java.io.OutputStream;
import java.util.Arrays;
import org.apache.commons.imaging.PixelDensity;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.palette.PaletteFactory;
import org.apache.commons.imaging.palette.SimplePalette;
@@ -52,7 +52,7 @@ final class PcxWriter {
public void writeImage(final BufferedImage src, final OutputStream os) throws IOException {
final PaletteFactory paletteFactory = new PaletteFactory();
final SimplePalette palette = paletteFactory.makeExactRgbPaletteSimple(src, 256);
- final BinaryOutputStream bos = BinaryOutputStream.littleEndian(os);
+ final AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(os);
final int bitDepth;
final int planes;
if (palette == null || bitDepthWanted == 24 || bitDepthWanted == 32) {
@@ -173,7 +173,7 @@ final class PcxWriter {
}
private void writePixels(final BufferedImage src, final int bitDepth, final int planes, final int bytesPerLine, final SimplePalette palette,
- final BinaryOutputStream bos) throws IOException {
+ final AbstractBinaryOutputStream bos) throws IOException {
final byte[] plane0 = Allocator.byteArray(bytesPerLine);
final byte[] plane1 = Allocator.byteArray(bytesPerLine);
final byte[] plane2 = Allocator.byteArray(bytesPerLine);
@@ -254,7 +254,7 @@ final class PcxWriter {
rleWriter.flush(bos);
}
- private void writePixels32(final BufferedImage src, final int bytesPerLine, final BinaryOutputStream bos) throws IOException {
+ private void writePixels32(final BufferedImage src, final int bytesPerLine, final AbstractBinaryOutputStream bos) throws IOException {
final int[] rgbs = Allocator.intArray(src.getWidth());
final byte[] plane = Allocator.byteArray(4 * bytesPerLine);
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java b/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
index 3b4e6bbc..bb72a2c2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
@@ -17,7 +17,7 @@ package org.apache.commons.imaging.formats.pcx;
import java.io.IOException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
final class RleWriter {
private final boolean isCompressed;
@@ -28,7 +28,7 @@ final class RleWriter {
this.isCompressed = isCompressed;
}
- void flush(final BinaryOutputStream bos) throws IOException {
+ void flush(final AbstractBinaryOutputStream bos) throws IOException {
if (repeatCount > 0) {
if (repeatCount != 1 || (previousByte & 0xc0) == 0xc0) {
bos.write(0xc0 | repeatCount);
@@ -37,7 +37,7 @@ final class RleWriter {
}
}
- void write(final BinaryOutputStream bos, final byte[] samples) throws IOException {
+ void write(final AbstractBinaryOutputStream bos, final byte[] samples) throws IOException {
if (isCompressed) {
for (final byte element : samples) {
if ((element & 0xff) == previousByte && repeatCount < 63) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
index 4dfb543f..2dbd7143 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/PsdImageParser.java
@@ -36,7 +36,7 @@ import org.apache.commons.imaging.common.BinaryFunctions;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.common.XmpEmbeddable;
import org.apache.commons.imaging.common.XmpImagingParameters;
-import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
+import org.apache.commons.imaging.formats.psd.dataparsers.AbstractDataParser;
import org.apache.commons.imaging.formats.psd.dataparsers.DataParserBitmap;
import org.apache.commons.imaging.formats.psd.dataparsers.DataParserCmyk;
import org.apache.commons.imaging.formats.psd.dataparsers.DataParserGrayscale;
@@ -151,7 +151,7 @@ public class PsdImageParser extends AbstractImageParser<PsdImagingParameters> im
final boolean hasAlpha = false;
final BufferedImage result = getBufferedImageFactory(params).getColorBufferedImage(width, height, hasAlpha);
- final DataParser dataParser;
+ final AbstractDataParser dataParser;
switch (imageContents.header.mode) {
case 0: // bitmap
dataParser = new DataParserBitmap();
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/AbstractDataParser.java
similarity index 97%
rename from src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java
rename to src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/AbstractDataParser.java
index 74ed22c9..819a3ef6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/AbstractDataParser.java
@@ -22,7 +22,7 @@ import java.awt.image.DataBuffer;
import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public abstract class DataParser {
+public abstract class AbstractDataParser {
public abstract int getBasicChannelsCount();
protected abstract int getRgb(int[][][] data, int x, int y, PsdImageContents imageContents);
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
index 2f727cce..af09d26b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserBitmap.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserBitmap extends DataParser {
+public class DataParserBitmap extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
index 4941a449..c0a457c3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserCmyk.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserCmyk extends DataParser {
+public class DataParserCmyk extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
return 4;
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
index e45c965d..63ee8d82 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserGrayscale.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserGrayscale extends DataParser {
+public class DataParserGrayscale extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
return 1;
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
index 046f2a03..0798ce78 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserIndexed.java
@@ -20,7 +20,7 @@ import java.util.Arrays;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserIndexed extends DataParser {
+public class DataParserIndexed extends AbstractDataParser {
private final int[] colorTable;
public DataParserIndexed(final byte[] colorModeData) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
index be28c3d7..ffdb22b1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserLab.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserLab extends DataParser {
+public class DataParserLab extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
index 7f803d50..350f162e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserRgb.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserRgb extends DataParser {
+public class DataParserRgb extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
return 3;
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java
index 97facb70..fc197e5a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/dataparsers/DataParserStub.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.psd.dataparsers;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-public class DataParserStub extends DataParser {
+public class DataParserStub extends AbstractDataParser {
@Override
public int getBasicChannelsCount() {
return 1;
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
index 88710c7f..3117dd17 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/CompressedDataReader.java
@@ -29,15 +29,15 @@ import org.apache.commons.imaging.common.BinaryFunctions;
import org.apache.commons.imaging.common.PackBits;
import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
+import org.apache.commons.imaging.formats.psd.dataparsers.AbstractDataParser;
import org.apache.commons.imaging.mylzw.BitsToByteInputStream;
import org.apache.commons.imaging.mylzw.MyBitInputStream;
public class CompressedDataReader implements DataReader {
- private final DataParser dataParser;
+ private final AbstractDataParser dataParser;
- public CompressedDataReader(final DataParser dataParser) {
+ public CompressedDataReader(final AbstractDataParser dataParser) {
this.dataParser = dataParser;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
index b1ce2322..e3677686 100644
--- a/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/psd/datareaders/UncompressedDataReader.java
@@ -26,15 +26,15 @@ import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.BinaryFileParser;
import org.apache.commons.imaging.formats.psd.PsdHeaderInfo;
import org.apache.commons.imaging.formats.psd.PsdImageContents;
-import org.apache.commons.imaging.formats.psd.dataparsers.DataParser;
+import org.apache.commons.imaging.formats.psd.dataparsers.AbstractDataParser;
import org.apache.commons.imaging.mylzw.BitsToByteInputStream;
import org.apache.commons.imaging.mylzw.MyBitInputStream;
public class UncompressedDataReader implements DataReader {
- private final DataParser dataParser;
+ private final AbstractDataParser dataParser;
- public UncompressedDataReader(final DataParser dataParser) {
+ public UncompressedDataReader(final AbstractDataParser dataParser) {
this.dataParser = dataParser;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
index e4f6dbc6..5a4a4929 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffImageData.java
@@ -22,10 +22,10 @@ import java.nio.ByteOrder;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
+import org.apache.commons.imaging.formats.tiff.datareaders.AbstractImageDataReader;
import org.apache.commons.imaging.formats.tiff.datareaders.DataReaderStrips;
import org.apache.commons.imaging.formats.tiff.datareaders.DataReaderTiled;
-import org.apache.commons.imaging.formats.tiff.datareaders.ImageDataReader;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
public abstract class AbstractTiffImageData {
@@ -54,9 +54,9 @@ public abstract class AbstractTiffImageData {
}
@Override
- public ImageDataReader getDataReader(final TiffDirectory directory, final PhotometricInterpreter photometricInterpreter, final int bitsPerPixel,
- final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int width, final int height, final int compression,
- final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteorder) throws IOException, ImagingException {
+ public AbstractImageDataReader getDataReader(final TiffDirectory directory, final AbstractPhotometricInterpreter photometricInterpreter,
+ final int bitsPerPixel, final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int width, final int height,
+ final int compression, final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteorder) throws IOException, ImagingException {
final int sampleFormat = extractSampleFormat(directory);
return new DataReaderStrips(directory, photometricInterpreter, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel, sampleFormat, width, height,
compression, planarConfiguration, byteorder, rowsPerStrip, this);
@@ -97,9 +97,9 @@ public abstract class AbstractTiffImageData {
}
@Override
- public ImageDataReader getDataReader(final TiffDirectory directory, final PhotometricInterpreter photometricInterpreter, final int bitsPerPixel,
- final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int width, final int height, final int compression,
- final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteOrder) throws IOException, ImagingException {
+ public AbstractImageDataReader getDataReader(final TiffDirectory directory, final AbstractPhotometricInterpreter photometricInterpreter,
+ final int bitsPerPixel, final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int width, final int height,
+ final int compression, final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteOrder) throws IOException, ImagingException {
final int sampleFormat = extractSampleFormat(directory);
return new DataReaderTiled(directory, photometricInterpreter, tileWidth, tileLength, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
sampleFormat, width, height, compression, planarConfiguration, byteOrder, this);
@@ -149,9 +149,9 @@ public abstract class AbstractTiffImageData {
return 0; // unspecified format
}
- public abstract ImageDataReader getDataReader(TiffDirectory directory, PhotometricInterpreter photometricInterpreter, int bitsPerPixel, int[] bitsPerSample,
- int predictor, int samplesPerPixel, int width, int height, int compression, TiffPlanarConfiguration planarConfiguration, ByteOrder byteOrder)
- throws IOException, ImagingException;
+ public abstract AbstractImageDataReader getDataReader(TiffDirectory directory, AbstractPhotometricInterpreter photometricInterpreter, int bitsPerPixel,
+ int[] bitsPerSample, int predictor, int samplesPerPixel, int width, int height, int compression, TiffPlanarConfiguration planarConfiguration,
+ ByteOrder byteOrder) throws IOException, ImagingException;
public abstract AbstractTiffElement.DataElement[] getImageData();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterData.java b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffRasterData.java
similarity index 98%
rename from src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterData.java
rename to src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffRasterData.java
index f45a2d59..4da0767a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterData.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/AbstractTiffRasterData.java
@@ -32,7 +32,7 @@ package org.apache.commons.imaging.formats.tiff;
* index = y * width + x + iSample * width * height;
* </pre>
*/
-public abstract class TiffRasterData {
+public abstract class AbstractTiffRasterData {
protected final int width;
protected final int height;
@@ -47,7 +47,7 @@ public abstract class TiffRasterData {
* @param height a value of 1 or greater
* @param samplesPerPixel a value of 1 or greater
*/
- public TiffRasterData(final int width, final int height, final int samplesPerPixel) {
+ public AbstractTiffRasterData(final int width, final int height, final int samplesPerPixel) {
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("Raster dimensions less than or equal to zero are not supported");
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
index a47ebea4..8c41b934 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffDirectory.java
@@ -622,7 +622,7 @@ public class TiffDirectory extends AbstractTiffElement implements Iterable<TiffF
* @throws ImagingException in the event of incompatible or malformed data
* @throws IOException in the event of an I/O error
*/
- public TiffRasterData getRasterData(final TiffImagingParameters params) throws ImagingException, IOException {
+ public AbstractTiffRasterData getRasterData(final TiffImagingParameters params) throws ImagingException, IOException {
final TiffImageParser parser = new TiffImageParser();
return parser.getRasterData(this, headerByteOrder, params);
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
index addac647..66b0f5ba 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
@@ -44,8 +44,8 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
import org.apache.commons.imaging.formats.tiff.constants.TiffEpTagConstants;
import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
-import org.apache.commons.imaging.formats.tiff.datareaders.ImageDataReader;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.datareaders.AbstractImageDataReader;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreterBiLevel;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreterCieLab;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreterCmyk;
@@ -336,7 +336,7 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
}
}
- PhotometricInterpreter photometricInterpreter = params == null ? null : params.getCustomPhotometricInterpreter();
+ AbstractPhotometricInterpreter photometricInterpreter = params == null ? null : params.getCustomPhotometricInterpreter();
if (photometricInterpreter == null) {
photometricInterpreter = getPhotometricInterpreter(directory, photometricInterpretation, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
width, height);
@@ -361,9 +361,8 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
final AbstractTiffImageData imageData = directory.getTiffImageData();
- final ImageDataReader dataReader = imageData.getDataReader(directory, photometricInterpreter, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
- width, height, compression, planarConfiguration, byteOrder);
-
+ final AbstractImageDataReader dataReader = imageData.getDataReader(directory, photometricInterpreter, bitsPerPixel, bitsPerSample, predictor,
+ samplesPerPixel, width, height, compression, planarConfiguration, byteOrder);
final ImageBuilder iBuilder = dataReader.readImageData(subImage, hasAlpha, isAlphaPremultiplied);
return iBuilder.getBufferedImage();
}
@@ -575,7 +574,6 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
compressionAlgorithm = ImageInfo.CompressionAlgorithm.UNKNOWN;
break;
}
-
return new ImageInfo(formatDetails, bitsPerPixel, comments, format, formatName, height, mimeType, numberOfImages, physicalHeightDpi, physicalHeightInch,
physicalWidthDpi, physicalWidthInch, width, progressive, transparent, usesPalette, colorType, compressionAlgorithm);
}
@@ -630,24 +628,20 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
return "Tiff-Custom";
}
- private PhotometricInterpreter getPhotometricInterpreter(final TiffDirectory directory, final int photometricInterpretation, final int bitsPerPixel,
+ private AbstractPhotometricInterpreter getPhotometricInterpreter(final TiffDirectory directory, final int photometricInterpretation, final int bitsPerPixel,
final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int width, final int height) throws ImagingException {
switch (photometricInterpretation) {
case 0:
case 1:
final boolean invert = photometricInterpretation == 0;
-
return new PhotometricInterpreterBiLevel(samplesPerPixel, bitsPerSample, predictor, width, height, invert);
case 3: {
// Palette
final int[] colorMap = directory.findField(TiffTagConstants.TIFF_TAG_COLOR_MAP, true).getIntArrayValue();
-
final int expectedColormapSize = 3 * (1 << bitsPerPixel);
-
if (colorMap.length != expectedColormapSize) {
throw new ImagingException("Tiff: fColorMap.length (" + colorMap.length + ") != expectedColormapSize (" + expectedColormapSize + ")");
}
-
return new PhotometricInterpreterPalette(samplesPerPixel, bitsPerSample, predictor, width, height, colorMap);
}
case 2: // RGB
@@ -669,19 +663,15 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
// final double[] referenceBlackWhite = directory.findField(
// TiffTagConstants.TIFF_TAG_REFERENCE_BLACK_WHITE, true)
// .getDoubleArrayValue();
-
return new PhotometricInterpreterYCbCr(samplesPerPixel, bitsPerSample, predictor, width, height);
}
-
case 8:
return new PhotometricInterpreterCieLab(samplesPerPixel, bitsPerSample, predictor, width, height);
-
case 32844:
case 32845: {
// final boolean yonly = (photometricInterpretation == 32844);
return new PhotometricInterpreterLogLuv(samplesPerPixel, bitsPerSample, predictor, width, height);
}
-
default:
throw new ImagingException("TIFF: Unknown fPhotometricInterpretation: " + photometricInterpretation);
}
@@ -714,22 +704,20 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
* @throws ImagingException in the event of incompatible or malformed data
* @throws IOException in the event of an I/O error
*/
- TiffRasterData getRasterData(final TiffDirectory directory, final ByteOrder byteOrder, TiffImagingParameters params) throws ImagingException, IOException {
+ AbstractTiffRasterData getRasterData(final TiffDirectory directory, final ByteOrder byteOrder, TiffImagingParameters params)
+ throws ImagingException, IOException {
if (params == null) {
params = getDefaultParameters();
}
-
final short[] sSampleFmt = directory.getFieldValue(TiffTagConstants.TIFF_TAG_SAMPLE_FORMAT, true);
if (sSampleFmt == null || sSampleFmt.length < 1) {
throw new ImagingException("Directory does not specify numeric raster data");
}
-
int samplesPerPixel = 1;
final TiffField samplesPerPixelField = directory.findField(TiffTagConstants.TIFF_TAG_SAMPLES_PER_PIXEL);
if (samplesPerPixelField != null) {
samplesPerPixel = samplesPerPixelField.getIntValue();
}
-
int[] bitsPerSample = { 1 };
int bitsPerPixel = samplesPerPixel;
final TiffField bitsPerSampleField = directory.findField(TiffTagConstants.TIFF_TAG_BITS_PER_SAMPLE);
@@ -737,7 +725,6 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
bitsPerSample = bitsPerSampleField.getIntArrayValue();
bitsPerPixel = bitsPerSampleField.getIntValueOrArraySum();
}
-
final short compressionFieldValue;
if (directory.findField(TiffTagConstants.TIFF_TAG_COMPRESSION) != null) {
compressionFieldValue = directory.getFieldValue(TiffTagConstants.TIFF_TAG_COMPRESSION);
@@ -745,10 +732,8 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
compressionFieldValue = TiffConstants.COMPRESSION_UNCOMPRESSED_1;
}
final int compression = 0xffff & compressionFieldValue;
-
final int width = directory.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_WIDTH);
final int height = directory.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_LENGTH);
-
Rectangle subImage = checkForSubImage(params);
if (subImage != null) {
// Check for valid subimage specification. The following checks
@@ -771,14 +756,12 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
if (subImage.y + subImage.height > height) {
throw new ImagingException("Subimage (y+height) is outside raster.");
}
-
// if the subimage is just the same thing as the whole
// image, suppress the subimage processing
if (subImage.x == 0 && subImage.y == 0 && subImage.width == width && subImage.height == height) {
subImage = null;
}
}
-
// int bitsPerPixel = getTagAsValueOrArraySum(entries,
// TIFF_TAG_BITS_PER_SAMPLE);
int predictor = -1;
@@ -793,31 +776,25 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
predictor = predictorField.getIntValueOrArraySum();
}
}
-
// Obtain the planar configuration
final TiffField pcField = directory.findField(TiffTagConstants.TIFF_TAG_PLANAR_CONFIGURATION);
final TiffPlanarConfiguration planarConfiguration = pcField == null ? TiffPlanarConfiguration.CHUNKY
: TiffPlanarConfiguration.lenientValueOf(pcField.getIntValue());
-
if (sSampleFmt[0] == TiffTagConstants.SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT) {
if (bitsPerSample[0] != 32 && bitsPerSample[0] != 64) {
throw new ImagingException("TIFF floating-point data uses unsupported bits-per-sample: " + bitsPerSample[0]);
}
-
if (predictor != -1 && predictor != TiffTagConstants.PREDICTOR_VALUE_NONE
&& predictor != TiffTagConstants.PREDICTOR_VALUE_FLOATING_POINT_DIFFERENCING) {
throw new ImagingException("TIFF floating-point data uses unsupported horizontal-differencing predictor");
}
} else if (sSampleFmt[0] == TiffTagConstants.SAMPLE_FORMAT_VALUE_TWOS_COMPLEMENT_SIGNED_INTEGER) {
-
if (samplesPerPixel != 1) {
throw new ImagingException("TIFF integer data uses unsupported samples per pixel: " + samplesPerPixel);
}
-
if (bitsPerPixel != 16 && bitsPerPixel != 32) {
throw new ImagingException("TIFF integer data uses unsupported bits-per-pixel: " + bitsPerPixel);
}
-
if (predictor != -1 && predictor != TiffTagConstants.PREDICTOR_VALUE_NONE
&& predictor != TiffTagConstants.PREDICTOR_VALUE_HORIZONTAL_DIFFERENCING) {
throw new ImagingException("TIFF integer data uses unsupported horizontal-differencing predictor");
@@ -825,17 +802,13 @@ public class TiffImageParser extends AbstractImageParser<TiffImagingParameters>
} else {
throw new ImagingException("TIFF does not provide a supported raster-data format");
}
-
// The photometric interpreter is not used, but the image-based
// data reader classes require one. So we create a dummy interpreter.
- final PhotometricInterpreter photometricInterpreter = new PhotometricInterpreterBiLevel(samplesPerPixel, bitsPerSample, predictor, width, height,
- false);
-
+ final AbstractPhotometricInterpreter photometricInterpreter = new PhotometricInterpreterBiLevel(samplesPerPixel, bitsPerSample, predictor, width,
+ height, false);
final AbstractTiffImageData imageData = directory.getTiffImageData();
-
- final ImageDataReader dataReader = imageData.getDataReader(directory, photometricInterpreter, bitsPerPixel, bitsPerSample, predictor, samplesPerPixel,
- width, height, compression, planarConfiguration, byteOrder);
-
+ final AbstractImageDataReader dataReader = imageData.getDataReader(directory, photometricInterpreter, bitsPerPixel, bitsPerSample, predictor,
+ samplesPerPixel, width, height, compression, planarConfiguration, byteOrder);
return dataReader.readRasterData(subImage);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
index 1de2986c..8affc077 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffImagingParameters.java
@@ -16,7 +16,7 @@
package org.apache.commons.imaging.formats.tiff;
import org.apache.commons.imaging.common.XmpImagingParameters;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
/**
@@ -68,7 +68,7 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
* The value supplied with this key should be a valid instance of a class that implements PhotometricInterpreter.
* </p>
*/
- private PhotometricInterpreter customPhotometricInterpreter;
+ private AbstractPhotometricInterpreter customPhotometricInterpreter;
/**
* TIFF compression algorithm, if any.
@@ -112,7 +112,7 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return compression;
}
- public PhotometricInterpreter getCustomPhotometricInterpreter() {
+ public AbstractPhotometricInterpreter getCustomPhotometricInterpreter() {
return customPhotometricInterpreter;
}
@@ -191,7 +191,7 @@ public class TiffImagingParameters extends XmpImagingParameters<TiffImagingParam
return asThis();
}
- public TiffImagingParameters setCustomPhotometricInterpreter(final PhotometricInterpreter customPhotometricInterpreter) {
+ public TiffImagingParameters setCustomPhotometricInterpreter(final AbstractPhotometricInterpreter customPhotometricInterpreter) {
this.customPhotometricInterpreter = customPhotometricInterpreter;
return asThis();
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataFloat.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataFloat.java
index 01a70b41..57e9d0cc 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataFloat.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataFloat.java
@@ -36,7 +36,7 @@ import org.apache.commons.imaging.common.Allocator;
* index = y * width + x + iSample * width * height;
* </pre>
*/
-public final class TiffRasterDataFloat extends TiffRasterData {
+public final class TiffRasterDataFloat extends AbstractTiffRasterData {
private final float[] data;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataInt.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataInt.java
index ebe06936..78e97232 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataInt.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataInt.java
@@ -34,7 +34,7 @@ import org.apache.commons.imaging.common.Allocator;
* index = y * width + x + iSample * width * height;
* </pre>
*/
-public final class TiffRasterDataInt extends TiffRasterData {
+public final class TiffRasterDataInt extends AbstractTiffRasterData {
private final int[] data;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatistics.java b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatistics.java
index bcb53b0e..846f6559 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatistics.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatistics.java
@@ -34,7 +34,7 @@ public class TiffRasterStatistics {
* @param raster the input data
* @param excludedValue an optional value to ignore; use Float.NaN if no value is to be ignored.
*/
- TiffRasterStatistics(final TiffRasterData raster, final float excludedValue) {
+ TiffRasterStatistics(final AbstractTiffRasterData raster, final float excludedValue) {
this.excludedValue = excludedValue;
float vMin = Float.POSITIVE_INFINITY;
float vMax = Float.NEGATIVE_INFINITY;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/AbstractImageDataReader.java
similarity index 98%
rename from src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
rename to src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/AbstractImageDataReader.java
index c7157ac8..f8ce13d6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/ImageDataReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/AbstractImageDataReader.java
@@ -28,14 +28,14 @@ import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.ImageBuilder;
import org.apache.commons.imaging.common.PackBits;
import org.apache.commons.imaging.common.ZlibDeflate;
+import org.apache.commons.imaging.formats.tiff.AbstractTiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffDirectory;
import org.apache.commons.imaging.formats.tiff.TiffField;
-import org.apache.commons.imaging.formats.tiff.TiffRasterData;
import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
import org.apache.commons.imaging.formats.tiff.itu_t4.T4AndT6Compression;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
import org.apache.commons.imaging.mylzw.MyLzwDecompressor;
/**
@@ -129,10 +129,10 @@ import org.apache.commons.imaging.mylzw.MyLzwDecompressor;
* compression in the case where different sample sets have different statistical properties. Because separated groups often have more uniformity and
* predictability than interleaved data sets, they sometimes lead to a small improvement in storage-size reduction when data compression is used.
*/
-public abstract class ImageDataReader {
+public abstract class AbstractImageDataReader {
protected final TiffDirectory directory;
- protected final PhotometricInterpreter photometricInterpreter;
+ protected final AbstractPhotometricInterpreter photometricInterpreter;
private final int[] bitsPerSample;
protected final int bitsPerSampleLength;
private final int[] last;
@@ -145,8 +145,9 @@ public abstract class ImageDataReader {
protected final TiffPlanarConfiguration planarConfiguration;
- public ImageDataReader(final TiffDirectory directory, final PhotometricInterpreter photometricInterpreter, final int[] bitsPerSample, final int predictor,
- final int samplesPerPixel, final int sampleFormat, final int width, final int height, final TiffPlanarConfiguration planarConfiguration) {
+ public AbstractImageDataReader(final TiffDirectory directory, final AbstractPhotometricInterpreter photometricInterpreter, final int[] bitsPerSample,
+ final int predictor, final int samplesPerPixel, final int sampleFormat, final int width, final int height,
+ final TiffPlanarConfiguration planarConfiguration) {
this.directory = directory;
this.photometricInterpreter = photometricInterpreter;
this.bitsPerSample = bitsPerSample;
@@ -158,7 +159,6 @@ public abstract class ImageDataReader {
this.height = height;
this.planarConfiguration = planarConfiguration;
last = Allocator.intArray(samplesPerPixel);
-
}
protected int[] applyPredictor(final int[] samples) {
@@ -323,7 +323,7 @@ public abstract class ImageDataReader {
* @throws ImagingException in the event of an incompatible data form.
* @throws IOException in the event of I/O error.
*/
- public abstract TiffRasterData readRasterData(Rectangle subImage) throws ImagingException, IOException;
+ public abstract AbstractTiffRasterData readRasterData(Rectangle subImage) throws ImagingException, IOException;
protected void resetPredictor() {
Arrays.fill(last, 0);
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
index 57530b01..8b20cbe8 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
@@ -27,21 +27,21 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.ImageBuilder;
import org.apache.commons.imaging.formats.tiff.AbstractTiffImageData;
+import org.apache.commons.imaging.formats.tiff.AbstractTiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffDirectory;
-import org.apache.commons.imaging.formats.tiff.TiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffRasterDataFloat;
import org.apache.commons.imaging.formats.tiff.TiffRasterDataInt;
import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreterRgb;
/**
* Provides a data reader for TIFF file images organized by tiles.
* <p>
- * See {@link ImageDataReader} for notes discussing design and development with particular emphasis on run-time performance.
+ * See {@link AbstractImageDataReader} for notes discussing design and development with particular emphasis on run-time performance.
*/
-public final class DataReaderStrips extends ImageDataReader {
+public final class DataReaderStrips extends AbstractImageDataReader {
private final int bitsPerPixel;
private final int compression;
@@ -52,7 +52,7 @@ public final class DataReaderStrips extends ImageDataReader {
private int y;
private final AbstractTiffImageData.Strips imageData;
- public DataReaderStrips(final TiffDirectory directory, final PhotometricInterpreter photometricInterpreter, final int bitsPerPixel,
+ public DataReaderStrips(final TiffDirectory directory, final AbstractPhotometricInterpreter photometricInterpreter, final int bitsPerPixel,
final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int sampleFormat, final int width, final int height,
final int compression, final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteOrder, final int rowsPerStrip,
final AbstractTiffImageData.Strips imageData) {
@@ -335,7 +335,7 @@ public final class DataReaderStrips extends ImageDataReader {
}
@Override
- public TiffRasterData readRasterData(final Rectangle subImage) throws ImagingException, IOException {
+ public AbstractTiffRasterData readRasterData(final Rectangle subImage) throws ImagingException, IOException {
switch (sampleFormat) {
case TiffTagConstants.SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT:
return readRasterDataFloat(subImage);
@@ -346,7 +346,7 @@ public final class DataReaderStrips extends ImageDataReader {
}
}
- private TiffRasterData readRasterDataFloat(final Rectangle subImage) throws ImagingException, IOException {
+ private AbstractTiffRasterData readRasterDataFloat(final Rectangle subImage) throws ImagingException, IOException {
final int xRaster;
final int yRaster;
final int rasterWidth;
@@ -391,7 +391,7 @@ public final class DataReaderStrips extends ImageDataReader {
return new TiffRasterDataFloat(rasterWidth, rasterHeight, samplesPerPixel, rasterDataFloat);
}
- private TiffRasterData readRasterDataInt(final Rectangle subImage) throws ImagingException, IOException {
+ private AbstractTiffRasterData readRasterDataInt(final Rectangle subImage) throws ImagingException, IOException {
final int xRaster;
final int yRaster;
final int rasterWidth;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
index 2db1faa5..f58736a3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
@@ -33,19 +33,19 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.ImageBuilder;
import org.apache.commons.imaging.formats.tiff.AbstractTiffImageData;
+import org.apache.commons.imaging.formats.tiff.AbstractTiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffDirectory;
-import org.apache.commons.imaging.formats.tiff.TiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffRasterDataFloat;
import org.apache.commons.imaging.formats.tiff.TiffRasterDataInt;
import org.apache.commons.imaging.formats.tiff.constants.TiffPlanarConfiguration;
import org.apache.commons.imaging.formats.tiff.constants.TiffTagConstants;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreterRgb;
/**
* Provides a data reader for TIFF file images organized by tiles.
*/
-public final class DataReaderTiled extends ImageDataReader {
+public final class DataReaderTiled extends AbstractImageDataReader {
private final int tileWidth;
private final int tileLength;
@@ -57,18 +57,15 @@ public final class DataReaderTiled extends ImageDataReader {
private final AbstractTiffImageData.Tiles imageData;
- public DataReaderTiled(final TiffDirectory directory, final PhotometricInterpreter photometricInterpreter, final int tileWidth, final int tileLength,
- final int bitsPerPixel, final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int sampleFormat, final int width,
- final int height, final int compression, final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteOrder,
+ public DataReaderTiled(final TiffDirectory directory, final AbstractPhotometricInterpreter photometricInterpreter, final int tileWidth,
+ final int tileLength, final int bitsPerPixel, final int[] bitsPerSample, final int predictor, final int samplesPerPixel, final int sampleFormat,
+ final int width, final int height, final int compression, final TiffPlanarConfiguration planarConfiguration, final ByteOrder byteOrder,
final AbstractTiffImageData.Tiles imageData) {
super(directory, photometricInterpreter, bitsPerSample, predictor, samplesPerPixel, sampleFormat, width, height, planarConfiguration);
-
this.tileWidth = tileWidth;
this.tileLength = tileLength;
-
this.bitsPerPixel = bitsPerPixel;
this.compression = compression;
-
this.imageData = imageData;
this.byteOrder = byteOrder;
}
@@ -271,7 +268,7 @@ public final class DataReaderTiled extends ImageDataReader {
}
@Override
- public TiffRasterData readRasterData(final Rectangle subImage) throws ImagingException, IOException {
+ public AbstractTiffRasterData readRasterData(final Rectangle subImage) throws ImagingException, IOException {
switch (sampleFormat) {
case TiffTagConstants.SAMPLE_FORMAT_VALUE_IEEE_FLOATING_POINT:
return readRasterDataFloat(subImage);
@@ -282,7 +279,7 @@ public final class DataReaderTiled extends ImageDataReader {
}
}
- private TiffRasterData readRasterDataFloat(final Rectangle subImage) throws ImagingException, IOException {
+ private AbstractTiffRasterData readRasterDataFloat(final Rectangle subImage) throws ImagingException, IOException {
final int bitsPerRow = tileWidth * bitsPerPixel;
final int bytesPerRow = (bitsPerRow + 7) / 8;
final int bytesPerTile = bytesPerRow * tileLength;
@@ -328,7 +325,7 @@ public final class DataReaderTiled extends ImageDataReader {
return new TiffRasterDataFloat(rasterWidth, rasterHeight, samplesPerPixel, rasterDataFloat);
}
- private TiffRasterData readRasterDataInt(final Rectangle subImage) throws ImagingException, IOException {
+ private AbstractTiffRasterData readRasterDataInt(final Rectangle subImage) throws ImagingException, IOException {
final int bitsPerRow = tileWidth * bitsPerPixel;
final int bytesPerRow = (bitsPerRow + 7) / 8;
final int bytesPerTile = bytesPerRow * tileLength;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/AbstractPhotometricInterpreter.java
similarity index 90%
rename from src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
rename to src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/AbstractPhotometricInterpreter.java
index 765c74ef..64fdd447 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/AbstractPhotometricInterpreter.java
@@ -28,7 +28,7 @@ import org.apache.commons.imaging.common.ImageBuilder;
*
* @see <a href= "https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html"> Baseline TIFF Tag PhotometricInterpretation</a>
*/
-public abstract class PhotometricInterpreter {
+public abstract class AbstractPhotometricInterpreter {
protected final int samplesPerPixel;
private final int[] bitsPerSample;
@@ -36,7 +36,7 @@ public abstract class PhotometricInterpreter {
protected final int width;
protected final int height;
- public PhotometricInterpreter(final int samplesPerPixel, final int[] bitsPerSample, final int predictor, final int width, final int height) {
+ public AbstractPhotometricInterpreter(final int samplesPerPixel, final int[] bitsPerSample, final int predictor, final int width, final int height) {
this.samplesPerPixel = samplesPerPixel;
this.bitsPerSample = Objects.requireNonNull(bitsPerSample, "bitsPerSample");
this.predictor = predictor;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
index a8feaaf9..a19f4eb4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterBiLevel.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.ImageBuilder;
-public class PhotometricInterpreterBiLevel extends PhotometricInterpreter {
+public class PhotometricInterpreterBiLevel extends AbstractPhotometricInterpreter {
private final boolean invert;
// private final int bitsPerPixel;
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
index 8e6b426c..c9f1c982 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCieLab.java
@@ -22,7 +22,7 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.common.ImageBuilder;
-public class PhotometricInterpreterCieLab extends PhotometricInterpreter {
+public class PhotometricInterpreterCieLab extends AbstractPhotometricInterpreter {
public PhotometricInterpreterCieLab(final int samplesPerPixel, final int[] bitsPerSample, final int predictor, final int width, final int height) {
super(samplesPerPixel, bitsPerSample, predictor, width, height);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
index ecc17dce..8fcd2ab9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterCmyk.java
@@ -22,7 +22,7 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.color.ColorConversions;
import org.apache.commons.imaging.common.ImageBuilder;
-public class PhotometricInterpreterCmyk extends PhotometricInterpreter {
+public class PhotometricInterpreterCmyk extends AbstractPhotometricInterpreter {
public PhotometricInterpreterCmyk(final int samplesPerPixel, final int[] bitsPerSample, final int predictor, final int width, final int height) {
super(samplesPerPixel, bitsPerSample, predictor, width, height);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
index 7e6c166e..fa0bcac6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterLogLuv.java
@@ -26,7 +26,7 @@ import org.apache.commons.imaging.common.ImageBuilder;
*
* @see <a href="https://en.wikipedia.org/wiki/Logluv_TIFF">Logluv TIFF</a>
*/
-public class PhotometricInterpreterLogLuv extends PhotometricInterpreter {
+public class PhotometricInterpreterLogLuv extends AbstractPhotometricInterpreter {
/**
* Rgb values (reg-green-blue, as R-G-B, as in the RGB color model).
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
index ddeb9eeb..9f60aad1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterPalette.java
@@ -25,7 +25,7 @@ import org.apache.commons.imaging.common.AllocationRequestException;
import org.apache.commons.imaging.common.Allocator;
import org.apache.commons.imaging.common.ImageBuilder;
-public final class PhotometricInterpreterPalette extends PhotometricInterpreter {
+public final class PhotometricInterpreterPalette extends AbstractPhotometricInterpreter {
/**
* The color map of integer ARGB values tied to the pixel index of the palette.
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
index c652ec8b..aa2002c7 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterRgb.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.ImageBuilder;
-public class PhotometricInterpreterRgb extends PhotometricInterpreter {
+public class PhotometricInterpreterRgb extends AbstractPhotometricInterpreter {
public PhotometricInterpreterRgb(final int samplesPerPixel, final int[] bitsPerSample, final int predictor, final int width, final int height) {
super(samplesPerPixel, bitsPerSample, predictor, width, height);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
index 153a4e94..81071278 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/PhotometricInterpreterYCbCr.java
@@ -21,7 +21,7 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.ImageBuilder;
-public class PhotometricInterpreterYCbCr extends PhotometricInterpreter {
+public class PhotometricInterpreterYCbCr extends AbstractPhotometricInterpreter {
/**
* This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace. This is handy when trying to reconstruct an image in Java from YCbCr transmitted
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/floatingpoint/PhotometricInterpreterFloat.java b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/floatingpoint/PhotometricInterpreterFloat.java
index d84df931..5f9b155f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/floatingpoint/PhotometricInterpreterFloat.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/photometricinterpreters/floatingpoint/PhotometricInterpreterFloat.java
@@ -24,7 +24,7 @@ import java.util.List;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.ImageBuilder;
-import org.apache.commons.imaging.formats.tiff.photometricinterpreters.PhotometricInterpreter;
+import org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter;
/**
* Implements a custom photometric interpreter that can be supplied by applications in order to render Java images from real-valued TIFF data products. Most
@@ -45,7 +45,7 @@ import org.apache.commons.imaging.formats.tiff.photometricinterpreters.Photometr
* <p>
* To use this class, an application must access the TIFF file using the low-level, TIFF-specific API provided by the Apache Commons Imaging library.
*/
-public final class PhotometricInterpreterFloat extends PhotometricInterpreter {
+public final class PhotometricInterpreterFloat extends AbstractPhotometricInterpreter {
ArrayList<PaletteEntry> rangePaletteEntries = new ArrayList<>();
ArrayList<PaletteEntry> singleValuePaletteEntries = new ArrayList<>();
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffImageWriter.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffImageWriter.java
index 2094c3f7..da5fafa5 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffImageWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffImageWriter.java
@@ -32,8 +32,8 @@ import java.util.Map;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.PixelDensity;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.PackBits;
import org.apache.commons.imaging.common.RationalNumber;
import org.apache.commons.imaging.common.ZlibDeflate;
@@ -588,11 +588,11 @@ public abstract class AbstractTiffImageWriter {
write(os, outputSet);
}
- protected void writeImageFileHeader(final BinaryOutputStream bos) throws IOException {
+ protected void writeImageFileHeader(final AbstractBinaryOutputStream bos) throws IOException {
writeImageFileHeader(bos, TiffConstants.HEADER_SIZE);
}
- protected void writeImageFileHeader(final BinaryOutputStream bos, final long offsetToFirstIFD) throws IOException {
+ protected void writeImageFileHeader(final AbstractBinaryOutputStream bos, final long offsetToFirstIFD) throws IOException {
if (byteOrder == ByteOrder.LITTLE_ENDIAN) {
bos.write('I');
bos.write('I');
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
index 51aa2901..8c487a7d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/AbstractTiffOutputItem.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.tiff.write;
import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
abstract class AbstractTiffOutputItem {
@@ -52,7 +52,7 @@ abstract class AbstractTiffOutputItem {
}
@Override
- public void writeItem(final BinaryOutputStream bos) throws IOException, ImagingException {
+ public void writeItem(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
bos.write(bytes);
}
}
@@ -73,5 +73,5 @@ abstract class AbstractTiffOutputItem {
this.offset = offset;
}
- public abstract void writeItem(BinaryOutputStream bos) throws IOException, ImagingException;
+ public abstract void writeItem(AbstractBinaryOutputStream bos) throws IOException, ImagingException;
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
index eca36ea1..cf35a863 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossless.java
@@ -32,8 +32,8 @@ import java.util.Map;
import org.apache.commons.imaging.FormatCompliance;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.formats.tiff.AbstractTiffElement;
import org.apache.commons.imaging.formats.tiff.AbstractTiffElement.DataElement;
import org.apache.commons.imaging.formats.tiff.AbstractTiffImageData;
@@ -288,7 +288,7 @@ public class TiffImageWriterLossless extends AbstractTiffImageWriter {
System.arraycopy(exifBytes, 0, output, 0, Math.min(exifBytes.length, output.length));
try (BufferOutputStream headerStream = new BufferOutputStream(output, 0);
- BinaryOutputStream headerBinaryStream = BinaryOutputStream.create(headerStream, byteOrder)) {
+ AbstractBinaryOutputStream headerBinaryStream = AbstractBinaryOutputStream.create(headerStream, byteOrder)) {
writeImageFileHeader(headerBinaryStream, rootDirectory.getOffset());
}
@@ -300,7 +300,7 @@ public class TiffImageWriterLossless extends AbstractTiffImageWriter {
// write in the new items
for (final AbstractTiffOutputItem outputItem : outputItems) {
- try (BinaryOutputStream bos = BinaryOutputStream.create(new BufferOutputStream(output, (int) outputItem.getOffset()), byteOrder)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.create(new BufferOutputStream(output, (int) outputItem.getOffset()), byteOrder)) {
outputItem.writeItem(bos);
}
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
index 05773664..acf0d9be 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffImageWriterLossy.java
@@ -24,7 +24,7 @@ import java.nio.ByteOrder;
import java.util.List;
import org.apache.commons.imaging.ImagingException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
public class TiffImageWriterLossy extends AbstractTiffImageWriter {
@@ -59,13 +59,13 @@ public class TiffImageWriterLossy extends AbstractTiffImageWriter {
outputSummary.updateOffsets(byteOrder);
- final BinaryOutputStream bos = BinaryOutputStream.create(os, byteOrder);
+ final AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.create(os, byteOrder);
// NB: resource is intentionally left open
writeStep(bos, outputItems);
}
- private void writeStep(final BinaryOutputStream bos, final List<AbstractTiffOutputItem> outputItems) throws IOException, ImagingException {
+ private void writeStep(final AbstractBinaryOutputStream bos, final List<AbstractTiffOutputItem> outputItems) throws IOException, ImagingException {
writeImageFileHeader(bos);
for (final AbstractTiffOutputItem outputItem : outputItems) {
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
index 81c6b784..bd757aea 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
@@ -31,8 +31,8 @@ import java.util.Iterator;
import java.util.List;
import org.apache.commons.imaging.ImagingException;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.Allocator;
-import org.apache.commons.imaging.common.BinaryOutputStream;
import org.apache.commons.imaging.common.RationalNumber;
import org.apache.commons.imaging.formats.tiff.AbstractTiffElement;
import org.apache.commons.imaging.formats.tiff.AbstractTiffImageData;
@@ -603,7 +603,7 @@ public final class TiffOutputDirectory extends AbstractTiffOutputItem implements
}
@Override
- public void writeItem(final BinaryOutputStream bos) throws IOException, ImagingException {
+ public void writeItem(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
// Write Directory Field Count
bos.write2Bytes(fields.size()); // DirectoryFieldCount
diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
index 2fb8246c..309cb84f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputField.java
@@ -23,7 +23,7 @@ import java.nio.ByteOrder;
import java.util.Arrays;
import org.apache.commons.imaging.ImagingException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.formats.tiff.fieldtypes.AbstractFieldType;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
@@ -138,7 +138,7 @@ public class TiffOutputField {
return result.toString();
}
- protected void writeField(final BinaryOutputStream bos) throws IOException, ImagingException {
+ protected void writeField(final AbstractBinaryOutputStream bos) throws IOException, ImagingException {
bos.write2Bytes(tag);
bos.write2Bytes(abstractFieldType.getType());
bos.write4Bytes(count);
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
index 5f9d80ff..ebf8b420 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/WebPChunkType.java
@@ -20,7 +20,7 @@ import java.io.IOException;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.common.BinaryFunctions;
-import org.apache.commons.imaging.formats.webp.chunks.WebPChunk;
+import org.apache.commons.imaging.formats.webp.chunks.AbstractWebPChunk;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkAlph;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkAnim;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkAnmf;
@@ -85,7 +85,7 @@ public enum WebPChunkType {
XMP(WebPChunkXml::new);
private interface ChunkConstructor {
- WebPChunk make(int type, int size, byte[] bytes) throws IOException, ImagingException;
+ AbstractWebPChunk make(int type, int size, byte[] bytes) throws IOException, ImagingException;
}
private static final WebPChunkType[] types = values();
@@ -99,7 +99,7 @@ public enum WebPChunkType {
return null;
}
- static WebPChunk makeChunk(final int chunkType, final int size, final byte[] bytes) throws IOException, ImagingException {
+ static AbstractWebPChunk makeChunk(final int chunkType, final int size, final byte[] bytes) throws IOException, ImagingException {
final WebPChunkType type = findType(chunkType);
return type != null ? type.constructor.make(chunkType, size, bytes) : new WebPChunkXyzw(chunkType, size, bytes);
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/WebPImageParser.java b/src/main/java/org/apache/commons/imaging/formats/webp/WebPImageParser.java
index c2308501..3af52a68 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/WebPImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/WebPImageParser.java
@@ -39,7 +39,7 @@ import org.apache.commons.imaging.common.XmpEmbeddable;
import org.apache.commons.imaging.common.XmpImagingParameters;
import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import org.apache.commons.imaging.formats.tiff.TiffImageParser;
-import org.apache.commons.imaging.formats.webp.chunks.WebPChunk;
+import org.apache.commons.imaging.formats.webp.chunks.AbstractWebPChunk;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkVp8;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkVp8l;
import org.apache.commons.imaging.formats.webp.chunks.WebPChunkVp8x;
@@ -80,7 +80,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
return SafeOperations.add(sizeCount, 8); // File Header
}
- WebPChunk readChunk() throws ImagingException, IOException {
+ AbstractWebPChunk readChunk() throws ImagingException, IOException {
while (sizeCount < fileSize) {
final int type = read4Bytes("Chunk Type", is, "Not a valid WebP file", ByteOrder.LITTLE_ENDIAN);
final int payloadSize = read4Bytes("Chunk Size", is, "Not a valid WebP file", ByteOrder.LITTLE_ENDIAN);
@@ -113,7 +113,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
}
final byte[] bytes = readBytes("Chunk Payload", is, payloadSize);
- final WebPChunk chunk = WebPChunkType.makeChunk(type, payloadSize, bytes);
+ final AbstractWebPChunk chunk = WebPChunkType.makeChunk(type, payloadSize, bytes);
if (padding) {
skipBytes(is, 1);
}
@@ -168,7 +168,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
pw.println("webp.dumpImageFile");
try (ChunksReader reader = new ChunksReader(byteSource)) {
int offset = reader.getOffset();
- WebPChunk chunk = reader.readChunk();
+ AbstractWebPChunk chunk = reader.readChunk();
if (chunk == null) {
throw new ImagingException("No WebP chunks found");
}
@@ -215,7 +215,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
@Override
public byte[] getIccProfileBytes(final ByteSource byteSource, final WebPImagingParameters params) throws ImagingException, IOException {
try (ChunksReader reader = new ChunksReader(byteSource, WebPChunkType.ICCP)) {
- final WebPChunk chunk = reader.readChunk();
+ final AbstractWebPChunk chunk = reader.readChunk();
return chunk == null ? null : chunk.getBytes();
}
}
@@ -230,7 +230,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
boolean hasAlpha = false;
ImageInfo.ColorType colorType = ImageInfo.ColorType.RGB;
- WebPChunk chunk = reader.readChunk();
+ AbstractWebPChunk chunk = reader.readChunk();
if (chunk instanceof WebPChunkVp8) {
formatDetails = "WebP/Lossy";
numberOfImages = 1;
@@ -295,7 +295,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
@Override
public Dimension getImageSize(final ByteSource byteSource, final WebPImagingParameters params) throws ImagingException, IOException {
try (ChunksReader reader = new ChunksReader(byteSource)) {
- final WebPChunk chunk = reader.readChunk();
+ final AbstractWebPChunk chunk = reader.readChunk();
if (chunk instanceof WebPChunkVp8) {
final WebPChunkVp8 vp8 = (WebPChunkVp8) chunk;
return new Dimension(vp8.getWidth(), vp8.getHeight());
@@ -315,7 +315,7 @@ public class WebPImageParser extends AbstractImageParser<WebPImagingParameters>
@Override
public WebPImageMetadata getMetadata(final ByteSource byteSource, final WebPImagingParameters params) throws ImagingException, IOException {
try (ChunksReader reader = new ChunksReader(byteSource, WebPChunkType.EXIF)) {
- final WebPChunk chunk = reader.readChunk();
+ final AbstractWebPChunk chunk = reader.readChunk();
return chunk == null ? null : new WebPImageMetadata((TiffImageMetadata) new TiffImageParser().getMetadata(chunk.getBytes()));
}
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunk.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/AbstractWebPChunk.java
similarity index 93%
rename from src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunk.java
rename to src/main/java/org/apache/commons/imaging/formats/webp/chunks/AbstractWebPChunk.java
index 75295b80..4a9d3a54 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunk.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/AbstractWebPChunk.java
@@ -31,7 +31,7 @@ import org.apache.commons.imaging.internal.SafeOperations;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container">WebP Container Specification</a>
* @since 1.0.0-alpha4
*/
-public abstract class WebPChunk extends BinaryFileParser {
+public abstract class AbstractWebPChunk extends BinaryFileParser {
private static boolean checkArgs(final int size, final byte[] bytes) throws ImagingException {
if (size != bytes.length) {
@@ -45,7 +45,7 @@ public abstract class WebPChunk extends BinaryFileParser {
protected final byte[] bytes;
private final int chunkSize;
- private WebPChunk(final int type, final int size, final byte[] bytes, final boolean ignored) {
+ private AbstractWebPChunk(final int type, final int size, final byte[] bytes, final boolean ignored) {
super(ByteOrder.LITTLE_ENDIAN);
this.type = type;
this.size = bytes.length;
@@ -64,7 +64,7 @@ public abstract class WebPChunk extends BinaryFileParser {
* @param bytes chunk data.
* @throws ImagingException if the chunk data and the size provided do not match.
*/
- public WebPChunk(final int type, final int size, final byte[] bytes) throws ImagingException {
+ public AbstractWebPChunk(final int type, final int size, final byte[] bytes) throws ImagingException {
this(type, size, bytes, checkArgs(size, bytes));
}
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAlph.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAlph.java
index 939f45bf..63be6d7f 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAlph.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAlph.java
@@ -35,7 +35,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#alpha">Extended File Format#Alpha</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkAlph extends WebPChunk {
+public final class WebPChunkAlph extends AbstractWebPChunk {
/**
* Create an ALPH chunk.
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnim.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnim.java
index dd1f1ba9..1c8af321 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnim.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnim.java
@@ -37,7 +37,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#animation">Extended File Format#Animation</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkAnim extends WebPChunk {
+public final class WebPChunkAnim extends AbstractWebPChunk {
/**
* Create an ANIM chunk.
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnmf.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnmf.java
index 83bfb687..572a5d5d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnmf.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkAnmf.java
@@ -43,7 +43,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#animation">Extended File Format#Animation</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkAnmf extends WebPChunk {
+public final class WebPChunkAnmf extends AbstractWebPChunk {
/**
* Create an ANMF chunk.
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkExif.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkExif.java
index 47f41491..09b076a1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkExif.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkExif.java
@@ -41,7 +41,7 @@ import org.apache.commons.imaging.formats.tiff.TiffImageParser;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#metadata">Extended File Format#Metadata</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkExif extends WebPChunk {
+public final class WebPChunkExif extends AbstractWebPChunk {
/**
* Create an Exif chunk.
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkIccp.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkIccp.java
index 6502d564..011035d7 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkIccp.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkIccp.java
@@ -35,7 +35,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#color_profile">Extended File Format#Color Profile</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkIccp extends WebPChunk {
+public final class WebPChunkIccp extends AbstractWebPChunk {
/**
* Create an ICCP chunk.
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
index db0e2e69..f7c10bb6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8.java
@@ -39,7 +39,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://datatracker.ietf.org/doc/html/rfc6386">VP8 Data Format and Decoding Guide</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkVp8 extends WebPChunk {
+public final class WebPChunkVp8 extends AbstractWebPChunk {
private final int versionNumber;
private final int width;
private final int height;
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
index 9121d3b7..94e55f1d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8l.java
@@ -39,7 +39,7 @@ import org.apache.commons.imaging.internal.SafeOperations;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#simple_file_format_lossless">Simple File Format (Lossless)</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkVp8l extends WebPChunk {
+public final class WebPChunkVp8l extends AbstractWebPChunk {
private final int imageWidth;
private final int imageHeight;
private final boolean hasAlpha;
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
index 75181e26..9dfffd29 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkVp8x.java
@@ -46,7 +46,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#extended_file_format">Extended File Format</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkVp8x extends WebPChunk {
+public final class WebPChunkVp8x extends AbstractWebPChunk {
private final boolean hasIcc;
private final boolean hasAlpha;
private final boolean hasExif;
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
index 55d32f6f..5012cbb1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXml.java
@@ -37,7 +37,7 @@ import org.apache.commons.imaging.ImagingException;
* @see <a href="https://developers.google.com/speed/webp/docs/riff_container#metadata">Extended File Format#Metadata</a>
* @since 1.0.0-alpha4
*/
-public final class WebPChunkXml extends WebPChunk {
+public final class WebPChunkXml extends AbstractWebPChunk {
private final String xml;
/**
diff --git a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXyzw.java b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXyzw.java
index 585e58fb..b2e4aef9 100644
--- a/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXyzw.java
+++ b/src/main/java/org/apache/commons/imaging/formats/webp/chunks/WebPChunkXyzw.java
@@ -23,7 +23,7 @@ import org.apache.commons.imaging.ImagingException;
*
* @since 1.0.0-alpha4
*/
-public final class WebPChunkXyzw extends WebPChunk {
+public final class WebPChunkXyzw extends AbstractWebPChunk {
/**
* Create a XYZW chunk.
diff --git a/src/test/java/org/apache/commons/imaging/examples/tiff/ExampleReadFloatingPointData.java b/src/test/java/org/apache/commons/imaging/examples/tiff/ExampleReadFloatingPointData.java
index 5bb7c1a7..e01556b1 100644
--- a/src/test/java/org/apache/commons/imaging/examples/tiff/ExampleReadFloatingPointData.java
+++ b/src/test/java/org/apache/commons/imaging/examples/tiff/ExampleReadFloatingPointData.java
@@ -29,10 +29,10 @@ import org.apache.commons.imaging.FormatCompliance;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
import org.apache.commons.imaging.common.ImageBuilder;
+import org.apache.commons.imaging.formats.tiff.AbstractTiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffContents;
import org.apache.commons.imaging.formats.tiff.TiffDirectory;
import org.apache.commons.imaging.formats.tiff.TiffImagingParameters;
-import org.apache.commons.imaging.formats.tiff.TiffRasterData;
import org.apache.commons.imaging.formats.tiff.TiffRasterStatistics;
import org.apache.commons.imaging.formats.tiff.TiffReader;
import org.apache.commons.imaging.formats.tiff.photometricinterpreters.floatingpoint.PaletteEntry;
@@ -105,7 +105,7 @@ public class ExampleReadFloatingPointData {
// See the Javadoc for readFloatingPointRasterData for more details.
final long time0Nanos = System.nanoTime();
final TiffImagingParameters params = new TiffImagingParameters();
- final TiffRasterData rasterData = directory.getRasterData(params);
+ final AbstractTiffRasterData rasterData = directory.getRasterData(params);
final long time1Nanos = System.nanoTime();
System.out.println("Data read in " + (time1Nanos - time0Nanos) / 1.0e+6 + " ms");
diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/AbstractIcnsTest.java
similarity index 91%
rename from src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/icns/AbstractIcnsTest.java
index 642b677f..1bf55b61 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/AbstractIcnsTest.java
@@ -27,9 +27,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-public abstract class IcnsBaseTest extends AbstractImagingTest {
+public abstract class AbstractIcnsTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = IcnsBaseTest::isIcns;
+ private static final ImageFilter IMAGE_FILTER = AbstractIcnsTest::isIcns;
protected static List<File> getIcnsImages() throws IOException, ImagingException {
return getTestImages(IMAGE_FILTER);
diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
index 4bd04373..aa5ef69c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsReadTest.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-public class IcnsReadTest extends IcnsBaseTest {
+public class IcnsReadTest extends AbstractIcnsTest {
public static Stream<File> data() throws Exception {
return getIcnsImages().stream();
diff --git a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java
index 47e26e92..824e58e3 100644
--- a/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java
@@ -28,11 +28,11 @@ import java.io.IOException;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class IcnsRoundTripTest extends IcnsBaseTest {
+public class IcnsRoundTripTest extends AbstractIcnsTest {
// 16x16 test image
private static final int[][] IMAGE = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
@@ -48,7 +48,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0xff000000;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 2 * 16 * 16 / 8 + 4 + 4 + 16 * 16);
bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
@@ -85,7 +85,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0xff0000ff;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 16 * 16 / 8);
bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
@@ -131,7 +131,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0x000000ff;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8);
bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
@@ -187,7 +187,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0xff0000ff;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16);
bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
@@ -217,7 +217,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0x00cccccc;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8);
bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
@@ -274,7 +274,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0x00cccccc;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16);
bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
@@ -311,7 +311,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0x00cccccc;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8);
bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
@@ -368,7 +368,7 @@ public class IcnsRoundTripTest extends IcnsBaseTest {
final int foreground = 0xff000000;
final int background = 0xffcccccc;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.bigEndian(baos)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.bigEndian(baos)) {
bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16);
bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
diff --git a/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java
index f7118e04..260a313e 100644
--- a/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java
@@ -31,7 +31,7 @@ import java.util.Map;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.internal.Debug;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Test;
@@ -45,7 +45,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Override
public byte[] generateBitmap(final int foreground, final int background, final int paletteSize) throws IOException, ImagingException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
for (int i = 0; i < paletteSize; i++) {
bos.write4Bytes(0);
@@ -78,7 +78,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Override
public byte[] generateBitmap(final int foreground, final int background, final int paletteSize) throws IOException, ImagingException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
bos.write3Bytes(background);
bos.write(0);
@@ -115,7 +115,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Override
public byte[] generateBitmap(final int foreground, final int background, final int paletteSize) throws IOException, ImagingException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
for (int i = 0; i < paletteSize; i++) {
bos.write4Bytes(0);
@@ -147,7 +147,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
private static final class GeneratorFor32BitBitmaps implements BitmapGenerator {
public byte[] generate32bitRGBABitmap(final int foreground, final int background, final int paletteSize, final boolean writeMask) throws IOException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
for (int i = 0; i < paletteSize; i++) {
bos.write4Bytes(0);
@@ -187,7 +187,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Override
public byte[] generateBitmap(final int foreground, final int background, final int paletteSize) throws IOException, ImagingException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
bos.write3Bytes(background);
bos.write(0);
@@ -220,7 +220,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Override
public byte[] generateBitmap(final int foreground, final int background, final int paletteSize) throws IOException, ImagingException {
try (ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.littleEndian(byteArrayStream)) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(byteArrayStream)) {
// Palette
bos.write3Bytes(background);
bos.write(0);
@@ -275,7 +275,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
final int foreground = 0xFFF000E0;
final int background = 0xFF102030;
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
// For 32 bit RGBA, the AND mask can be missing:
final byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap(foreground, background, 0, false);
writeICONDIR(bos, 0, 1, 1);
@@ -290,7 +290,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Test
public void testAlphaVersusANDMask() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap(0xFF000000, 0x00000000, 0, true);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
@@ -313,7 +313,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
final BitmapGenerator bitmapGenerator = entry.getValue();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, bitDepth <= 8 ? 1 << bitDepth : 0);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 3 /* width, should be 16 */, 4 /*
@@ -336,7 +336,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Test
public void testBitfieldCompression() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap(0xFFFF0000, 0xFFFFFFFF, 0, true);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
@@ -359,7 +359,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
final BitmapGenerator bitmapGenerator = entry.getValue();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, 2);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 3, 4, 7, 20, 11, 19, 40 + bitmap.length);
@@ -374,7 +374,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
@Test
public void testFullyTransparent32bitRGBA() throws Exception {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = new GeneratorFor32BitBitmaps().generate32bitRGBABitmap(0x00000000, 0x00FFFFFF, 0, true);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
@@ -395,7 +395,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
final BitmapGenerator bitmapGenerator = entry.getValue();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, bitDepth <= 8 ? 1 << bitDepth : 0);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth, 40 + bitmap.length);
@@ -416,7 +416,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
final BitmapGenerator bitmapGenerator = entry.getValue();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try (BinaryOutputStream bos = BinaryOutputStream.littleEndian(baos)) {
+ try (AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.littleEndian(baos)) {
final byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, bitDepth <= 8 ? 1 << bitDepth : 0);
writeICONDIR(bos, 0, 1, 1);
writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth, 40 + bitmap.length);
@@ -467,7 +467,7 @@ public class IcoRoundtripTest extends AbstractIcoTest {
verify(dstImage, foreground, background);
}
- private void writeBITMAPINFOHEADER(final BinaryOutputStream bos, final int width, final int height, final int colorPlanes, final int bitCount,
+ private void writeBITMAPINFOHEADER(final AbstractBinaryOutputStream bos, final int width, final int height, final int colorPlanes, final int bitCount,
final int compression, final int colorsUsed, final int colorsImportant) throws IOException {
// BITMAPINFOHEADER
bos.write4Bytes(40); // biSize, always 40 for BITMAPINFOHEADER
@@ -483,14 +483,14 @@ public class IcoRoundtripTest extends AbstractIcoTest {
bos.write4Bytes(colorsImportant); // colors important
}
- private void writeICONDIR(final BinaryOutputStream bos, final int reserved, final int type, final int count) throws IOException {
+ private void writeICONDIR(final AbstractBinaryOutputStream bos, final int reserved, final int type, final int count) throws IOException {
bos.write2Bytes(reserved);
bos.write2Bytes(type);
bos.write2Bytes(count);
}
- private void writeICONDIRENTRY(final BinaryOutputStream bos, final int width, final int height, final int colorCount, final int reserved, final int planes,
- final int bitCount, final int bytesInRes) throws IOException {
+ private void writeICONDIRENTRY(final AbstractBinaryOutputStream bos, final int width, final int height, final int colorCount, final int reserved,
+ final int planes, final int bitCount, final int bytesInRes) throws IOException {
bos.write(width);
bos.write(height);
bos.write(colorCount);
@@ -500,5 +500,4 @@ public class IcoRoundtripTest extends AbstractIcoTest {
bos.write4Bytes(bytesInRes);
bos.write4Bytes(22); // image comes immediately after this
}
-
}
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/AbstractJpegTest.java
similarity index 91%
rename from src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/jpeg/AbstractJpegTest.java
index 24f6a029..a8925423 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/AbstractJpegTest.java
@@ -27,9 +27,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-public abstract class JpegBaseTest extends AbstractImagingTest {
+public abstract class AbstractJpegTest extends AbstractImagingTest {
- public static final ImageFilter imageFilter = JpegBaseTest::isJpeg;
+ public static final ImageFilter imageFilter = AbstractJpegTest::isJpeg;
protected static List<File> getJpegImages() throws IOException, ImagingException {
return getTestImages(imageFilter);
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
index bc8fd8ee..73574f7c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
-public class JpegReadTest extends JpegBaseTest {
+public class JpegReadTest extends AbstractJpegTest {
public static Stream<File> data() throws Exception {
return getJpegImages().stream();
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/AbstractIptcTest.java
similarity index 94%
rename from src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/AbstractIptcTest.java
index 28ea215a..0d9744df 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/AbstractIptcTest.java
@@ -26,8 +26,8 @@ import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
-public abstract class IptcBaseTest extends AbstractImagingTest {
- private static final ImageFilter HAS_IPTC_IMAGE_FILTER = IptcBaseTest::hasIptcData;
+public abstract class AbstractIptcTest extends AbstractImagingTest {
+ private static final ImageFilter HAS_IPTC_IMAGE_FILTER = AbstractIptcTest::hasIptcData;
private static final ImageFilter JPEG_IMAGE_FILTER = file -> file.getName().toLowerCase().endsWith(".jpg");
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
index f6fc9fe9..75d5e0b8 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcAddTest.java
@@ -33,7 +33,7 @@ import org.apache.commons.imaging.formats.jpeg.JpegPhotoshopMetadata;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
-public class IptcAddTest extends IptcBaseTest {
+public class IptcAddTest extends AbstractIptcTest {
public static Stream<File> data() throws Exception {
return getJpegImages().stream();
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
index 48a64f31..e2000f60 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcDumpTest.java
@@ -30,7 +30,7 @@ import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
-public class IptcDumpTest extends IptcBaseTest {
+public class IptcDumpTest extends AbstractIptcTest {
public static Stream<File> data() throws Exception {
return getImagesWithIptcData().stream();
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParserTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParserTest.java
index 8461fc9c..fae09493 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParserTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParserTest.java
@@ -31,7 +31,7 @@ import java.util.List;
import org.apache.commons.imaging.ImagingException;
import org.apache.commons.imaging.bytesource.ByteSource;
-import org.apache.commons.imaging.common.BinaryOutputStream;
+import org.apache.commons.imaging.common.AbstractBinaryOutputStream;
import org.apache.commons.imaging.common.GenericImageMetadata.GenericImageMetadataItem;
import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
@@ -94,7 +94,7 @@ public class IptcParserTest {
// Write prefix including (optional)
final byte[] prefix;
try (ByteArrayOutputStream envelopeRecordStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.create(envelopeRecordStream, parser.getByteOrder())) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.create(envelopeRecordStream, parser.getByteOrder())) {
if (forceUtf8 || value.contains("€")) {
// Either using UTF-8 is forced of the value contains € (which isn't a character defined in ISO-8859-1):
bos.write(IptcConstants.IPTC_RECORD_TAG_MARKER);
@@ -121,7 +121,7 @@ public class IptcParserTest {
final byte[] applicationRecord;
try (ByteArrayOutputStream applicationRecordStream = new ByteArrayOutputStream();
- BinaryOutputStream bos = BinaryOutputStream.create(applicationRecordStream, parser.getByteOrder())) {
+ AbstractBinaryOutputStream bos = AbstractBinaryOutputStream.create(applicationRecordStream, parser.getByteOrder())) {
bos.write(IptcConstants.IPTC_RECORD_TAG_MARKER);
bos.write(IptcConstants.IPTC_APPLICATION_2_RECORD_NUMBER);
bos.write(IptcTypes.CAPTION_ABSTRACT.type);
diff --git a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
index d8161153..cc2f2a21 100644
--- a/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcUpdateTest.java
@@ -36,7 +36,7 @@ import org.apache.commons.imaging.formats.jpeg.JpegPhotoshopMetadata;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
-public class IptcUpdateTest extends IptcBaseTest {
+public class IptcUpdateTest extends AbstractIptcTest {
public static Stream<File> data() throws Exception {
return getImagesWithIptcData().stream();
diff --git a/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/rgbe/AbstractRgbeTest.java
similarity index 91%
rename from src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/rgbe/AbstractRgbeTest.java
index a585c1a1..6a2b6786 100644
--- a/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/rgbe/AbstractRgbeTest.java
@@ -26,9 +26,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-public abstract class RgbeBaseTest extends AbstractImagingTest {
+public abstract class AbstractRgbeTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = RgbeBaseTest::isRgbe;
+ private static final ImageFilter IMAGE_FILTER = AbstractRgbeTest::isRgbe;
private static boolean isRgbe(final File file) throws IOException {
final ImageFormat format = Imaging.guessFormat(file);
diff --git a/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java b/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java
index 1568a9cb..65e8aa23 100644
--- a/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/rgbe/RgbeReadTest.java
@@ -33,7 +33,7 @@ import org.apache.commons.imaging.internal.Debug;
import org.apache.commons.imaging.test.TestResources;
import org.junit.jupiter.api.Test;
-public class RgbeReadTest extends RgbeBaseTest {
+public class RgbeReadTest extends AbstractRgbeTest {
@Test
public void test() throws IOException, ImagingException {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/AbstractTiffTest.java
similarity index 91%
rename from src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/tiff/AbstractTiffTest.java
index d82fcc55..303a3651 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/AbstractTiffTest.java
@@ -27,9 +27,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-public abstract class TiffBaseTest extends AbstractImagingTest {
+public abstract class AbstractTiffTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = TiffBaseTest::isTiff;
+ private static final ImageFilter IMAGE_FILTER = AbstractTiffTest::isTiff;
private static boolean isTiff(final File file) throws IOException {
final ImageFormat format = Imaging.guessFormat(file);
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBigTiffTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBigTiffTest.java
index c2f2dd7a..94abf5c3 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBigTiffTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffBigTiffTest.java
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
/**
* Reads files in the BigTIFF samples folder and compares the BigTIFF files against the standard "classic" tiff image.
*/
-public class TiffBigTiffTest extends TiffBaseTest {
+public class TiffBigTiffTest extends AbstractTiffTest {
private boolean doImagesMatch(final int w, final int h, final int[] classicRgb, final BufferedImage image) {
final int iW = image.getWidth();
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
index 2946b5d8..2b45e54b 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffCcittTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.imaging.formats.tiff.itu_t4.T4AndT6Compression;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class TiffCcittTest extends TiffBaseTest {
+public class TiffCcittTest extends AbstractTiffTest {
/**
* Generates the next combination of elements in the sequence array, with each element having a maximum value of max. Initially, the sequence should be set
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointMultivariableTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointMultivariableTest.java
index 4db4cca8..cb887e99 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointMultivariableTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointMultivariableTest.java
@@ -46,7 +46,7 @@ import org.junit.jupiter.api.io.TempDir;
* At this time, Commons Imaging does not fully implement the floating-point specification. Currently, this class only tests the use of uncompressed floating
* point values in the Strips format. The Tiles format is not exercised.
*/
-public class TiffFloatingPointMultivariableTest extends TiffBaseTest {
+public class TiffFloatingPointMultivariableTest extends AbstractTiffTest {
@TempDir
Path tempDir;
@@ -224,7 +224,7 @@ public class TiffFloatingPointMultivariableTest extends TiffBaseTest {
final TiffContents contents = tiffReader.readDirectories(byteSource, true, // indicates that application should read image data, if present
FormatCompliance.getDefault());
final TiffDirectory directory = contents.directories.get(0);
- final TiffRasterData raster = directory.getRasterData(new TiffImagingParameters());
+ final AbstractTiffRasterData raster = directory.getRasterData(new TiffImagingParameters());
assertNotNull(raster, "Failed to get raster from " + name);
assertEquals(2, raster.getSamplesPerPixel(), "Invalid samples per pixel in " + name);
for (int iPlane = 0; iPlane < 2; iPlane++) {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointReadTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointReadTest.java
index 98fc9c90..83d530e5 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointReadTest.java
@@ -43,11 +43,11 @@ import org.junit.jupiter.api.Test;
*/
public class TiffFloatingPointReadTest {
- private void checkSubImage(final File target, final TiffRasterData fullRaster, final int x0, final int y0, final int width, final int height)
+ private void checkSubImage(final File target, final AbstractTiffRasterData fullRaster, final int x0, final int y0, final int width, final int height)
throws ImagingException, IOException {
final TiffImagingParameters params = new TiffImagingParameters();
params.setSubImage(x0, y0, width, height);
- final TiffRasterData partRaster = readRasterFromTIFF(target, params);
+ final AbstractTiffRasterData partRaster = readRasterFromTIFF(target, params);
assertEquals(width, partRaster.getWidth(), "Invalid width in partial for " + target.getName());
assertEquals(height, partRaster.getHeight(), "Invalid height in partial for " + target.getName());
for (int y = y0; y < y0 + height; y++) {
@@ -116,7 +116,7 @@ public class TiffFloatingPointReadTest {
* @throws ImagingException in the event of an unsupported or malformed file data element.
* @throws IOException in the event of an I/O error
*/
- private TiffRasterData readRasterFromTIFF(final File target, final TiffImagingParameters params) throws ImagingException, IOException {
+ private AbstractTiffRasterData readRasterFromTIFF(final File target, final TiffImagingParameters params) throws ImagingException, IOException {
final ByteSource byteSource = ByteSource.file(target);
final TiffReader tiffReader = new TiffReader(true);
final TiffContents contents = tiffReader.readDirectories(byteSource, true, // indicates that application should read image data, if present
@@ -155,7 +155,7 @@ public class TiffFloatingPointReadTest {
// that the source file is organized using strips of 2 rows each.
// The source file is of dimensions 451x337.
// The dimensions of the sub-image are arbitrary
- TiffRasterData fullRaster = readRasterFromTIFF(target, new TiffImagingParameters());
+ AbstractTiffRasterData fullRaster = readRasterFromTIFF(target, new TiffImagingParameters());
int height = fullRaster.getHeight();
int width = fullRaster.getWidth();
// checks based on the 2-rows per strip model
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointRoundTripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointRoundTripTest.java
index 2a822781..d5060f63 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointRoundTripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffFloatingPointRoundTripTest.java
@@ -46,7 +46,7 @@ import org.junit.jupiter.api.io.TempDir;
* At this time, Commons Imaging does not fully implement the floating-point specification. Currently, this class only tests the use of uncompressed floating
* point values in the Strips format. The Tiles format is not exercised.
*/
-public class TiffFloatingPointRoundTripTest extends TiffBaseTest {
+public class TiffFloatingPointRoundTripTest extends AbstractTiffTest {
@TempDir
Path tempDir;
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffJpegTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffJpegTest.java
index 017ba4d0..fd48155d 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffJpegTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffJpegTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
/**
* Reads files in the BigTIFF samples folder and compares the BigTIFF files against the standard "classic" tiff image.
*/
-public class TiffJpegTest extends TiffBaseTest {
+public class TiffJpegTest extends AbstractTiffTest {
static final String[] testSet0 = { "TestSample.tiff", "TestJpegStrips.tiff", "TestJpegTiles.tiff", "TestJpegStripsRgb.tiff", "TestJpegTilesRgb.tiff",
"TestJpegCMYK.tiff" };
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
index f2470632..fa32d564 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffLzwTest.java
@@ -35,7 +35,7 @@ import org.apache.commons.imaging.mylzw.MyLzwDecompressor;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-public class TiffLzwTest extends TiffBaseTest {
+public class TiffLzwTest extends AbstractTiffTest {
private void compressRoundtripAndValidate(final byte[] src) throws IOException, ImagingException {
final boolean DEBUG = false;
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataIntTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataIntTest.java
index 1adc7182..c0804ce9 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataIntTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataIntTest.java
@@ -31,7 +31,7 @@ public class TiffRasterDataIntTest {
int width = 11;
int height = 10;
int[] data;
- TiffRasterData raster;
+ AbstractTiffRasterData raster;
float meanValue;
public TiffRasterDataIntTest() {
@@ -72,7 +72,7 @@ public class TiffRasterDataIntTest {
try {
final int[] sample = new int[100];
- final TiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
+ final AbstractTiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
raster.getIntValue(11, 11);
fail("Access method getValue() did not detect bad coordinates");
} catch (final IllegalArgumentException illArgEx) {
@@ -80,7 +80,7 @@ public class TiffRasterDataIntTest {
}
try {
final int[] sample = new int[100];
- final TiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
+ final AbstractTiffRasterData raster = new TiffRasterDataInt(10, 10, sample);
raster.setValue(11, 11, 5.0f);
fail("Access method setValue() did not detect bad coordinates");
} catch (final IllegalArgumentException illArgEx) {
@@ -192,7 +192,7 @@ public class TiffRasterDataIntTest {
*/
@Test
public void testSetValue() {
- final TiffRasterData instance = new TiffRasterDataInt(width, height);
+ final AbstractTiffRasterData instance = new TiffRasterDataInt(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int index = y * width + height;
@@ -211,7 +211,7 @@ public class TiffRasterDataIntTest {
*/
@Test
public void testSetValue2() {
- final TiffRasterData instance = new TiffRasterDataInt(width, height, 2);
+ final AbstractTiffRasterData instance = new TiffRasterDataInt(width, height, 2);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int index = y * width + height;
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataTest.java
index 68c6ca6b..e3b461bd 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterDataTest.java
@@ -31,7 +31,7 @@ public class TiffRasterDataTest {
int width = 11;
int height = 10;
float[] data;
- TiffRasterData raster;
+ AbstractTiffRasterData raster;
float meanValue;
public TiffRasterDataTest() {
@@ -69,7 +69,7 @@ public class TiffRasterDataTest {
@Test
public void testBadCoordinates() {
final float[] f = new float[100];
- final TiffRasterData instance = new TiffRasterDataFloat(10, 10, 1, f);
+ final AbstractTiffRasterData instance = new TiffRasterDataFloat(10, 10, 1, f);
assertThrows(IllegalArgumentException.class, () -> instance.getValue(11, 11), "Access method getValue() did not detect bad coordinates");
assertThrows(IllegalArgumentException.class, () -> instance.setValue(11, 11, 5.0f), "Access method setValue() did not detect bad coordinates");
assertThrows(IllegalArgumentException.class, () -> instance.getValue(1, 1, 2), "Access method setValue() did not detect bad sample index");
@@ -185,7 +185,7 @@ public class TiffRasterDataTest {
*/
@Test
public void testSetValue() {
- final TiffRasterData instance = new TiffRasterDataFloat(width, height);
+ final AbstractTiffRasterData instance = new TiffRasterDataFloat(width, height);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int index = y * width + height;
@@ -204,7 +204,7 @@ public class TiffRasterDataTest {
*/
@Test
public void testSetValue2() {
- final TiffRasterData instance = new TiffRasterDataFloat(width, height, 2);
+ final AbstractTiffRasterData instance = new TiffRasterDataFloat(width, height, 2);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int index = y * width + height;
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatisticsTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatisticsTest.java
index 0de27475..dbd34e32 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatisticsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRasterStatisticsTest.java
@@ -33,7 +33,7 @@ public class TiffRasterStatisticsTest {
int width = 11;
int height = 10;
float[] data;
- TiffRasterData raster;
+ AbstractTiffRasterData raster;
float meanValue;
TiffRasterStatistics stat0;
TiffRasterStatistics stat1;
@@ -101,7 +101,7 @@ public class TiffRasterStatisticsTest {
final float[] zero = new float[100];
Arrays.fill(zero, 10);
- final TiffRasterData zeroData = new TiffRasterDataFloat(10, 10, zero);
+ final AbstractTiffRasterData zeroData = new TiffRasterDataFloat(10, 10, zero);
final TiffRasterStatistics zeroStat = zeroData.getSimpleStatistics(10);
assertEquals(0.0f, zeroStat.getMeanValue(), "Invalid mean data for excluded value");
}
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadImageInfoTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadImageInfoTest.java
index cc19df13..adcd2dd1 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadImageInfoTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadImageInfoTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
* Performs a test on the ImageInfo returned from TIFF to confirm that it contains the specified value for a particular target. This test is used to confirm
* that the TiffImageParser is correctly interpreting the ImageInfo values.
*/
-public class TiffReadImageInfoTest extends TiffBaseTest {
+public class TiffReadImageInfoTest extends AbstractTiffTest {
// The form of the test set is
// 0. target file name
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java
index 17705d16..14e0f564 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadTest.java
@@ -32,7 +32,7 @@ import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class TiffReadTest extends TiffBaseTest {
+public class TiffReadTest extends AbstractTiffTest {
@Test
public void test() throws Exception {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
index 0f8d451b..0ae6fbfc 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
@@ -35,7 +35,7 @@ import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;
import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
import org.junit.jupiter.api.Test;
-public class TiffReadWriteTagsTest extends TiffBaseTest {
+public class TiffReadWriteTagsTest extends AbstractTiffTest {
@Test
public void testReadWriteTags() throws ImagingException, ImagingException, IOException {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundTripInt32Test.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundTripInt32Test.java
index e699ca03..8286808f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundTripInt32Test.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundTripInt32Test.java
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.io.TempDir;
* matches the original values. The primary purpose of this test is to verify that the TIFF data reader classes behave correctly when reading raster data in
* various formats.
*/
-public class TiffRoundTripInt32Test extends TiffBaseTest {
+public class TiffRoundTripInt32Test extends AbstractTiffTest {
@TempDir
Path tempDir;
@@ -124,14 +124,14 @@ public class TiffRoundTripInt32Test extends TiffBaseTest {
final TiffContents contents = tiffReader.readDirectories(byteSource, true, // indicates that application should read image data, if present
FormatCompliance.getDefault());
final TiffDirectory directory = contents.directories.get(0);
- final TiffRasterData rdInt = directory.getRasterData(null);
+ final AbstractTiffRasterData rdInt = directory.getRasterData(null);
final int[] test = rdInt.getIntData();
for (int j = 0; j < sample.length; j++) {
assertEquals(sample[j], test[j], "Extracted data does not match original, test " + name + ": " + i + ", index " + j);
}
final TiffImagingParameters params = new TiffImagingParameters();
params.setSubImage(2, 2, width - 4, height - 4);
- final TiffRasterData rdSub = directory.getRasterData(params);
+ final AbstractTiffRasterData rdSub = directory.getRasterData(params);
assertEquals(width - 4, rdSub.getWidth(), "Invalid sub-image width");
assertEquals(height - 4, rdSub.getHeight(), "Invalid sub-image height");
for (int x = 2; x < width - 2; x++) {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
index baa18912..2d937711 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffRoundtripTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.imaging.formats.tiff.constants.TiffConstants;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class TiffRoundtripTest extends TiffBaseTest {
+public class TiffRoundtripTest extends AbstractTiffTest {
@Test
public void test() throws Exception {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffShortIntRoundTripTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffShortIntRoundTripTest.java
index 4acbe647..4fc2d6eb 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffShortIntRoundTripTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffShortIntRoundTripTest.java
@@ -41,7 +41,7 @@ import org.junit.jupiter.api.io.TempDir;
* matches the original values. The primary purpose of this test is to verify that the TIFF data reader classes behave correctly when reading raster data in
* various formats.
*/
-public class TiffShortIntRoundTripTest extends TiffBaseTest {
+public class TiffShortIntRoundTripTest extends AbstractTiffTest {
@TempDir
Path tempDir;
@@ -120,14 +120,14 @@ public class TiffShortIntRoundTripTest extends TiffBaseTest {
final TiffContents contents = tiffReader.readDirectories(byteSource, true, // indicates that application should read image data, if present
FormatCompliance.getDefault());
final TiffDirectory directory = contents.directories.get(0);
- final TiffRasterData rdInt = directory.getRasterData(null);
+ final AbstractTiffRasterData rdInt = directory.getRasterData(null);
final int[] test = rdInt.getIntData();
for (int j = 0; j < sample.length; j++) {
assertEquals(sample[j], test[j], "Extracted data does not match original, test " + name + ": " + i + ", index " + j);
}
final TiffImagingParameters params = new TiffImagingParameters();
params.setSubImage(2, 2, width - 4, height - 4);
- final TiffRasterData rdSub = directory.getRasterData(params);
+ final AbstractTiffRasterData rdSub = directory.getRasterData(params);
assertEquals(width - 4, rdSub.getWidth(), "Invalid sub-image width");
assertEquals(height - 4, rdSub.getHeight(), "Invalid sub-image height");
for (int x = 2; x < width - 2; x++) {
diff --git a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
index 3c8ddc17..b1f4495f 100644
--- a/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/tiff/TiffSubImageTest.java
@@ -29,7 +29,7 @@ import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
import org.junit.jupiter.api.Test;
-public class TiffSubImageTest extends TiffBaseTest {
+public class TiffSubImageTest extends AbstractTiffTest {
final List<File> imageFileList;
TiffSubImageTest() throws IOException, ImagingException {
diff --git a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/wbmp/AbstractWbmpTest.java
similarity index 88%
rename from src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/wbmp/AbstractWbmpTest.java
index ce57d273..7629158c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/wbmp/AbstractWbmpTest.java
@@ -21,8 +21,8 @@ import java.util.List;
import org.apache.commons.imaging.AbstractImagingTest;
import org.apache.commons.imaging.ImagingException;
-public abstract class WbmpBaseTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = WbmpBaseTest::isWbmp;
+public abstract class AbstractWbmpTest extends AbstractImagingTest {
+ private static final ImageFilter IMAGE_FILTER = AbstractWbmpTest::isWbmp;
private static boolean isWbmp(final File file) {
return file.getName().toLowerCase().endsWith(".wbmp");
diff --git a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
index 25e9cf5f..3fefe7d1 100644
--- a/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/wbmp/WbmpReadTest.java
@@ -27,7 +27,7 @@ import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class WbmpReadTest extends WbmpBaseTest {
+public class WbmpReadTest extends AbstractWbmpTest {
@Test
public void test() throws Exception {
diff --git a/src/test/java/org/apache/commons/imaging/formats/webp/WebPBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/webp/AbstractWebPTest.java
similarity index 93%
rename from src/test/java/org/apache/commons/imaging/formats/webp/WebPBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/webp/AbstractWebPTest.java
index 8c48abbd..0c10bab9 100644
--- a/src/test/java/org/apache/commons/imaging/formats/webp/WebPBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/webp/AbstractWebPTest.java
@@ -28,9 +28,9 @@ import org.apache.commons.imaging.ImageFormats;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.ImagingException;
-public abstract class WebPBaseTest extends AbstractImagingTest {
+public abstract class AbstractWebPTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = WebPBaseTest::isWebP;
+ private static final ImageFilter IMAGE_FILTER = AbstractWebPTest::isWebP;
protected static List<File> getWebPImages() throws IOException, ImagingException {
return getTestImages(IMAGE_FILTER);
diff --git a/src/test/java/org/apache/commons/imaging/formats/webp/WebPDumpTest.java b/src/test/java/org/apache/commons/imaging/formats/webp/WebPDumpTest.java
index 4d70b2ac..0f5790be 100644
--- a/src/test/java/org/apache/commons/imaging/formats/webp/WebPDumpTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/webp/WebPDumpTest.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.params.provider.MethodSource;
/**
* Test the methods that dump data into streams.
*/
-public class WebPDumpTest extends WebPBaseTest {
+public class WebPDumpTest extends AbstractWebPTest {
/**
* @param imageFile parameterized test image.
diff --git a/src/test/java/org/apache/commons/imaging/formats/webp/WebPMetadataTest.java b/src/test/java/org/apache/commons/imaging/formats/webp/WebPMetadataTest.java
index 3e6fd6d7..1534719e 100644
--- a/src/test/java/org/apache/commons/imaging/formats/webp/WebPMetadataTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/webp/WebPMetadataTest.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests for the WebP metadata.
*/
-public class WebPMetadataTest extends WebPBaseTest {
+public class WebPMetadataTest extends AbstractWebPTest {
/**
* @throws Exception if it cannot open the images.
diff --git a/src/test/java/org/apache/commons/imaging/formats/webp/WebPReadTest.java b/src/test/java/org/apache/commons/imaging/formats/webp/WebPReadTest.java
index 0ef3616a..0e6b185c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/webp/WebPReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/webp/WebPReadTest.java
@@ -39,7 +39,7 @@ import org.junit.jupiter.params.provider.MethodSource;
/**
* Tests that read WebP images.
*/
-public class WebPReadTest extends WebPBaseTest {
+public class WebPReadTest extends AbstractWebPTest {
/**
* Not implemented yet.
diff --git a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java b/src/test/java/org/apache/commons/imaging/formats/xbm/AbstractXbmTest.java
similarity index 88%
rename from src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java
rename to src/test/java/org/apache/commons/imaging/formats/xbm/AbstractXbmTest.java
index e9667fb5..37d7f588 100644
--- a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmBaseTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/xbm/AbstractXbmTest.java
@@ -21,9 +21,9 @@ import java.util.List;
import org.apache.commons.imaging.AbstractImagingTest;
import org.apache.commons.imaging.ImagingException;
-public abstract class XbmBaseTest extends AbstractImagingTest {
+public abstract class AbstractXbmTest extends AbstractImagingTest {
- private static final ImageFilter IMAGE_FILTER = XbmBaseTest::isXbm;
+ private static final ImageFilter IMAGE_FILTER = AbstractXbmTest::isXbm;
private static boolean isXbm(final File file) {
return file.getName().toLowerCase().endsWith(".xbm");
diff --git a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
index df7bdb56..9354dabe 100644
--- a/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
+++ b/src/test/java/org/apache/commons/imaging/formats/xbm/XbmReadTest.java
@@ -27,7 +27,7 @@ import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.internal.Debug;
import org.junit.jupiter.api.Test;
-public class XbmReadTest extends XbmBaseTest {
+public class XbmReadTest extends AbstractXbmTest {
@Test
public void test() throws Exception {