You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2018/08/25 10:40:52 UTC
[05/14] commons-imaging git commit: IMAGING-103: for checkstyle,
remove trailing space
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
index 7f71b9c..5721da4 100644
--- a/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/icns/IcnsType.java
@@ -170,7 +170,7 @@ enum IcnsType {
if (bytes.length != 4) {
throw new IllegalArgumentException("Invalid ICNS type");
}
- return ((0xff & bytes[0]) << 24)
+ return ((0xff & bytes[0]) << 24)
| ((0xff & bytes[1]) << 16)
| ((0xff & bytes[2]) << 8)
| (0xff & bytes[3]);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java b/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
index a7176ea..42d0f3a 100644
--- a/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
+++ b/src/main/java/org/apache/commons/imaging/formats/icns/Rle24Compression.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.icns;
final class Rle24Compression {
private Rle24Compression() {
}
-
+
public static byte[] decompress(final int width, final int height, final byte[] data) {
final int pixelCount = width * height;
final byte[] result = new byte[4 * pixelCount];
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java
----------------------------------------------------------------------
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 5764de3..4383633 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
@@ -380,7 +380,7 @@ public class IcoImageParser extends ImageParser {
final int xPelsPerMeter = read4Bytes("xPelsPerMeter", is,
"Not a Valid ICO File", getByteOrder()); // XPelsPerMeter (4 bytes), we don?t
// use this (0)
- final int yPelsPerMeter = read4Bytes("yPelsPerMeter", is,
+ final int yPelsPerMeter = read4Bytes("yPelsPerMeter", is,
"Not a Valid ICO File", getByteOrder()); // YPelsPerMeter (4 bytes), we don?t
// use this (0)
final int colorsUsed = read4Bytes("colorsUsed", is, "Not a Valid ICO File", getByteOrder()); // ColorsUsed
@@ -437,7 +437,7 @@ public class IcoImageParser extends ImageParser {
bos.write4Bytes(bitmapSize);
bos.write4Bytes(0);
bos.write4Bytes(bitmapPixelsOffset);
-
+
bos.write4Bytes(56);
bos.write4Bytes(width);
bos.write4Bytes(height / 2);
@@ -636,7 +636,7 @@ public class IcoImageParser extends ImageParser {
if (params.containsKey(PARAM_KEY_FORMAT)) {
params.remove(PARAM_KEY_FORMAT);
}
-
+
final PixelDensity pixelDensity = (PixelDensity) params.remove(PARAM_KEY_PIXEL_DENSITY);
if (!params.isEmpty()) {
@@ -798,7 +798,7 @@ public class IcoImageParser extends ImageParser {
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param byteSource
* File containing image data.
* @param params
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
index eac5b62..d4caacf 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegConstants.java
@@ -147,7 +147,7 @@ public final class JpegConstants {
0x30, // 0
0, });
public static final int CONST_8BIM = BinaryFunctions.charsToQuad('8', 'B', 'I', 'M');
-
+
private JpegConstants() {
}
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
index d7f5cce..4e3da6c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java
@@ -73,7 +73,7 @@ public class JpegImageMetadata implements ImageMetadata {
/**
* Returns the size of the first JPEG thumbnail found in the EXIF metadata.
- *
+ *
* @return Thumbnail width and height or null if no thumbnail.
* @throws ImageReadException
* @throws IOException
@@ -90,7 +90,7 @@ public class JpegImageMetadata implements ImageMetadata {
/**
* Returns the data of the first JPEG thumbnail found in the EXIF metadata.
- *
+ *
* @return JPEG data or null if no thumbnail.
* @throws ImageReadException
* @throws IOException
@@ -118,7 +118,7 @@ public class JpegImageMetadata implements ImageMetadata {
/**
* Get the thumbnail image if available.
- *
+ *
* @return the thumbnail image. May be <code>null</code> if no image could
* be found.
* @throws ImageReadException
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageParser.java
----------------------------------------------------------------------
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 c3b89b4..fff6271 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
@@ -68,7 +68,7 @@ public class JpegImageParser extends ImageParser {
private static final String DEFAULT_EXTENSION = ".jpg";
private static final String[] ACCEPTED_EXTENSIONS = { ".jpg", ".jpeg", };
-
+
public JpegImageParser() {
setByteOrder(ByteOrder.BIG_ENDIAN);
// setDebug(true);
@@ -525,7 +525,7 @@ public class JpegImageParser extends ImageParser {
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param byteSource
* File containing image data.
* @param params
@@ -702,7 +702,7 @@ public class JpegImageParser extends ImageParser {
if (app14Segments != null && !app14Segments.isEmpty()) {
app14Segment = (App14Segment) app14Segments.get(0);
}
-
+
// JfifSegment fTheJFIFSegment = (JfifSegment) findSegment(segments,
// kJFIFMarker);
@@ -814,14 +814,14 @@ public class JpegImageParser extends ImageParser {
boolean transparent = false;
final boolean usesPalette = false; // TODO: inaccurate.
-
+
// See http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#color
ImageInfo.ColorType colorType = ImageInfo.ColorType.UNKNOWN;
// Some images have both JFIF/APP0 and APP14.
// JFIF is meant to win but in them APP14 is clearly right, so make it win.
if (app14Segment != null && app14Segment.isAdobeJpegSegment()) {
final int colorTransform = app14Segment.getAdobeColorTransform();
- if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN) {
+ if (colorTransform == App14Segment.ADOBE_COLOR_TRANSFORM_UNKNOWN) {
if (numberOfComponents == 3) {
colorType = ImageInfo.ColorType.RGB;
} else if (numberOfComponents == 4) {
@@ -924,7 +924,7 @@ public class JpegImageParser extends ImageParser {
maxVerticalSamplingFactor = component.verticalSamplingFactor;
}
}
- final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor)
+ final boolean isSubsampled = (minHorizontalSamplingFactor != maxHorizontalSmaplingFactor)
|| (minVerticalSamplingFactor != maxVerticalSamplingFactor);
if (numberOfComponents == 3) {
if (isSubsampled) {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
index d440138..9368d71 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/JpegUtils.java
@@ -92,7 +92,7 @@ public class JpegUtils extends BinaryFileParser {
return;
}
}
-
+
Debug.debug(Integer.toString(markerCount) + " markers");
}
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Block.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Block.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Block.java
index 2ac966d..1716261 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Block.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Block.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
index dd93470..b455164 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/Dct.java
@@ -21,7 +21,7 @@ final class Dct {
* Mitchell, Chapter 4, discusses a number of approaches to the fast DCT.
* Here's the cost, exluding modified (de)quantization, for transforming an
* 8x8 block:
- *
+ *
* Algorithm Adds Multiplies RightShifts Total
* Naive 896 1024 0 1920
* "Symmetries" 448 224 0 672
@@ -29,22 +29,22 @@ final class Dct {
* Arai, Agui and Nakajima (AA&N) 464 80 0 544
* Feig 8x8 462 54 6 522
* Fused mul/add (a pipe dream) 416
- *
+ *
* IJG's libjpeg, FFmpeg, and a number of others use AA&N.
- *
+ *
* It would appear that Feig does 4-5% less operations, and multiplications
* are reduced from 80 in AA&N to only 54. But in practice:
- *
+ *
* Benchmarks, Intel Core i3 @ 2.93 GHz in long mode, 4 GB RAM Time taken to
* do 100 million IDCTs (less is better):
* Rene' Stöckel's Feig, int: 45.07 seconds
* My Feig, floating point: 36.252 seconds
* AA&N, unrolled loops, double[][] -> double[][]: 25.167 seconds
- *
+ *
* Clearly Feig is hopeless. I suspect the performance killer is simply the
* weight of the algorithm: massive number of local variables, large code
* size, and lots of random array accesses.
- *
+ *
* Also, AA&N can be optimized a lot:
* AA&N, rolled loops, double[][] -> double[][]: 21.162 seconds
* AA&N, rolled loops, float[][] -> float[][]: no improvement,
@@ -56,10 +56,10 @@ final class Dct {
* AA&N, previous version rewritten in C and compiled with "gcc -O3"
* takes: 8.5 seconds
* (probably due to heavy use of SIMD)
- *
+ *
* Other brave attempts: AA&N, best float version converted to 16:16 fixed
* point: 23.923 seconds
- *
+ *
* Anyway the best float version stays. 18.5 seconds = 5.4 million
* transforms per second per core :-)
*/
@@ -98,7 +98,7 @@ final class Dct {
private Dct() {
}
-
+
public static void scaleQuantizationVector(final float[] vector) {
for (int x = 0; x < 8; x++) {
vector[x] *= DCT_SCALING_FACTORS[x];
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
index 409c700..0e29971 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
index d89b67f..b0691f6 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegInputStream.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
index 0684d25..2ec8230 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/YCbCrConverter.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -98,7 +98,7 @@ final class YCbCrConverter {
}
}
}
-
+
private YCbCrConverter() {
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/ZigZag.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/ZigZag.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/ZigZag.java
index 49c3173..d80e33b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/ZigZag.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/ZigZag.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,7 +29,7 @@ final class ZigZag {
private ZigZag() {
}
-
+
public static void zigZagToBlock(final int[] zz, final int[] block) {
for (int i = 0; i < ZIG_ZAG.length; i++) {
block[i] = zz[ZIG_ZAG[i]];
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
index 8e910e1..6db70a7 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/exif/ExifRewriter.java
@@ -49,7 +49,7 @@ import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;
* <p>
* <p>
* See the source of the ExifMetadataUpdateExample class for example usage.
- *
+ *
* @see <a
* href="https://svn.apache.org/repos/asf/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/examples/WriteExifMetadataExample.java">org.apache.commons.imaging.examples.WriteExifMetadataExample</a>
*/
@@ -65,7 +65,7 @@ public class ExifRewriter extends BinaryFileParser {
/**
* Constructor.
* <p>
- *
+ *
* @param byteOrder
* byte order of EXIF segment.
*/
@@ -199,12 +199,12 @@ public class ExifRewriter extends BinaryFileParser {
* Reads a Jpeg image, removes all EXIF metadata (by removing the APP1
* segment), and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
- *
+ *
* @see java.io.File
* @see java.io.OutputStream
* @see java.io.File
@@ -220,7 +220,7 @@ public class ExifRewriter extends BinaryFileParser {
* Reads a Jpeg image, removes all EXIF metadata (by removing the APP1
* segment), and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -236,7 +236,7 @@ public class ExifRewriter extends BinaryFileParser {
* Reads a Jpeg image, removes all EXIF metadata (by removing the APP1
* segment), and writes the result to a stream.
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -252,7 +252,7 @@ public class ExifRewriter extends BinaryFileParser {
* Reads a Jpeg image, removes all EXIF metadata (by removing the APP1
* segment), and writes the result to a stream.
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
@@ -283,7 +283,7 @@ public class ExifRewriter extends BinaryFileParser {
* update, which is a serious issue, since all EXIF data must fit in a
* single APP1 segment of the Jpeg image.
* <p>
- *
+ *
* @param src
* Image file.
* @param os
@@ -309,7 +309,7 @@ public class ExifRewriter extends BinaryFileParser {
* update, which is a serious issue, since all EXIF data must fit in a
* single APP1 segment of the Jpeg image.
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -335,7 +335,7 @@ public class ExifRewriter extends BinaryFileParser {
* update, which is a serious issue, since all EXIF data must fit in a
* single APP1 segment of the Jpeg image.
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -361,7 +361,7 @@ public class ExifRewriter extends BinaryFileParser {
* update, which is a serious issue, since all EXIF data must fit in a
* single APP1 segment of the Jpeg image.
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
@@ -406,7 +406,7 @@ public class ExifRewriter extends BinaryFileParser {
* entire EXIF segment, ignoring the possibility that it may be discarding
* data it couldn't parse (such as Maker Notes).
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -429,7 +429,7 @@ public class ExifRewriter extends BinaryFileParser {
* entire EXIF segment, ignoring the possibility that it may be discarding
* data it couldn't parse (such as Maker Notes).
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -452,7 +452,7 @@ public class ExifRewriter extends BinaryFileParser {
* entire EXIF segment, ignoring the possibility that it may be discarding
* data it couldn't parse (such as Maker Notes).
* <p>
- *
+ *
* @param src
* Image file.
* @param os
@@ -475,7 +475,7 @@ public class ExifRewriter extends BinaryFileParser {
* entire EXIF segment, ignoring the possibility that it may be discarding
* data it couldn't parse (such as Maker Notes).
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java
index 4768efa..ced4033 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcConstants.java
@@ -88,7 +88,7 @@ public final class IptcConstants {
public static final int IPTC_RECORD_TAG_MARKER = 0x1c;
public static final int IPTC_ENVELOPE_RECORD_NUMBER = 0x01;
public static final int IPTC_APPLICATION_2_RECORD_NUMBER = 0x02;
-
+
private IptcConstants() {
}
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcParser.java
----------------------------------------------------------------------
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 b3308ce..c5377ce 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
@@ -72,36 +72,36 @@ public class IptcParser extends BinaryFileParser {
* In practice, App13 segments are only used for Photoshop/IPTC metadata.
* However, we should not treat App13 signatures without Photoshop's
* signature as Photoshop/IPTC segments.
- *
+ *
* A Photoshop/IPTC App13 segment begins with the Photoshop Identification
* string.
- *
+ *
* There follows 0-N blocks (Photoshop calls them "Image Resource Blocks").
- *
+ *
* Each block has the following structure:
- *
+ *
* 1. 4-byte type. This is always "8BIM" for blocks in a Photoshop App13
* segment. 2. 2-byte id. IPTC data is stored in blocks with id 0x0404, aka.
* IPTC_NAA_RECORD_IMAGE_RESOURCE_ID 3. Block name as a Pascal String. This
* is padded to have an even length. 4. 4-byte size (in bytes). 5. Block
* data. This is also padded to have an even length.
- *
+ *
* The block data consists of a 0-N records. A record has the following
* structure:
- *
+ *
* 1. 2-byte prefix. The value is always 0x1C02 2. 1-byte record type. The
* record types are documented by the IPTC. See IptcConstants. 3. 2-byte
* record size (in bytes). 4. Record data, "record size" bytes long.
- *
+ *
* Record data (unlike block data) is NOT padded to have an even length.
- *
+ *
* Record data, for IPTC record, should always be ISO-8859-1. But according
* to SANSELAN-33, this isn't always the case.
- *
+ *
* The exception is the first record in the block, which must always be a
* record version record, whose value is a two-byte number; the value is
* 0x02.
- *
+ *
* Some IPTC blocks are missing this first "record version" record, so we
* don't require it.
*/
@@ -256,20 +256,20 @@ public class IptcParser extends BinaryFileParser {
// Note that these are unsigned quantities. Name is always an even
// number of bytes (including the 1st byte, which is the size.)
-
- final byte[] idString = readBytes("", bis,
+
+ final byte[] idString = readBytes("", bis,
JpegConstants.PHOTOSHOP_IDENTIFICATION_STRING.size(),
"App13 Segment missing identification string");
if (!JpegConstants.PHOTOSHOP_IDENTIFICATION_STRING.equals(idString)) {
throw new ImageReadException("Not a Photoshop App13 Segment");
}
-
+
// int index = PHOTOSHOP_IDENTIFICATION_STRING.length;
-
+
while (true) {
final int imageResourceBlockSignature;
try {
- imageResourceBlockSignature = read4Bytes("", bis,
+ imageResourceBlockSignature = read4Bytes("", bis,
"Image Resource Block missing identification string", APP13_BYTE_ORDER);
} catch (final IOException ioEx) {
break;
@@ -278,13 +278,13 @@ public class IptcParser extends BinaryFileParser {
throw new ImageReadException(
"Invalid Image Resource Block Signature");
}
-
+
final int blockType = read2Bytes("", bis, "Image Resource Block missing type", APP13_BYTE_ORDER);
Debug.debug("blockType: " + blockType + " (0x" + Integer.toHexString(blockType) + ")");
-
+
final int blockNameLength = readByte("Name length", bis, "Image Resource Block missing name length");
if (blockNameLength > 0) {
- Debug.debug("blockNameLength: " + blockNameLength + " (0x"
+ Debug.debug("blockNameLength: " + blockNameLength + " (0x"
+ Integer.toHexString(blockNameLength) + ")");
}
byte[] blockNameBytes;
@@ -301,15 +301,15 @@ public class IptcParser extends BinaryFileParser {
}
break;
}
-
+
if (blockNameLength % 2 == 0) {
readByte("Padding byte", bis, "Image Resource Block missing padding byte");
}
}
-
+
final int blockSize = read4Bytes("", bis, "Image Resource Block missing size", APP13_BYTE_ORDER);
Debug.debug("blockSize: " + blockSize + " (0x" + Integer.toHexString(blockSize) + ")");
-
+
/*
* doesn't catch cases where blocksize is invalid but is still less
* than bytes.length but will at least prevent OutOfMemory errors
@@ -317,7 +317,7 @@ public class IptcParser extends BinaryFileParser {
if (blockSize > bytes.length) {
throw new ImageReadException("Invalid Block Size : " + blockSize + " > " + bytes.length);
}
-
+
final byte[] blockData;
try {
blockData = readBytes("", bis, blockSize, "Invalid Image Resource Block data");
@@ -327,14 +327,14 @@ public class IptcParser extends BinaryFileParser {
}
break;
}
-
+
blocks.add(new IptcBlock(blockType, blockNameBytes, blockData));
-
+
if ((blockSize % 2) != 0) {
readByte("Padding byte", bis, "Image Resource Block missing padding byte");
}
}
-
+
return blocks;
}
}
@@ -388,7 +388,7 @@ public class IptcParser extends BinaryFileParser {
byte[] blockData;
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try (BinaryOutputStream bos = new BinaryOutputStream(baos, getByteOrder())) {
-
+
// first, right record version record
bos.write(IptcConstants.IPTC_RECORD_TAG_MARKER);
bos.write(IptcConstants.IPTC_APPLICATION_2_RECORD_NUMBER);
@@ -396,10 +396,10 @@ public class IptcParser extends BinaryFileParser {
// type.
bos.write2Bytes(2); // record version record size
bos.write2Bytes(2); // record version value
-
+
// make a copy of the list.
elements = new ArrayList<>(elements);
-
+
// sort the list. Records must be in numerical order.
final Comparator<IptcRecord> comparator = new Comparator<IptcRecord>() {
@Override
@@ -409,7 +409,7 @@ public class IptcParser extends BinaryFileParser {
};
Collections.sort(elements, comparator);
// TODO: make sure order right
-
+
// write the list.
for (final IptcRecord element : elements) {
if (element.iptcType == IptcTypes.RECORD_VERSION) {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
index 12c057d..8aa73c0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypeLookup.java
@@ -30,7 +30,7 @@ public final class IptcTypeLookup {
private IptcTypeLookup() {
}
-
+
public static IptcType getIptcType(final int type) {
if (!IPTC_TYPE_MAP.containsKey(type)) {
return IptcTypes.getUnknown(type);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java
index dd055ee..324d931 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcTypes.java
@@ -134,17 +134,17 @@ public enum IptcTypes implements IptcType {
public final int type;
public final String name;
-
+
IptcTypes(final int type, final String name) {
this.type = type;
this.name = name;
}
-
+
@Override
public String getName() {
return name;
}
-
+
@Override
public int getType() {
return type;
@@ -154,19 +154,19 @@ public enum IptcTypes implements IptcType {
public String toString() {
return name + " (" + type + ")";
}
-
+
public static IptcType getUnknown(final int type) {
return new IptcType() {
@Override
public String getName() {
return "Unknown";
}
-
+
@Override
public int getType() {
return type;
}
-
+
@Override
public String toString() {
return "Unknown (" + type + ")";
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
index bd52215..a064578 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/JpegIptcRewriter.java
@@ -45,12 +45,12 @@ public class JpegIptcRewriter extends JpegRewriter {
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
* <p>
- *
+ *
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
- *
+ *
* @see java.io.File
* @see java.io.OutputStream
*/
@@ -58,20 +58,20 @@ public class JpegIptcRewriter extends JpegRewriter {
throws ImageReadException, IOException, ImageWriteException {
removeIPTC(src, os, false);
}
-
+
/**
* Reads a Jpeg image, removes all IPTC data from the App13 segment but
* leaves the other data in that segment (if present) unchanged (unless
* removeSegment is true) and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
* @param removeSegment
* Remove the App13 segment.
- *
+ *
* @see java.io.File
* @see java.io.OutputStream
*/
@@ -86,7 +86,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -96,13 +96,13 @@ public class JpegIptcRewriter extends JpegRewriter {
throws ImageReadException, IOException, ImageWriteException {
removeIPTC(src, os, false);
}
-
+
/**
* Reads a Jpeg image, removes all IPTC data from the App13 segment but
* leaves the other data in that segment (if present) unchanged (unless
* removeSegment is true) and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -121,7 +121,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -131,13 +131,13 @@ public class JpegIptcRewriter extends JpegRewriter {
throws ImageReadException, IOException, ImageWriteException {
removeIPTC(src, os, false);
}
-
+
/**
* Reads a Jpeg image, removes all IPTC data from the App13 segment but
* leaves the other data in that segment (if present) unchanged (unless
* removeSegment is true) and writes the result to a stream.
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -156,7 +156,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
@@ -166,13 +166,13 @@ public class JpegIptcRewriter extends JpegRewriter {
throws ImageReadException, IOException, ImageWriteException {
removeIPTC(byteSource, os, false);
}
-
+
/**
* Reads a Jpeg image, removes all IPTC data from the App13 segment but
* leaves the other data in that segment (if present) unchanged (unless
* removeSegment is true) and writes the result to a stream.
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
@@ -211,7 +211,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* Reads a Jpeg image, replaces the IPTC data in the App13 segment but
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -230,7 +230,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* Reads a Jpeg image, replaces the IPTC data in the App13 segment but
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -249,7 +249,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* Reads a Jpeg image, replaces the IPTC data in the App13 segment but
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
- *
+ *
* @param src
* Image file.
* @param os
@@ -267,7 +267,7 @@ public class JpegIptcRewriter extends JpegRewriter {
* Reads a Jpeg image, replaces the IPTC data in the App13 segment but
* leaves the other data in that segment (if present) unchanged and writes
* the result to a stream.
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
index b5c7a31..a859bd1 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/App14Segment.java
@@ -31,7 +31,7 @@ public class App14Segment extends AppnSegment {
public static final int ADOBE_COLOR_TRANSFORM_UNKNOWN = 0;
public static final int ADOBE_COLOR_TRANSFORM_YCbCr = 1;
public static final int ADOBE_COLOR_TRANSFORM_YCCK = 2;
-
+
static {
ADOBE_PREFIX = "Adobe".getBytes(StandardCharsets.US_ASCII);
}
@@ -39,7 +39,7 @@ public class App14Segment extends AppnSegment {
public App14Segment(final int marker, final byte[] segmentData) throws IOException {
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
}
-
+
public App14Segment(final int marker, final int markerLength, final InputStream is) throws IOException {
super(marker, markerLength, is);
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/ComSegment.java
----------------------------------------------------------------------
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 5665f67..d897eee 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
@@ -28,7 +28,7 @@ public class ComSegment extends GenericSegment {
public ComSegment(final int marker, final int markerLength, final InputStream is) throws IOException {
super(marker, markerLength, is);
}
-
+
/**
* Returns a copy of the comment.
* @return a copy of the comment's bytes
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
index 8763aa8..b12c8fc 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DhtSegment.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java
index 3833190..1aaf270 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/DqtSegment.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/GenericSegment.java
----------------------------------------------------------------------
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/GenericSegment.java
index e557f71..2b64d00 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/GenericSegment.java
@@ -62,7 +62,7 @@ public abstract class GenericSegment extends Segment {
/**
* Returns a specific byte of the segment's contents,
* excluding the marker and length bytes at
- * the beginning.
+ * the beginning.
* @see GenericSegment#getSegmentData()
* @return the bye in the segment's contents
*/
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
index a8f3004..bd3a4a2 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/JfifSegment.java
@@ -46,7 +46,7 @@ public class JfifSegment extends Segment {
this(marker, segmentData.length, new ByteArrayInputStream(segmentData));
}
- public JfifSegment(final int marker, final int markerLength, final InputStream is)
+ public JfifSegment(final int marker, final int markerLength, final InputStream is)
throws ImageReadException, IOException {
super(marker, markerLength);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
index 23c6cd1..4b13312 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SofnSegment.java
@@ -84,7 +84,7 @@ public class SofnSegment extends Segment {
quantTabDestSelector);
}
}
-
+
/**
* Returns a copy of all the components.
* @return the components
@@ -92,7 +92,7 @@ public class SofnSegment extends Segment {
public Component[] getComponents() {
return components.clone();
}
-
+
/**
* Returns the component at the specified index.
* @param index the array index
@@ -101,7 +101,7 @@ public class SofnSegment extends Segment {
public Component getComponents(final int index) {
return components[index];
}
-
+
@Override
public String getDescription() {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java
index 31421b8..29f2742 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/segments/SosSegment.java
@@ -97,7 +97,7 @@ public class SosSegment extends Segment {
successiveApproximationBitHigh = (successiveApproximationBitPosition >> 4) & 0xf;
successiveApproximationBitLow = successiveApproximationBitPosition & 0xf;
}
-
+
/**
* Returns a copy of all the components.
* @return all the components
@@ -105,7 +105,7 @@ public class SosSegment extends Segment {
public Component[] getComponents() {
return components.clone();
}
-
+
/**
* Return a component at the specified index.
* @param index the component index
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java
index d2a67eb..c22f641 100644
--- a/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/xmp/JpegXmpRewriter.java
@@ -42,12 +42,12 @@ public class JpegXmpRewriter extends JpegRewriter {
* Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment),
* and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Image file.
* @param os
* OutputStream to write the image to.
- *
+ *
* @see java.io.File
* @see java.io.OutputStream
*/
@@ -61,7 +61,7 @@ public class JpegXmpRewriter extends JpegRewriter {
* Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment),
* and writes the result to a stream.
* <p>
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -77,7 +77,7 @@ public class JpegXmpRewriter extends JpegRewriter {
* Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment),
* and writes the result to a stream.
* <p>
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -93,7 +93,7 @@ public class JpegXmpRewriter extends JpegRewriter {
* Reads a Jpeg image, removes all XMP XML (by removing the APP1 segment),
* and writes the result to a stream.
* <p>
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
@@ -110,7 +110,7 @@ public class JpegXmpRewriter extends JpegRewriter {
/**
* Reads a Jpeg image, replaces the XMP XML and writes the result to a
* stream.
- *
+ *
* @param src
* Byte array containing Jpeg image data.
* @param os
@@ -127,7 +127,7 @@ public class JpegXmpRewriter extends JpegRewriter {
/**
* Reads a Jpeg image, replaces the XMP XML and writes the result to a
* stream.
- *
+ *
* @param src
* InputStream containing Jpeg image data.
* @param os
@@ -144,7 +144,7 @@ public class JpegXmpRewriter extends JpegRewriter {
/**
* Reads a Jpeg image, replaces the XMP XML and writes the result to a
* stream.
- *
+ *
* @param src
* Image file.
* @param os
@@ -161,7 +161,7 @@ public class JpegXmpRewriter extends JpegRewriter {
/**
* Reads a Jpeg image, replaces the XMP XML and writes the result to a
* stream.
- *
+ *
* @param byteSource
* ByteSource containing Jpeg image data.
* @param os
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
index a491786..7884153 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxConstants.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,7 @@ public final class PcxConstants {
public static final String PARAM_KEY_PCX_BIT_DEPTH = "PCX_BIT_DEPTH";
public static final String PARAM_KEY_PCX_PLANES = "PCX_PLANES";
-
+
private PcxConstants() {
}
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
index 4a26e52..4be8d6c 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/PcxImageParser.java
@@ -498,7 +498,7 @@ public class PcxImageParser extends ImageParser {
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param byteSource
* File containing image data.
* @param params
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pcx/PcxWriter.java
----------------------------------------------------------------------
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 f782fe7..fb5a92d 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
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -78,7 +78,7 @@ class PcxWriter {
bitDepthWanted = ((Number) value).intValue();
}
}
-
+
if (params.containsKey(PcxConstants.PARAM_KEY_PCX_PLANES)) {
final Object value = params.remove(PcxConstants.PARAM_KEY_PCX_PLANES);
if (value != null) {
@@ -110,7 +110,7 @@ class PcxWriter {
throw new ImageWriteException("Unknown parameter: " + firstKey);
}
}
-
+
public void writeImage(final BufferedImage src, final OutputStream os)
throws ImageWriteException, IOException {
final PaletteFactory paletteFactory = new PaletteFactory();
@@ -171,13 +171,13 @@ class PcxWriter {
planes = 2;
}
}
-
+
int bytesPerLine = (bitDepth * src.getWidth() + 7) / 8;
if ((bytesPerLine % 2) != 0) {
// must be even:
bytesPerLine++;
}
-
+
final byte[] palette16 = new byte[16 * 3];
for (int i = 0; i < 16; i++) {
int rgb;
@@ -216,7 +216,7 @@ class PcxWriter {
} else {
writePixels(src, bitDepth, planes, bytesPerLine, palette, bos);
}
-
+
if (bitDepth == 8 && planes == 1) {
// 256 color palette
bos.write(12);
@@ -233,7 +233,7 @@ 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, ImageWriteException {
final byte[] plane0 = new byte[bytesPerLine];
@@ -241,12 +241,12 @@ class PcxWriter {
final byte[] plane2 = new byte[bytesPerLine];
final byte[] plane3 = new byte[bytesPerLine];
final byte[][] allPlanes = { plane0, plane1, plane2, plane3 };
-
+
for (int y = 0; y < src.getHeight(); y++) {
for (int i = 0; i < planes; i++) {
Arrays.fill(allPlanes[i], (byte)0);
}
-
+
if (bitDepth == 1 && planes == 1) {
for (int x = 0; x < src.getWidth(); x++) {
final int rgb = 0xffffff & src.getRGB(x, y);
@@ -308,7 +308,7 @@ class PcxWriter {
plane2[x] = (byte) argb;
}
}
-
+
for (int i = 0; i < planes; i++) {
rleWriter.write(bos, allPlanes[i]);
}
@@ -318,7 +318,7 @@ class PcxWriter {
private void writePixels32(final BufferedImage src, final int bytesPerLine,
final BinaryOutputStream bos) throws IOException, ImageWriteException {
-
+
final int[] rgbs = new int[src.getWidth()];
final byte[] plane = new byte[4 * bytesPerLine];
for (int y = 0; y < src.getHeight(); y++) {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java b/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
index 735a205..1b8a063 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pcx/RleReader.java
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,17 +26,17 @@ class RleReader {
private final boolean isCompressed;
private int count;
private byte sample;
-
+
RleReader(final boolean isCompressed) {
this.isCompressed = isCompressed;
}
-
+
void read(final InputStream is, final byte[] samples) throws IOException, ImageReadException {
if (isCompressed) {
final int prefill = Math.min(count, samples.length);
Arrays.fill(samples, 0, prefill, sample);
count -= prefill;
-
+
for (int bytesRead = prefill; bytesRead < samples.length;) {
final byte b = BinaryFunctions.readByte("RleByte", is, "Error reading image data");
if ((b & 0xc0) == 0xc0) {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pcx/RleWriter.java
----------------------------------------------------------------------
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 ce4e3ea..afb9b1b 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
@@ -2,9 +2,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ class RleWriter {
RleWriter(final boolean isCompressed) {
this.isCompressed = isCompressed;
}
-
+
void write(final BinaryOutputStream bos, final byte[] samples)
throws IOException, ImageWriteException {
if (isCompressed) {
@@ -54,7 +54,7 @@ class RleWriter {
bos.write(samples);
}
}
-
+
void flush(final BinaryOutputStream bos) throws IOException {
if (repeatCount > 0) {
if (repeatCount == 1 && (previousByte & 0xc0) != 0xc0) {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java b/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
index 1346808..ef8f873 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ChunkType.java
@@ -22,7 +22,7 @@ import org.apache.commons.imaging.common.BinaryFunctions;
/**
* Type of a PNG chunk.
- *
+ *
* @see <a href="http://www.w3.org/TR/PNG/#11Chunks">Portable Network Graphics Specification - Chunk specifications</a>
*/
public enum ChunkType {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/FilterType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/FilterType.java b/src/main/java/org/apache/commons/imaging/formats/png/FilterType.java
index 2dd9f7b..3132d94 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/FilterType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/FilterType.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.png;
/**
* Filter types for filter method 0.
- *
+ *
* @see <a href="http://www.w3.org/TR/PNG/#9Filters">Portable Network Graphics Specification - Filtering</a>
*/
enum FilterType {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java b/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
index c25cdd9..9bc4ec0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/InterlaceMethod.java
@@ -18,7 +18,7 @@ package org.apache.commons.imaging.formats.png;
/**
* Interlace methods.
- *
+ *
* @see <a href="http://www.w3.org/TR/PNG/#8Interlace">Portable Network Graphics Specification - Interlacing and pass extraction</a>
*/
public enum InterlaceMethod {
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
index a7b7b77..117fa0b 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngColorType.java
@@ -69,7 +69,7 @@ public enum PngColorType {
return type;
}
}
-
+
return null;
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
index a17e1b3..e7c68f3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngConstants.java
@@ -61,7 +61,7 @@ public final class PngConstants {
/**
* Parameter key.
- *
+ *
* Only used when writing Png images.
* <p>
* Valid values: a list of WriteTexts.
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
index 7952437..07ae14d 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
@@ -122,7 +122,7 @@ public class PngImageParser extends ImageParser {
return chunkTypes;
}
- public boolean hasChunkType(final ByteSource byteSource, final ChunkType chunkType)
+ public boolean hasChunkType(final ByteSource byteSource, final ChunkType chunkType)
throws ImageReadException, IOException {
try (InputStream is = byteSource.getInputStream()) {
readSignature(is);
@@ -196,7 +196,7 @@ public class PngImageParser extends ImageParser {
result.add(new PngChunkGama(length, chunkType, crc, bytes));
} else if (chunkType == ChunkType.iTXt.value) {
result.add(new PngChunkItxt(length, chunkType, crc, bytes));
- } else {
+ } else {
result.add(new PngChunk(length, chunkType, crc, bytes));
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngText.java b/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
index d3fb00c..45390b3 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngText.java
@@ -19,7 +19,7 @@ package org.apache.commons.imaging.formats.png;
public abstract class PngText {
public final String keyword;
public final String text;
-
+
public PngText(final String keyword, final String text) {
this.keyword = keyword;
this.text = text;
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
index b7d0754..94792b0 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngWriter.java
@@ -50,7 +50,7 @@ class PngWriter {
4. Miscellaneous information: bKGD, hIST, pHYs, sPLT (see 11.3.5: Miscellaneous information).
5. Time information: tIME (see 11.3.6: Time stamp information).
*/
-
+
private void writeInt(final OutputStream os, final int value) throws IOException {
os.write(0xff & (value >> 24));
os.write(0xff & (value >> 16));
@@ -144,7 +144,7 @@ class PngWriter {
writeChunk(os, ChunkType.iTXt, baos.toByteArray());
}
- private void writeChunkzTXt(final OutputStream os, final PngText.Ztxt text)
+ private void writeChunkzTXt(final OutputStream os, final PngText.Ztxt text)
throws IOException, ImageWriteException {
if (!isValidISO_8859_1(text.keyword)) {
throw new ImageWriteException("Png zTXt chunk keyword is not ISO-8859-1: " + text.keyword);
@@ -198,12 +198,12 @@ class PngWriter {
return baos.toByteArray();
}
}
-
+
private boolean isValidISO_8859_1(final String s) {
final String roundtrip = new String(s.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.ISO_8859_1);
return s.equals(roundtrip);
}
-
+
private void writeChunkXmpiTXt(final OutputStream os, final String xmpXml)
throws IOException {
@@ -247,11 +247,11 @@ class PngWriter {
private void writeChunkTRNS(final OutputStream os, final Palette palette) throws IOException {
final byte[] bytes = new byte[palette.length()];
-
+
for (int i = 0; i < bytes.length; i++) {
bytes[i] = (byte) (0xff & (palette.getEntry(i) >> 24));
}
-
+
writeChunk(os, ChunkType.tRNS, bytes);
}
@@ -309,11 +309,11 @@ class PngWriter {
/// Wraps a palette by adding a single transparent entry at index 0.
private static class TransparentPalette implements Palette {
private final Palette palette;
-
+
TransparentPalette(final Palette palette) {
this.palette = palette;
}
-
+
@Override
public int getEntry(final int index) {
if (index == 0) {
@@ -321,12 +321,12 @@ class PngWriter {
}
return palette.getEntry(index - 1);
}
-
+
@Override
public int length() {
return 1 + palette.length();
}
-
+
@Override
public int getPaletteIndex(final int rgb) throws ImageWriteException {
if (rgb == 0x00000000) {
@@ -480,7 +480,7 @@ class PngWriter {
if (hasAlpha) {
palette = new TransparentPalette(palette);
- writeChunkPLTE(os, palette);
+ writeChunkPLTE(os, palette);
writeChunkTRNS(os, new SimplePalette(new int[] { 0x00000000 }));
} else {
writeChunkPLTE(os, palette);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
index df119d1..97a281e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/ScanExpediter.java
@@ -81,7 +81,7 @@ abstract class ScanExpediter {
public abstract void drive() throws ImageReadException, IOException;
- int getRGB(final BitParser bitParser, final int pixelIndexInScanline)
+ int getRGB(final BitParser bitParser, final int pixelIndexInScanline)
throws ImageReadException, IOException {
switch (pngColorType) {
@@ -184,7 +184,7 @@ abstract class ScanExpediter {
case PAETH:
return new ScanlineFilterPaeth(bytesPerPixel);
}
-
+
return null;
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java b/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
index 8c5099b..90b6711 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/FileInfo.java
@@ -35,7 +35,7 @@ abstract class FileInfo {
}
abstract boolean hasAlpha();
-
+
abstract int getNumComponents();
abstract int getBitDepth();
@@ -55,7 +55,7 @@ abstract class FileInfo {
void newline() {
// do nothing by default.
}
-
+
static int readSample(final InputStream is, final int bytesPerSample) throws IOException {
int sample = 0;
for (int i = 0; i < bytesPerSample; i++) {
@@ -68,7 +68,7 @@ abstract class FileInfo {
}
return sample;
}
-
+
static int scaleSample(int sample, final float scale, final int max) throws IOException {
if (sample < 0) {
// Even netpbm tools break for files like this
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
index d931a6e..a8e1dee 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PamFileInfo.java
@@ -29,7 +29,7 @@ class PamFileInfo extends FileInfo {
private final int depth;
private final int maxval;
private final float scale;
- private final int bytesPerSample;
+ private final int bytesPerSample;
private final boolean hasAlpha;
private final TupleReader tupleReader;
@@ -62,12 +62,12 @@ class PamFileInfo extends FileInfo {
throw new ImageReadException("Unknown PAM tupletype '" + tupleType + "'");
}
}
-
+
@Override
public boolean hasAlpha() {
return hasAlpha;
}
-
+
@Override
public int getNumComponents() {
return depth;
@@ -97,7 +97,7 @@ class PamFileInfo extends FileInfo {
public ImageInfo.ColorType getColorType() {
return tupleReader.getColorType();
}
-
+
@Override
public int getRGB(final WhiteSpaceReader wsr) throws IOException {
throw new UnsupportedOperationException("PAM files are only ever binary");
@@ -112,31 +112,31 @@ class PamFileInfo extends FileInfo {
public abstract ImageInfo.ColorType getColorType();
public abstract int getRGB(InputStream is) throws IOException;
}
-
+
private class GrayscaleTupleReader extends TupleReader {
private final ImageInfo.ColorType colorType;
-
+
public GrayscaleTupleReader(final ImageInfo.ColorType colorType) {
this.colorType = colorType;
}
-
+
@Override
public ImageInfo.ColorType getColorType() {
return colorType;
}
-
+
@Override
public int getRGB(final InputStream is) throws IOException {
int sample = readSample(is, bytesPerSample);
sample = scaleSample(sample, scale, maxval);
-
+
int alpha = 0xff;
if (hasAlpha) {
alpha = readSample(is, bytesPerSample);
alpha = scaleSample(alpha, scale, maxval);
}
- return ((0xff & alpha) << 24)
+ return ((0xff & alpha) << 24)
| ((0xff & sample) << 16)
| ((0xff & sample) << 8)
| ((0xff & sample) << 0);
@@ -148,7 +148,7 @@ class PamFileInfo extends FileInfo {
public ImageInfo.ColorType getColorType() {
return ImageInfo.ColorType.RGB;
}
-
+
@Override
public int getRGB(final InputStream is) throws IOException {
int red = readSample(is, bytesPerSample);
@@ -165,7 +165,7 @@ class PamFileInfo extends FileInfo {
alpha = scaleSample(alpha, scale, maxval);
}
- return ((0xff & alpha) << 24)
+ return ((0xff & alpha) << 24)
| ((0xff & red) << 16)
| ((0xff & green) << 8)
| ((0xff & blue) << 0);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
index 31429aa..7ed25cb 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PamWriter.java
@@ -34,7 +34,7 @@ class PamWriter implements PnmWriter {
os.write(PnmConstants.PNM_PREFIX_BYTE);
os.write(PnmConstants.PAM_RAW_CODE);
os.write(PnmConstants.PNM_NEWLINE);
-
+
final int width = src.getWidth();
final int height = src.getHeight();
@@ -43,19 +43,19 @@ class PamWriter implements PnmWriter {
os.write(("HEIGHT " + height).getBytes(StandardCharsets.US_ASCII));
os.write(PnmConstants.PNM_NEWLINE);
-
+
os.write(("DEPTH 4").getBytes(StandardCharsets.US_ASCII));
os.write(PnmConstants.PNM_NEWLINE);
-
+
os.write(("MAXVAL 255").getBytes(StandardCharsets.US_ASCII));
os.write(PnmConstants.PNM_NEWLINE);
os.write(("TUPLTYPE RGB_ALPHA").getBytes(StandardCharsets.US_ASCII));
os.write(PnmConstants.PNM_NEWLINE);
-
+
os.write(("ENDHDR").getBytes(StandardCharsets.US_ASCII));
os.write(PnmConstants.PNM_NEWLINE);
-
+
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
final int argb = src.getRGB(x, y);
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
index 8cc2919..36ef6eb 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PbmFileInfo.java
@@ -30,7 +30,7 @@ class PbmFileInfo extends FileInfo {
PbmFileInfo(final int width, final int height, final boolean rawbits) {
super(width, height, rawbits);
}
-
+
@Override
public boolean hasAlpha() {
return false;
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
index 70cd7a5..b4a7bfe 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PgmFileInfo.java
@@ -27,7 +27,7 @@ import org.apache.commons.imaging.ImageReadException;
class PgmFileInfo extends FileInfo {
private final int max;
private final float scale;
- private final int bytesPerSample;
+ private final int bytesPerSample;
public PgmFileInfo(final int width, final int height, final boolean rawbits, final int max) throws ImageReadException {
super(width, height, rawbits);
@@ -46,7 +46,7 @@ class PgmFileInfo extends FileInfo {
}
this.max = max;
}
-
+
@Override
public boolean hasAlpha() {
return false;
@@ -85,14 +85,14 @@ class PgmFileInfo extends FileInfo {
@Override
public int getRGB(final InputStream is) throws IOException {
int sample = readSample(is, bytesPerSample);
-
+
sample = scaleSample(sample, scale, max);
final int alpha = 0xff;
- return ((0xff & alpha) << 24)
- | ((0xff & sample) << 16)
- | ((0xff & sample) << 8)
+ return ((0xff & alpha) << 24)
+ | ((0xff & sample) << 16)
+ | ((0xff & sample) << 8)
| ((0xff & sample) << 0);
}
@@ -101,12 +101,12 @@ class PgmFileInfo extends FileInfo {
int sample = Integer.parseInt(wsr.readtoWhiteSpace());
sample = scaleSample(sample, scale, max);
-
+
final int alpha = 0xff;
- return ((0xff & alpha) << 24)
- | ((0xff & sample) << 16)
- | ((0xff & sample) << 8)
+ return ((0xff & alpha) << 24)
+ | ((0xff & sample) << 16)
+ | ((0xff & sample) << 8)
| ((0xff & sample) << 0);
}
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
index 0889363..ca3d946 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PnmImageParser.java
@@ -90,16 +90,16 @@ public class PnmImageParser extends ImageParser {
if (identifier1 != PnmConstants.PNM_PREFIX_BYTE) {
throw new ImageReadException("PNM file has invalid prefix byte 1");
}
-
+
final WhiteSpaceReader wsr = new WhiteSpaceReader(is);
-
+
if (identifier2 == PnmConstants.PBM_TEXT_CODE
|| identifier2 == PnmConstants.PBM_RAW_CODE
|| identifier2 == PnmConstants.PGM_TEXT_CODE
|| identifier2 == PnmConstants.PGM_RAW_CODE
|| identifier2 == PnmConstants.PPM_TEXT_CODE
|| identifier2 == PnmConstants.PPM_RAW_CODE) {
-
+
final int width;
try {
width = Integer.parseInt(wsr.readtoWhiteSpace());
@@ -112,7 +112,7 @@ public class PnmImageParser extends ImageParser {
} catch (final NumberFormatException e) {
throw new ImageReadException("Invalid height specified." , e);
}
-
+
if (identifier2 == PnmConstants.PBM_TEXT_CODE) {
return new PbmFileInfo(width, height, false);
} else if (identifier2 == PnmConstants.PBM_RAW_CODE) {
@@ -143,7 +143,7 @@ public class PnmImageParser extends ImageParser {
boolean seenMaxVal = false;
final StringBuilder tupleType = new StringBuilder();
boolean seenTupleType = false;
-
+
// Advance to next line
wsr.readLine();
String line;
@@ -190,7 +190,7 @@ public class PnmImageParser extends ImageParser {
throw new ImageReadException("Invalid PAM file header type " + type);
}
}
-
+
if (!seenWidth) {
throw new ImageReadException("PAM header has no WIDTH");
} else if (!seenHeight) {
@@ -202,7 +202,7 @@ public class PnmImageParser extends ImageParser {
} else if (!seenTupleType) {
throw new ImageReadException("PAM header has no TUPLTYPE");
}
-
+
return new PamFileInfo(width, height, depth, maxVal, tupleType.toString());
} else {
throw new ImageReadException("PNM file has invalid prefix byte 2");
@@ -321,7 +321,7 @@ public class PnmImageParser extends ImageParser {
throws ImageWriteException, IOException {
PnmWriter writer = null;
boolean useRawbits = true;
-
+
if (params != null) {
final Object useRawbitsParam = params.get(PARAM_KEY_PNM_RAWBITS);
if (useRawbitsParam != null) {
@@ -338,7 +338,7 @@ public class PnmImageParser extends ImageParser {
writer = new PgmWriter(useRawbits);
} else if (subtype.equals(ImageFormats.PPM)) {
writer = new PpmWriter(useRawbits);
- } else if (subtype.equals(ImageFormats.PAM)) {
+ } else if (subtype.equals(ImageFormats.PAM)) {
writer = new PamWriter();
}
}
@@ -348,7 +348,7 @@ public class PnmImageParser extends ImageParser {
final boolean hasAlpha = new PaletteFactory().hasTransparency(src);
if (hasAlpha) {
writer = new PamWriter();
- } else {
+ } else {
writer = new PpmWriter(useRawbits);
}
}
@@ -369,7 +369,7 @@ public class PnmImageParser extends ImageParser {
if (params.containsKey(PARAM_KEY_PNM_RAWBITS)) {
params.remove(PARAM_KEY_PNM_RAWBITS);
}
-
+
if (!params.isEmpty()) {
final Object firstKey = params.keySet().iterator().next();
throw new ImageWriteException("Unknown parameter: " + firstKey);
@@ -381,7 +381,7 @@ public class PnmImageParser extends ImageParser {
/**
* Extracts embedded XML metadata as XML string.
* <p>
- *
+ *
* @param byteSource
* File containing image data.
* @param params
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
index 4b704e5..24ea26e 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/PpmFileInfo.java
@@ -27,7 +27,7 @@ import org.apache.commons.imaging.ImageReadException;
class PpmFileInfo extends FileInfo {
private final int max;
private final float scale;
- private final int bytesPerSample;
+ private final int bytesPerSample;
public PpmFileInfo(final int width, final int height, final boolean rawbits, final int max) throws ImageReadException {
super(width, height, rawbits);
@@ -44,7 +44,7 @@ class PpmFileInfo extends FileInfo {
}
this.max = max;
}
-
+
@Override
public boolean hasAlpha() {
return false;
http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/f108400a/src/main/java/org/apache/commons/imaging/formats/pnm/WhiteSpaceReader.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/imaging/formats/pnm/WhiteSpaceReader.java b/src/main/java/org/apache/commons/imaging/formats/pnm/WhiteSpaceReader.java
index d6d01eb..a4df343 100644
--- a/src/main/java/org/apache/commons/imaging/formats/pnm/WhiteSpaceReader.java
+++ b/src/main/java/org/apache/commons/imaging/formats/pnm/WhiteSpaceReader.java
@@ -61,7 +61,7 @@ class WhiteSpaceReader {
return buffer.toString();
}
-
+
public String readLine() throws IOException {
final StringBuilder buffer = new StringBuilder();
for (char c = read(); (c != '\n') && (c != '\r'); c = read()) {