Skip to content

Proposal for a patch for Imaging-159 using a POJO #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 179 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
179 commits
Select commit Hold shift + click to select a range
16372b8
added class body
mgmechanics Jan 30, 2015
217abfa
finished work for parameter verbose only (meant as example)
mgmechanics Jan 30, 2015
ddd2052
added code for strict-parameter; corrected verbose-pm regarding a def…
mgmechanics Jan 30, 2015
584c46b
added code for fileName-parameter; corrected javadoc for verbose-para…
mgmechanics Jan 30, 2015
1edd229
added code for PARAM_KEY_XMP_XML
mgmechanics Jan 30, 2015
b215e4b
corrected javadoc
mgmechanics Jan 30, 2015
13a14d3
added code for PARAM_KEY_FORMAT
mgmechanics Jan 30, 2015
b8b1aef
added code for BUFFERED_IMAGE_FACTORY
mgmechanics Jan 30, 2015
07f98aa
PARAM_KEY_PIXEL_DENSITY
mgmechanics Jan 30, 2015
6957d07
corrected javadoc
mgmechanics Jan 30, 2015
56e9fd1
let inherit check methods
mgmechanics Jan 30, 2015
90377ff
added parameters for JPEG/JFIF
mgmechanics Jan 30, 2015
b7d5ce1
corrected javadoc
mgmechanics Jan 30, 2015
e4ca402
corrected javadoc
mgmechanics Jan 30, 2015
ff70685
doc
mgmechanics Jan 30, 2015
a5da7bd
added parameters for TIFF
mgmechanics Jan 30, 2015
9f54d06
doc
mgmechanics Jan 30, 2015
4189850
set default value for tiff compression
mgmechanics Jan 31, 2015
cc6ac0f
must have renamed verbose accidentally - corrected
mgmechanics Jan 31, 2015
39b9e67
provided class variables for default values
mgmechanics Jan 31, 2015
386c381
boolean parameters can be set via business methods
mgmechanics Feb 1, 2015
38f4b82
typo
mgmechanics Feb 2, 2015
cff75ed
doc
mgmechanics Feb 2, 2015
4712719
fixed boolean parameters (enable/disable)
mgmechanics Feb 3, 2015
2c3d9ca
removed resetX() methods
mgmechanics Feb 3, 2015
8ff6d0d
doc
mgmechanics Feb 3, 2015
ba7b7be
renamed parameter fileNameHint
mgmechanics Feb 6, 2015
f3605d3
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 6, 2015
95f01b6
fixed missing param tag
mgmechanics Feb 6, 2015
9bf64f3
removed unused import
mgmechanics Feb 6, 2015
ab48433
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 6, 2015
259ae2b
added missing param tag
mgmechanics Feb 6, 2015
f5db3ba
added missing @throws tags
mgmechanics Feb 6, 2015
4454b82
improved ensuring that the parameter object is not null
mgmechanics Feb 7, 2015
cede4fc
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
a6ac9ea
added missing @throws tags
mgmechanics Feb 7, 2015
b97e9ca
added note that I changed the file to licence header
mgmechanics Feb 7, 2015
996abd1
added note that I changed the file to licence header
mgmechanics Feb 7, 2015
bfc72c3
removed prefix "Tiff"
mgmechanics Feb 7, 2015
4a12446
added parameters for PCX (triggered by DcxImageParser.writeImage(fina…
mgmechanics Feb 7, 2015
8db737c
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
81d32db
added missing @throws tags
mgmechanics Feb 7, 2015
3a8e609
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
f8b45e3
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
03ff8c7
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
3b8392b
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
c51a6e6
removed unused import
mgmechanics Feb 7, 2015
a32f119
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
0c6a0c1
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
e082094
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
4a1bf67
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
13442b7
moved import for ImagingParameters on proper position
mgmechanics Feb 7, 2015
8122d35
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
83998e4
added bit depth
mgmechanics Feb 7, 2015
3c58f66
removed default value for compression level
mgmechanics Feb 7, 2015
b203d5a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
8e26d53
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
7bd251a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
479fee8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
7eb3b21
added missing @throws tags to javadoc
mgmechanics Feb 7, 2015
e2c8d09
added bit depth
mgmechanics Feb 7, 2015
e4e151d
set default values in constructor rather than in class
mgmechanics Feb 7, 2015
5f063ee
added force indexed color and true color
mgmechanics Feb 7, 2015
61b96ea
change types to native types were possible
mgmechanics Feb 7, 2015
c1a6979
change types to native types were possible
mgmechanics Feb 7, 2015
2d0d773
change types to native types were possible
mgmechanics Feb 7, 2015
eb3ddfb
change types to native types were possible
mgmechanics Feb 7, 2015
bf067ac
change types to native types were possible
mgmechanics Feb 7, 2015
9722ce1
removed default value for compression level
mgmechanics Feb 7, 2015
fc9bb64
added textChunks
mgmechanics Feb 7, 2015
3f43350
added textChunks as List
mgmechanics Feb 7, 2015
50601ae
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 7, 2015
a1d01d4
added parameters for PNM
mgmechanics Feb 7, 2015
51a7b3c
renamed method
mgmechanics Feb 8, 2015
5de82ae
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
3697cd9
removed unused import, added missing @throws tags to javadoc
mgmechanics Feb 8, 2015
93085b5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
8d8c816
added note that I changed the file to licence header
mgmechanics Feb 8, 2015
0562178
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
748f64f
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
8e1b272
added missing @throws tags to javadoc
mgmechanics Feb 8, 2015
ec03c5a
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
05d111d
removed unused import
mgmechanics Feb 8, 2015
60bb733
added note that I changed the file to licence header
mgmechanics Feb 8, 2015
342ddf5
change types to native types were possible
mgmechanics Feb 8, 2015
ede24e3
renamed method
mgmechanics Feb 8, 2015
44d89fe
Revert "renamed method"
mgmechanics Feb 8, 2015
3f30ef9
renamed method
mgmechanics Feb 8, 2015
9911252
typo
mgmechanics Feb 8, 2015
92607ad
added readThumbnails
mgmechanics Feb 8, 2015
215afc8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
a818a94
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
ee1f1a3
added compressionBlockSize
mgmechanics Feb 8, 2015
331e3f2
added t4 and t6 options for Tiff
mgmechanics Feb 8, 2015
016fdfd
improved readability of t4/t6 method names
mgmechanics Feb 8, 2015
2c96cf5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
53168a6
added subimage x, y, width and height
mgmechanics Feb 8, 2015
52a0c2b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
d8d628e
removed value which was never used
mgmechanics Feb 8, 2015
13a1684
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 8, 2015
ce0e256
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 11, 2015
bf29c05
added missing @throws tags to javadoc
mgmechanics Feb 11, 2015
2b6c1a2
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 11, 2015
ddac350
added missing @throws tags to javadoc
mgmechanics Feb 11, 2015
1aa72c4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 11, 2015
49b3b0a
added missing @throws tags to javadoc
mgmechanics Feb 11, 2015
9352398
corrected variable name
mgmechanics Feb 11, 2015
1841900
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 11, 2015
4eb2a80
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
7ce092b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
c42bcc9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
2904fbe
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
d9f198c
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
37d7054
made field final
mgmechanics Feb 12, 2015
223fbbf
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
7a5b3a9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
dd32969
made field final
mgmechanics Feb 12, 2015
183e7a0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
bc349a0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
ffe3da4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
3ac6708
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 12, 2015
fa250a1
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
24315f9
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
e33f8d2
made field final to get told if I broke something
mgmechanics Feb 13, 2015
8f86045
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
f1dfdce
made field final to get told if I broke something
mgmechanics Feb 13, 2015
e67a700
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
11e23ec
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
fdd1249
made field final to get told if I broke something
mgmechanics Feb 13, 2015
43ee3f1
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
cffd5ec
made field final to get told if I broke something
mgmechanics Feb 13, 2015
55faed2
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
8ec13e8
made field final to get told if I broke something
mgmechanics Feb 13, 2015
58a3155
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
d90b702
made field final to get told if I broke something
mgmechanics Feb 13, 2015
eb20439
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
15c16ae
made field final to get told if I broke something
mgmechanics Feb 13, 2015
be94d28
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
d3f735d
made field final to get told if I broke something
mgmechanics Feb 13, 2015
6ad55c8
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
bbb966b
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
9497a46
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
9086d93
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
eaeddf5
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
fc7bc8e
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
34e69d0
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
4d6ee12
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
94402c4
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
59cf880
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
39037ef
Replaced parameter Map<String, Object> by ImagingParameters
mgmechanics Feb 13, 2015
5c55338
Replaced parameter Map<String, Object> by ImagingParameters - removed…
mgmechanics Feb 13, 2015
5a45484
took over javadoc from class TiffConstants
mgmechanics Feb 13, 2015
0a24438
took over javadoc from class TiffConstants
mgmechanics Feb 13, 2015
c976b8a
removed unused String PARAM_KEY_ fields
mgmechanics Feb 13, 2015
749cbb2
removed unused String PARAM_KEY_ fields
mgmechanics Feb 13, 2015
54ed80d
removed unused String PARAM_KEY_ fields
mgmechanics Feb 13, 2015
819fee5
removed unused String PARAM_KEY_ fields
mgmechanics Feb 13, 2015
6bc6883
fixed mistake: true must returned if the value is NOT null
mgmechanics Feb 14, 2015
b8a0266
removed unused imports
mgmechanics Feb 14, 2015
fb80d9f
if a parameter object is provided but there is no BufferedImageFactor…
mgmechanics Feb 14, 2015
462a943
renamed some methods for accessing boolean parameters to have them al…
mgmechanics Feb 14, 2015
4b79c82
removed comment about "Map params" argument because it was replaced b…
mgmechanics Feb 14, 2015
afce5be
setting read thumbnails param more elegant
mgmechanics Feb 18, 2015
f197352
doc
mgmechanics Feb 23, 2015
2cbee0d
reverted unrelated modifications
mgmechanics Feb 23, 2015
43e4431
doc
mgmechanics Feb 23, 2015
8639f88
doc
mgmechanics Feb 23, 2015
832402a
doc
mgmechanics Feb 23, 2015
5d03d43
doc
mgmechanics Feb 23, 2015
9521624
set missing default values
mgmechanics Feb 23, 2015
405eab0
shortened field name
mgmechanics Feb 23, 2015
a1eaf9c
renamed method
mgmechanics Feb 23, 2015
99bc27e
set parameter name in error message
mgmechanics Feb 23, 2015
ef43d0a
set parameter name in error message
mgmechanics Feb 23, 2015
c27bc68
added tests
mgmechanics Feb 23, 2015
3817976
added more tests
mgmechanics Feb 24, 2015
862469e
implemented plain setters even for boolean values
mgmechanics Feb 24, 2015
42cc793
doc
mgmechanics Feb 24, 2015
d36b30d
fixed error in javadoc - replaced "{@false}" by "{@code false}"
mgmechanics Mar 25, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 28 additions & 48 deletions src/main/java/org/apache/commons/imaging/ImageParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.apache.commons.imaging.common.BinaryFileParser;
import org.apache.commons.imaging.common.BufferedImageFactory;
Expand Down Expand Up @@ -76,24 +75,6 @@
* the intentions of the original. Therefore, you should not assume
* that the documentation is perfect, especially in the more obscure
* and specialized areas of implementation.
*
* <h4>The "Map params" argument</h4>
*
* Many of the methods specified by this class accept an argument of
* type Map giving a list of parameters to be used when processing an
* image. For example, some of the output formats permit the specification
* of different kinds of image compression or color models. Some of the
* reading methods permit the calling application to require strict
* format compliance. In many cases, however, an application will not
* require the use of this argument. While some of the ImageParser
* implementations check for (and ignore) null arguments for this parameter,
* not all of them do (at least not at the time these notes were written).
* Therefore, a prudent programmer will always supply an valid, though
* empty instance of a Map implementation when calling such methods.
* Generally, the java HashMap class is useful for this purpose.
*
* <p>Additionally, developers creating or enhancing classes derived
* from ImageParser are encouraged to include such checks in their code.
*/
public abstract class ImageParser extends BinaryFileParser {

Expand Down Expand Up @@ -169,7 +150,7 @@ public final ImageMetadata getMetadata(final ByteSource byteSource) throws Image
* implementation.
* @throws IOException In the event of unsuccessful data read operation.
*/
public abstract ImageMetadata getMetadata(ByteSource byteSource, Map<String, Object> params)
public abstract ImageMetadata getMetadata(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand Down Expand Up @@ -215,7 +196,7 @@ public final ImageMetadata getMetadata(final byte[] bytes) throws ImageReadExcep
* parser implementation.
* @throws IOException In the event of unsuccessful data read operation.
*/
public final ImageMetadata getMetadata(final byte[] bytes, final Map<String, Object> params)
public final ImageMetadata getMetadata(final byte[] bytes, final ImagingParameters params)
throws ImageReadException, IOException {
return getMetadata(new ByteSourceArray(bytes), params);
}
Expand Down Expand Up @@ -264,7 +245,7 @@ public final ImageMetadata getMetadata(final File file) throws ImageReadExceptio
* @throws IOException In the event of unsuccessful file read or
* access operation.
*/
public final ImageMetadata getMetadata(final File file, final Map<String, Object> params)
public final ImageMetadata getMetadata(final File file, final ImagingParameters params)
throws ImageReadException, IOException {
if (getDebug()) {
System.out.println(getName() + ".getMetadata" + ": "
Expand Down Expand Up @@ -302,7 +283,7 @@ public final ImageMetadata getMetadata(final File file, final Map<String, Object
* parser implementation.
* @throws IOException In the event of unsuccessful data access operation.
*/
public abstract ImageInfo getImageInfo(ByteSource byteSource, Map<String, Object> params)
public abstract ImageInfo getImageInfo(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand Down Expand Up @@ -348,7 +329,7 @@ public final ImageInfo getImageInfo(final ByteSource byteSource) throws ImageRea
* @throws IOException In the event of unsuccessful data
* access operation.
*/
public final ImageInfo getImageInfo(final byte[] bytes, final Map<String, Object> params)
public final ImageInfo getImageInfo(final byte[] bytes, final ImagingParameters params)
throws ImageReadException, IOException {
return getImageInfo(new ByteSourceArray(bytes), params);
}
Expand Down Expand Up @@ -377,7 +358,7 @@ public final ImageInfo getImageInfo(final byte[] bytes, final Map<String, Object
* @throws IOException In the event of unsuccessful file read or
* access operation.
*/
public final ImageInfo getImageInfo(final File file, final Map<String, Object> params)
public final ImageInfo getImageInfo(final File file, final ImagingParameters params)
throws ImageReadException, IOException {
if (!canAcceptExtension(file)) {
return null;
Expand Down Expand Up @@ -505,7 +486,7 @@ public final List<BufferedImage> getAllBufferedImages(final File file) throws Im
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map<String, Object> params)
public abstract BufferedImage getBufferedImage(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand All @@ -523,7 +504,7 @@ public abstract BufferedImage getBufferedImage(ByteSource byteSource, Map<String
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final BufferedImage getBufferedImage(final byte[] bytes, final Map<String, Object> params)
public final BufferedImage getBufferedImage(final byte[] bytes, final ImagingParameters params)
throws ImageReadException, IOException {
return getBufferedImage(new ByteSourceArray(bytes), params);
}
Expand All @@ -543,7 +524,7 @@ public final BufferedImage getBufferedImage(final byte[] bytes, final Map<String
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final BufferedImage getBufferedImage(final File file, final Map<String, Object> params)
public final BufferedImage getBufferedImage(final File file, final ImagingParameters params)
throws ImageReadException, IOException {
if (!canAcceptExtension(file)) {
return null;
Expand Down Expand Up @@ -575,7 +556,7 @@ public final BufferedImage getBufferedImage(final File file, final Map<String, O
* @throws IOException In the event of an write error from
* the output stream.
*/
public void writeImage(final BufferedImage src, final OutputStream os, final Map<String, Object> params)
public void writeImage(final BufferedImage src, final OutputStream os, final ImagingParameters params)
throws ImageWriteException, IOException {
os.close(); // we are obligated to close stream.

Expand Down Expand Up @@ -609,7 +590,7 @@ public final Dimension getImageSize(final byte[] bytes) throws ImageReadExceptio
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final Dimension getImageSize(final byte[] bytes, final Map<String, Object> params)
public final Dimension getImageSize(final byte[] bytes, final ImagingParameters params)
throws ImageReadException, IOException {
return getImageSize(new ByteSourceArray(bytes), params);
}
Expand Down Expand Up @@ -640,7 +621,7 @@ public final Dimension getImageSize(final File file) throws ImageReadException,
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final Dimension getImageSize(final File file, final Map<String, Object> params)
public final Dimension getImageSize(final File file, final ImagingParameters params)
throws ImageReadException, IOException {

if (!canAcceptExtension(file)) {
Expand All @@ -662,7 +643,7 @@ public final Dimension getImageSize(final File file, final Map<String, Object> p
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public abstract Dimension getImageSize(ByteSource byteSource, Map<String, Object> params)
public abstract Dimension getImageSize(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand All @@ -682,7 +663,7 @@ public abstract Dimension getImageSize(ByteSource byteSource, Map<String, Object
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public abstract String getXmpXml(ByteSource byteSource, Map<String, Object> params)
public abstract String getXmpXml(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand Down Expand Up @@ -715,7 +696,7 @@ public final byte[] getICCProfileBytes(final byte[] bytes) throws ImageReadExcep
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final byte[] getICCProfileBytes(final byte[] bytes, final Map<String, Object> params)
public final byte[] getICCProfileBytes(final byte[] bytes, final ImagingParameters params)
throws ImageReadException, IOException {
return getICCProfileBytes(new ByteSourceArray(bytes), params);
}
Expand Down Expand Up @@ -750,7 +731,7 @@ public final byte[] getICCProfileBytes(final File file) throws ImageReadExceptio
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public final byte[] getICCProfileBytes(final File file, final Map<String, Object> params)
public final byte[] getICCProfileBytes(final File file, final ImagingParameters params)
throws ImageReadException, IOException {
if (!canAcceptExtension(file)) {
return null;
Expand All @@ -777,7 +758,7 @@ public final byte[] getICCProfileBytes(final File file, final Map<String, Object
* parser implementation.
* @throws IOException In the event of unsuccessful read or access operation.
*/
public abstract byte[] getICCProfileBytes(ByteSource byteSource, Map<String, Object> params)
public abstract byte[] getICCProfileBytes(ByteSource byteSource, final ImagingParameters params)
throws ImageReadException, IOException;

/**
Expand Down Expand Up @@ -846,6 +827,7 @@ public final String dumpImageFile(final ByteSource byteSource)
* Write the ImageInfo and format-specific information for the image
* content of the specified byte source to a PrintWriter
*
* @param pw
* @param byteSource A valid byte source.
* @return A valid PrintWriter.
* @throws ImageReadException In the event that the the specified content
Expand Down Expand Up @@ -954,13 +936,12 @@ protected final boolean canAcceptExtension(final String filename) {
* @param params A valid Map object, or a null.
* @return A valid instance of an implementation of a IBufferedImageFactory.
*/
protected BufferedImageFactory getBufferedImageFactory(final Map<String, Object> params) {
if (params == null) {
protected BufferedImageFactory getBufferedImageFactory(final ImagingParameters params) {
if (params == null || params.isBufferedImageFactoryPresent() == false) {
return new SimpleBufferedImageFactory();
}

final BufferedImageFactory result = (BufferedImageFactory) params
.get(ImagingConstants.BUFFERED_IMAGE_FACTORY);
final BufferedImageFactory result = params.getBufferedImageFactory();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in JIRA, to me it feels strange to pass a BufferedImageFactory via a parameters object. But since this has been the case before this PR, I think we should first concentrate on getting the ImagingParameters in place and refactor the BufferedImageFactory later (if that is possible)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, really strange. Perhaps if it were the class only, not the instance, then I think it'd be fine.


if (null != result) {
return result;
Expand All @@ -970,19 +951,18 @@ protected BufferedImageFactory getBufferedImageFactory(final Map<String, Object>
}

/**
* A utility method to search a params specification and determine
* whether it contains the ImagingConstants&#46;PARAM_KEY_STRICT
* specification. Intended
* for internal use by ImageParser implementations.
* A utility method to whether we have a parameter object and if the STRICT
* flag is set or not.
* Intended for internal use by ImageParser implementations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some re-wording here

"Return whether to use a strict mode or not when reading or writing images."

or similar?

*
* @param params A valid Map object (or a null).
* @param params A valid parameter object (or a null).
* @return If the params specify strict format compliance, true;
* otherwise, false.
*/
public static boolean isStrict(final Map<String, Object> params) {
if (params == null || !params.containsKey(ImagingConstants.PARAM_KEY_STRICT)) {
public static boolean isStrict(final ImagingParameters params) {
if (params == null) {
return false;
}
return ((Boolean) params.get(ImagingConstants.PARAM_KEY_STRICT)).booleanValue();
return params.getStrict();
}
}
Loading