This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-imaging.git
commit f9fa7fe845e885e8f88415c1ab9787424de0b8c2 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jan 3 09:36:08 2026 -0500 Javadoc --- .../org/apache/commons/imaging/ImageFormats.java | 25 ++++++++++++-- .../org/apache/commons/imaging/icc/IccTag.java | 38 ++++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/ImageFormats.java b/src/main/java/org/apache/commons/imaging/ImageFormats.java index f8af7ad6..543e829c 100644 --- a/src/main/java/org/apache/commons/imaging/ImageFormats.java +++ b/src/main/java/org/apache/commons/imaging/ImageFormats.java @@ -23,31 +23,52 @@ import java.util.Objects; */ public enum ImageFormats implements ImageFormat { - // @formatter:off + /** Unknown image format. */ UNKNOWN("bin"), + /** BMP (Windows Bitmap) image format. */ BMP("bmp", "dib"), + /** DCX (ZSoft Multi-page Paintbrush) image format. */ DCX("dcx"), + /** GIF (Graphics Interchange Format) image format. */ GIF("gif"), + /** ICNS (Apple Icon Image) format. */ ICNS("icns"), + /** ICO (Windows Icon) image format. */ ICO("ico"), + /** JBIG2 image format. */ JBIG2("jbig2"), + /** JPEG (Joint Photographic Experts Group) image format. */ JPEG("jpg", "jpeg"), + /** PAM (Portable Arbitrary Map) image format. */ PAM("pam"), + /** PSD (Adobe Photoshop Document) image format. */ PSD("psd"), + /** PBM (Portable Bitmap) image format. */ PBM("pbm"), + /** PGM (Portable Graymap) image format. */ PGM("pgm"), + /** PNM (Portable Any Map) image format. */ PNM("pnm"), + /** PPM (Portable Pixmap) image format. */ PPM("ppm"), + /** PCX (PC Paintbrush) image format. */ PCX("pcx", "pcc"), + /** PNG (Portable Network Graphics) image format. */ PNG("png"), + /** RGBE (Radiance HDR) image format. */ RGBE("hdr", "pic"), + /** TGA (Truevision TGA/TARGA) image format. */ TGA("tga"), + /** TIFF (Tagged Image File Format). */ TIFF("tif", "tiff"), + /** WBMP (Wireless Bitmap) image format. */ WBMP("wbmp"), + /** WebP image format. */ WEBP("webp"), + /** XBM (X11 Bitmap) image format. */ XBM("xbm"), + /** XPM (X11 Pixmap) image format. */ XPM("xpm"); - // @formatter:on private final String[] extensions; diff --git a/src/main/java/org/apache/commons/imaging/icc/IccTag.java b/src/main/java/org/apache/commons/imaging/icc/IccTag.java index f8cd6dce..bd0d8b3a 100644 --- a/src/main/java/org/apache/commons/imaging/icc/IccTag.java +++ b/src/main/java/org/apache/commons/imaging/icc/IccTag.java @@ -29,21 +29,34 @@ import java.util.logging.Logger; import org.apache.commons.imaging.ImagingException; import org.apache.commons.imaging.common.BinaryFunctions; +/** + * Represents an ICC profile tag. + */ public class IccTag { static final int SHALLOW_SIZE = 40; private static final Logger LOGGER = Logger.getLogger(IccTag.class.getName()); + /** The tag signature. */ public final int signature; + /** The offset of the tag data. */ public final int offset; + /** The length of the tag data. */ public final int length; + /** The ICC tag type. */ public final IccTagType fIccTagType; private byte[] data; private IccTagDataType itdt; private int dataTypeSignature; - // public final byte[] data; - + /** + * Constructs a new ICC tag. + * + * @param signature the tag signature. + * @param offset the offset of the tag data. + * @param length the length of the tag data. + * @param fIccTagType the ICC tag type. + */ public IccTag(final int signature, final int offset, final int length, final IccTagType fIccTagType) { this.signature = signature; this.offset = offset; @@ -51,6 +64,14 @@ public class IccTag { this.fIccTagType = fIccTagType; } + /** + * Dumps the tag information to the specified PrintWriter. + * + * @param pw the PrintWriter to write to. + * @param prefix the prefix to use for output lines. + * @throws ImagingException if an imaging error occurs. + * @throws IOException if an I/O error occurs. + */ public void dump(final PrintWriter pw, final String prefix) throws ImagingException, IOException { pw.println(prefix + "tag signature: " + Integer.toHexString(signature) + " (" + new String(new byte[] { (byte) (0xff & signature >> 24), (byte) (0xff & signature >> 16), (byte) (0xff & signature >> 8), (byte) (0xff & signature >> 0), }, StandardCharsets.US_ASCII) + ")"); @@ -79,6 +100,13 @@ public class IccTag { } + /** + * Dumps the tag information to the logger. + * + * @param prefix the prefix to use for output lines. + * @throws ImagingException if an imaging error occurs. + * @throws IOException if an I/O error occurs. + */ public void dump(final String prefix) throws ImagingException, IOException { try (StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw)) { @@ -99,6 +127,12 @@ public class IccTag { return null; } + /** + * Sets the tag data. + * + * @param bytes the tag data bytes. + * @throws IOException if an I/O error occurs. + */ public void setData(final byte[] bytes) throws IOException { data = bytes;
