From 6ca83c0d2f10b4b589aeb6814522d7b99f774bbb Mon Sep 17 00:00:00 2001
From: amosshi true
when in valid value space, else false
*/
public static boolean isValid(int code) {
- return (code > min && code != max);
+ return (code > MIN && code != MAX);
}
/**
@@ -175,7 +175,7 @@ public static String getMarkerName(int markerCode) {
if (markerCode == MarkerCode.TEMP) {
name = "TEMP";
- } else if (markerCode >= MarkerCode.RES_min && markerCode <= MarkerCode.RES_max) {
+ } else if (markerCode >= MarkerCode.RES_MIN && markerCode <= MarkerCode.RES_MAX) {
name = "RES";
} else if (markerCode >= MarkerCode.SOF00 && markerCode <= MarkerCode.COM) {
switch (markerCode) {
@@ -368,6 +368,9 @@ public static String getMarkerName(int markerCode) {
case MarkerCode.COM:
name = "COM";
break;
+ default:
+ name = "Un-recognized";
+ break;
}
}
@@ -377,11 +380,11 @@ public static String getMarkerName(int markerCode) {
public static String getMarkerDescription(int markerCode) {
String desc = "Error";
- if (markerCode == MarkerCode.min) {
+ if (markerCode == MarkerCode.MIN) {
desc = "MIN";
} else if (markerCode == MarkerCode.TEMP) {
desc = "[Reserved markers] For temporary private use in arithmetic coding";
- } else if (markerCode >= MarkerCode.RES_min && markerCode <= MarkerCode.RES_max) {
+ } else if (markerCode >= MarkerCode.RES_MIN && markerCode <= MarkerCode.RES_MAX) {
desc = "[Reserved markers] Reserved";
} else if (markerCode >= MarkerCode.SOF00 && markerCode <= MarkerCode.COM) {
switch (markerCode) {
@@ -574,8 +577,11 @@ public static String getMarkerDescription(int markerCode) {
case MarkerCode.COM:
desc = "[Other markers] Comment";
break;
+ default:
+ desc = "Un-recognized markder: " + markerCode;
+ break;
}
- } else if (markerCode == MarkerCode.max) {
+ } else if (markerCode == MarkerCode.MAX) {
desc = "MAX";
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_APP13.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_APP13.java
index 67d0592..e2e89e4 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_APP13.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_APP13.java
@@ -15,13 +15,13 @@
import org.freeinternals.format.jpeg.ps.PhotoshopImageResource;
/**
+ * An APP13 marker designates a Photoshop Image Resource (PSIR) that contains IPTC metadata.
*
* @author Amos Shi
*/
-// an APP13 marker designates a Photoshop Image Resource (PSIR) that contains IPTC metadata
public class Marker_APP13 extends Marker {
- public static final String identifier_Photoshop = "Photoshop";
+ public static final String IDENTIFIER_PHOTOSHOP = "Photoshop";
private String identifier;
private PhotoshopImageResource psir;
@@ -33,7 +33,7 @@ public class Marker_APP13 extends Marker {
protected void parse(final PosDataInputStream pDisMarker) throws IOException, FileFormatException {
super.parseInitSkip(pDisMarker);
this.identifier = super.parseIdentifier(pDisMarker);
- if (this.identifier.contains(Marker_APP13.identifier_Photoshop)) {
+ if (this.identifier.contains(Marker_APP13.IDENTIFIER_PHOTOSHOP)) {
final int lengthPhir = this.marker_length - 2 - this.identifier.length() - 1;
final byte[] bytesPhir = new byte[lengthPhir];
System.arraycopy(pDisMarker.getBuf(), 2 + 2 + this.identifier.length() + 1, bytesPhir, 0, lengthPhir);
@@ -69,17 +69,15 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
this.identifier.length() + 1,
String.format("identifier: %s", this.identifier))));
- if (this.identifier.contains(Marker_APP13.identifier_Photoshop)) {
+ if (this.identifier.contains(Marker_APP13.IDENTIFIER_PHOTOSHOP)) {
comp = new JTreeNodeFileComponent(
this.psir.getStartPos(),
this.psir.getLength(),
"Photoshop Image Resource Block");
markerNode.add(identifierNode = new DefaultMutableTreeNode(comp));
- if (this.psir != null) {
- this.psir.generateTreeNode(identifierNode);
- }
+ this.psir.generateTreeNode(identifierNode);
} else {
- markerNode.add(identifierNode = new DefaultMutableTreeNode(new JTreeNodeFileComponent(
+ markerNode.add(new DefaultMutableTreeNode(new JTreeNodeFileComponent(
lastPos = lastPos + this.identifier.length() + 1,
this.startPos + this.length - lastPos,
this.identifier)));
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_DRI.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_DRI.java
index 9b0639b..6aa82b1 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_DRI.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_DRI.java
@@ -56,7 +56,7 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
// Ri
comp = new JTreeNodeFileComponent(
- lastPos = lastPos + 2,
+ lastPos + 2,
2,
String.format("Ri: %d", this.Ri));
comp.setDescription("Restart interval – Specifies the number of MCU in the restart interval.");
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOFnn.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOFnn.java
index 43b6b35..b0d58e7 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOFnn.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOFnn.java
@@ -18,7 +18,7 @@
*/
public class Marker_SOFnn extends Marker {
- private class Component {
+ private static class Component {
/** Component Identifier */
@SuppressWarnings("PackageVisibleField")
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOS.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOS.java
index eae4ca3..e2a70a0 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOS.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/Marker_SOS.java
@@ -18,7 +18,7 @@
*/
public class Marker_SOS extends Marker {
- private class Parameter {
+ private static class Parameter {
/** Scan component selector */
@SuppressWarnings("PackageVisibleField")
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/ICCProfile.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/ICCProfile.java
index f74860a..9760473 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/ICCProfile.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/ICCProfile.java
@@ -104,7 +104,7 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
}
@SuppressWarnings("PackageVisibleInnerClass")
- private class RefItem {
+ private static class RefItem {
int i;
Tag tag;
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/TagData.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/TagData.java
index dcedbe8..261b679 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/TagData.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/TagData.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.FileComponent;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.GenerateTreeNode;
@@ -31,7 +32,9 @@ public TagData(final PosDataInputStream input) throws IOException {
super.length = input.getBuf().length;
this.tagType = input.readInt();
- input.skip(4); // Reserved
+
+ // Reserved bytes
+ BytesTool.skip(input, 4);
}
public String getTagType() {
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/dateTimeNumber.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/dateTimeNumber.java
index b8a32cc..a8779ee 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/dateTimeNumber.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/dateTimeNumber.java
@@ -6,6 +6,7 @@
*/
package org.freeinternals.format.jpeg.icc;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import org.freeinternals.commonlib.core.PosDataInputStream;
@@ -15,6 +16,7 @@
*
* @author Amos Shi
*/
+@SuppressFBWarnings(value = "NM_CLASS_NAMING_CONVENTION", justification = "Use the type name from ICC Specification")
public class dateTimeNumber {
public final int year;
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/s15Fixed16Number.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/s15Fixed16Number.java
index bd6414c..f408a71 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/s15Fixed16Number.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/icc/s15Fixed16Number.java
@@ -6,6 +6,7 @@
*/
package org.freeinternals.format.jpeg.icc;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import org.freeinternals.commonlib.core.PosDataInputStream;
@@ -13,6 +14,7 @@
*
* @author Amos Shi
*/
+@SuppressFBWarnings(value = "NM_CLASS_NAMING_CONVENTION", justification = "Use the type name from ICC Specification")
public class s15Fixed16Number {
public final byte[] rawData;
@@ -42,7 +44,7 @@ public s15Fixed16Number(final PosDataInputStream input) throws IOException {
}
@Override
- public String toString(){
+ public String toString() {
return String.format("%.4f", this.value);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/ps/IRB_8BIM.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/ps/IRB_8BIM.java
index 4153af1..b291219 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/ps/IRB_8BIM.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/ps/IRB_8BIM.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.FileComponent;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -47,7 +48,7 @@ public class IRB_8BIM extends FileComponent {
// skip for name
this.data_skip1byte = ((this.size & 1) != 0);
if (this.data_skip1byte) {
- input.skip(1);
+ BytesTool.skip(input, 1);
}
// data
@@ -63,7 +64,7 @@ public class IRB_8BIM extends FileComponent {
// skip for name
this.name_skip1byte = ((this.size & 1) != 0); // true for odd value; false for even
if (this.name_skip1byte) {
- input.skip(1);
+ BytesTool.skip(input, 1);
}
// total length
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD.java
index 4877bdc..e8e739f 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.FileComponent;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
@@ -101,7 +102,7 @@ protected final PosDataInputStream getTiffOffsetReader() throws IOException {
throw new ArrayIndexOutOfBoundsException("TIFF IFD: the data ending offset is bigger than tiff buffer length");
}
- reader.skip(this.ifd_value_offset);
+ BytesTool.skip(reader, this.ifd_value_offset);
return reader;
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFDGroup.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFDGroup.java
index d4d16d3..d453c65 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFDGroup.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFDGroup.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -39,7 +40,7 @@ class IFDGroup {
final PosDataInputStream pDisTiff = new PosDataInputStream(
new PosByteArrayInputStream(byteArrayTiff),
tiffHeader.getStartPos());
- pDisTiff.skip(offset);
+ BytesTool.skip(pDisTiff, offset);
this.ifd_number = IFDParse.readUnsignedShort(pDisTiff, tiffHeader.byte_order);
if (this.ifd_number > 0) { // IFD count could be zero
this.ifd = new IFD[this.ifd_number];
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829A_ExposureTime.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829A_ExposureTime.java
index 5e594f7..7bd84f3 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829A_ExposureTime.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829A_ExposureTime.java
@@ -14,12 +14,12 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_829A_ExposureTime extends IFD_RATIONAL_COUNT1 {
private final static String IFD_Description = IFDMessage.getString(IFDMessage.KEY_IFD_829A_Description)
- + IFD_8769_Exif.Category_G;
+ + IFD_8769_Exif.CATEGORY_G;
public IFD_829A_ExposureTime(final PosDataInputStream pDIS, int byteOrder, int tag, int startPosTiff, byte[] byteArrayTiff)
throws IOException, FileFormatException {
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829D_FNumber.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829D_FNumber.java
index 7370be9..3fa4aa6 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829D_FNumber.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_829D_FNumber.java
@@ -14,12 +14,12 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_829D_FNumber extends IFD_RATIONAL_COUNT1 {
private final static String IFD_Description = IFDMessage.getString(IFDMessage.KEY_IFD_829D_Description)
- + IFD_8769_Exif.Category_G;
+ + IFD_8769_Exif.CATEGORY_G;
public IFD_829D_FNumber(final PosDataInputStream pDIS, int byteOrder, int tag, int startPosTiff, byte[] byteArrayTiff)
throws IOException, FileFormatException {
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8769_Exif.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8769_Exif.java
index dd14c65..ff863e5 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8769_Exif.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8769_Exif.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -20,13 +21,13 @@
*/
public class IFD_8769_Exif extends IFD_LONG_Pointer {
- public static final String Category_A = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_A);
- public static final String Category_B = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_B);
- public static final String Category_C = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_C);
- public static final String Category_D = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_D);
- public static final String Category_E = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_E);
- public static final String Category_F = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_F);
- public static final String Category_G = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_G);
+ public static final String CATEGORY_A = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_A);
+ public static final String CATEGORY_B = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_B);
+ public static final String CATEGORY_C = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_C);
+ public static final String CATEGORY_D = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_D);
+ public static final String CATEGORY_E = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_E);
+ public static final String CATEGORY_F = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_F);
+ public static final String CATEGORY_G = IFDMessage.getString(IFDMessage.KEY_IFD_8769_Exif_Category_G);
public IFD_8769_Exif(final PosDataInputStream pDIS, int byteOrder, int tag, int startPosTiff, byte[] byteArrayTiff)
throws IOException, FileFormatException {
@@ -37,7 +38,7 @@ public IFD_8769_Exif(final PosDataInputStream pDIS, int byteOrder, int tag, int
final PosDataInputStream reader = new PosDataInputStream(
new PosByteArrayInputStream(this.tiff_ByteArray),
super.tiff_StartPos);
- reader.skip(this.getExifOffset() + 2);
+ BytesTool.skip(reader, this.getExifOffset() + 2);
if (this.ifd_number > 0) {
for (int i = 0; i < this.ifd_number; i++) {
this.ifd_sub[i] = IFDParse.parse(reader, byteOrder, startPosTiff, byteArrayTiff);
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8822_ExposureProgram.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8822_ExposureProgram.java
index ae329f3..e2a5944 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8822_ExposureProgram.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8822_ExposureProgram.java
@@ -18,7 +18,7 @@
public class IFD_8822_ExposureProgram extends IFD_SHORT_COUNT1 {
private final static String IFD_Description = IFDMessage.getString(IFDMessage.KEY_IFD_8822_Description)
- + IFD_8769_Exif.Category_G;
+ + IFD_8769_Exif.CATEGORY_G;
public IFD_8822_ExposureProgram(final PosDataInputStream pDIS, int byteOrder, int tag, int startPosTiff, byte[] byteArrayTiff)
throws IOException, FileFormatException {
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8825_GPS.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8825_GPS.java
index 9910c48..c1f1e64 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8825_GPS.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_8825_GPS.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -31,7 +32,7 @@ public IFD_8825_GPS(final PosDataInputStream pDIS, int byteOrder, int tag, int s
new PosByteArrayInputStream(this.tiff_ByteArray),
super.tiff_StartPos
);
- reader.skip(this.getGPSOffset() + 2);
+ BytesTool.skip(reader, this.getGPSOffset() + 2);
if (this.ifd_number > 0) {
for (int i = 0; i < this.ifd_number; i++) {
this.ifd_sub[i] = IFDParse.parseGPS(reader, byteOrder, startPosTiff, byteArrayTiff);
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A005_Interoperability.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A005_Interoperability.java
index d99f7a8..bb43c07 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A005_Interoperability.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A005_Interoperability.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -30,7 +31,7 @@ public IFD_A005_Interoperability(final PosDataInputStream pDIS, int byteOrder, i
final PosDataInputStream reader = new PosDataInputStream(
new PosByteArrayInputStream(this.tiff_ByteArray),
super.tiff_StartPos);
- reader.skip(this.getInteroperabilityOffset() + 2);
+ BytesTool.skip(reader, this.getInteroperabilityOffset() + 2);
if (this.ifd_number > 0) {
for (int i = 0; i < this.ifd_number; i++) {
this.ifd_sub[i] = IFDParse.parseIntero(reader, byteOrder, startPosTiff, byteArrayTiff);
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A302_CFAPattern.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A302_CFAPattern.java
index 04e3b22..2aa28e6 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A302_CFAPattern.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A302_CFAPattern.java
@@ -17,11 +17,11 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A302_CFAPattern extends IFD_UNDEFINED {
- public static final String[] FilterColor = {"RED", "GREEN", "BLUE", "CYAN", "MAGENTA", "YELLOW", "WHITE"};
+ static final String[] FILTER_COLORS = {"RED", "GREEN", "BLUE", "CYAN", "MAGENTA", "YELLOW", "WHITE"};
/** Horizontal repeat pixel unit. */
public final int n;
/** Vertical repeat pixel unit. */
@@ -86,7 +86,7 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
node.add(new DefaultMutableTreeNode(new JTreeNodeFileComponent(
super.tiff_StartPos + super.ifd_value_offset + 4 + i,
1,
- String.format("CFA value: %d - %s", cfa, FilterColor[cfa]))));
+ String.format("CFA value: %d - %s", cfa, FILTER_COLORS[cfa]))));
}
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A401_CustomRendered.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A401_CustomRendered.java
index 31ed800..d1efc37 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A401_CustomRendered.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A401_CustomRendered.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A401_CustomRendered extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A401_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A402_ExposureMode.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A402_ExposureMode.java
index a7bc2ee..5abcdbe 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A402_ExposureMode.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A402_ExposureMode.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A402_ExposureMode extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A402_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A403_WhiteBalance.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A403_WhiteBalance.java
index 2e7735f..32fb195 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A403_WhiteBalance.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A403_WhiteBalance.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A403_WhiteBalance extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A403_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A404_DigitalZoomRatio.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A404_DigitalZoomRatio.java
index 0f12386..7032485 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A404_DigitalZoomRatio.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A404_DigitalZoomRatio.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A404_DigitalZoomRatio extends IFD_RATIONAL_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_RATIONAL(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A404_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A405_FocalLengthIn35mmFilm.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A405_FocalLengthIn35mmFilm.java
index 193d878..773cd4e 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A405_FocalLengthIn35mmFilm.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A405_FocalLengthIn35mmFilm.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
* @see IFD_920A_FocalLength
*/
public class IFD_A405_FocalLengthIn35mmFilm extends IFD_SHORT_COUNT1 {
@@ -29,6 +29,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A405_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A406_SceneCaptureType.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A406_SceneCaptureType.java
index 0044caa..31ac21a 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A406_SceneCaptureType.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A406_SceneCaptureType.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
* @see IFD_A301_SceneType
*/
public class IFD_A406_SceneCaptureType extends IFD_SHORT_COUNT1 {
@@ -29,6 +29,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A406_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A407_GainControl.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A407_GainControl.java
index 5380157..c66bace 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A407_GainControl.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A407_GainControl.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A407_GainControl extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A407_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A408_Contrast.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A408_Contrast.java
index 6138600..6c29855 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A408_Contrast.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A408_Contrast.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A408_Contrast extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A408_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A409_Saturation.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A409_Saturation.java
index 508950e..bff7207 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A409_Saturation.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A409_Saturation.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A409_Saturation extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A409_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40A_Sharpness.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40A_Sharpness.java
index 503b44e..ade58ea 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40A_Sharpness.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40A_Sharpness.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A40A_Sharpness extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A40A_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40C_SubjectDistanceRange.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40C_SubjectDistanceRange.java
index db3652f..ea8348f 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40C_SubjectDistanceRange.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_A40C_SubjectDistanceRange.java
@@ -14,7 +14,7 @@
/**
*
* @author Amos Shi
- * @see IFD_8769_Exif#Category_G
+ * @see IFD_8769_Exif#CATEGORY_G
*/
public class IFD_A40C_SubjectDistanceRange extends IFD_SHORT_COUNT1 {
@@ -28,6 +28,6 @@ public void generateTreeNode(DefaultMutableTreeNode parentNode) {
super.generateTreeNode_SHORT(
parentNode,
IFDMessage.getString(IFDMessage.KEY_IFD_A40C_Description)
- + IFD_8769_Exif.Category_G);
+ + IFD_8769_Exif.CATEGORY_G);
}
}
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_LONG_Pointer.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_LONG_Pointer.java
index 42aa844..3637fab 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_LONG_Pointer.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_LONG_Pointer.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.freeinternals.commonlib.core.BytesTool;
import org.freeinternals.commonlib.core.PosByteArrayInputStream;
import org.freeinternals.commonlib.core.PosDataInputStream;
import org.freeinternals.commonlib.ui.JTreeNodeFileComponent;
@@ -29,11 +30,10 @@ public IFD_LONG_Pointer(final PosDataInputStream pDIS, int byteOrder, int tag, i
super(pDIS, byteOrder, tag, startPosTiff, byteArrayTiff);
// Sub IFD
-
final PosDataInputStream reader = new PosDataInputStream(
new PosByteArrayInputStream(this.tiff_ByteArray),
super.tiff_StartPos);
- reader.skip(super.value[0]);
+ BytesTool.skip(reader, super.value[0]);
this.ifd_number = super.readUnsignedShort(reader);
if (this.ifd_number > 0) {
this.ifd_sub = new IFD[this.ifd_number];
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_RATIONAL.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_RATIONAL.java
index 9668f0a..bfabbe3 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_RATIONAL.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_RATIONAL.java
@@ -108,7 +108,7 @@ void generateTreeNode_RATIONAL(DefaultMutableTreeNode parentNode, String descrip
}
@SuppressWarnings("PublicInnerClass")
- public class Rational {
+ public static class Rational {
public final long numerator;
public final long denominator;
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SHORT.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SHORT.java
index aa3e5a3..32fc470 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SHORT.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SHORT.java
@@ -90,6 +90,9 @@ void generateTreeNode_SHORT(DefaultMutableTreeNode parentNode, String descriptio
comp.setDescription(description);
parentNode.add(new DefaultMutableTreeNode(comp));
break;
+ default:
+ // Do nothing
+ break;
}
} else {
comp = new JTreeNodeFileComponent(
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SRATIONAL.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SRATIONAL.java
index 032e7d7..084fa99 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SRATIONAL.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/IFD_SRATIONAL.java
@@ -108,7 +108,7 @@ void generateTreeNode_SRATIONAL(DefaultMutableTreeNode parentNode, String descri
}
@SuppressWarnings("PublicInnerClass")
- public class SRational {
+ public static class SRational {
public final int numerator;
public final int denominator;
diff --git a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/TIFF.java b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/TIFF.java
index 591168a..2bc5331 100644
--- a/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/TIFF.java
+++ b/FormatJPEG/src/main/java/org/freeinternals/format/jpeg/tiff/TIFF.java
@@ -150,7 +150,7 @@ private void loadRefItem(IFD[] ifds, ConcurrentSkipListMapRaw
format.
diff --git a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Dictionary.java b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Dictionary.java
index 839f84b..a89749e 100644
--- a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Dictionary.java
+++ b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Dictionary.java
@@ -77,7 +77,7 @@ private void parse(PosDataInputStream stream) throws IOException {
byte next2;
boolean stop = false;
while (stream.hasNext()) {
- comp = analysis.ParseNextObject(stream, this.components);
+ comp = analysis.parseNextObject(stream, this.components);
if (comp == null) {
next1 = stream.readByte();
switch (next1) {
diff --git a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Null.java b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Null.java
index 75dc6ce..81d3781 100644
--- a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Null.java
+++ b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Null.java
@@ -16,7 +16,7 @@
*/
public final class Null extends FileComponent implements GenerateTreeNode {
- public static String VALUE = "null";
+ public static final String VALUE = "null";
/**
* Name text in
* Raw
format.
diff --git a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Stream.java b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Stream.java
index 24316d3..1e4726d 100644
--- a/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Stream.java
+++ b/FormatPDF/src/main/java/org/freeinternals/format/pdf/basicobj/Stream.java
@@ -24,12 +24,12 @@ public class Stream extends FileComponent implements GenerateTreeNode {
/**
* The signature length.
*/
- public final int SignatureLen;
- public ASCIILine SignatureEnd = null;
+ public final int signatureLen;
+ public ASCIILine signatureEnd = null;
public Stream(PosDataInputStream stream, PosDataInputStream.ASCIILine line) throws IOException, FileFormatException {
- this.SignatureLen = SIGNATURE_START.length() + line.NewLineLength;
- super.startPos = stream.getPos() - this.SignatureLen;
+ this.signatureLen = SIGNATURE_START.length() + line.NewLineLength;
+ super.startPos = stream.getPos() - this.signatureLen;
this.parse(stream);
this.length = stream.getPos() - super.startPos;
}
@@ -39,11 +39,11 @@ private void parse(PosDataInputStream stream) throws IOException, FileFormatExce
while (stream.hasNext()) {
line = stream.readASCIILine();
if (line.Line.endsWith(Stream.SIGNATURE_END)) {
- this.SignatureEnd = line;
+ this.signatureEnd = line;
}
}
- if (this.SignatureEnd == null) {
+ if (this.signatureEnd == null) {
throw new FileFormatException(String.format(
"The 'endstream' tag is not found for current object. Object Start Offset = %d, Current Offset = %d",
super.startPos,
@@ -65,7 +65,7 @@ public int getStreamStartPos() {
* endstream
.