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 cacda989c2164f5cd49db18cb5a6da7bf1b7a5f4 Author: Gary Gregory <[email protected]> AuthorDate: Sat Jan 3 10:37:18 2026 -0500 Javadoc --- .../imaging/formats/jpeg/iptc/IptcBlock.java | 27 ++++ .../imaging/formats/jpeg/iptc/IptcRecord.java | 20 ++- .../imaging/formats/jpeg/iptc/IptcTypes.java | 143 ++++++++++++++++++--- 3 files changed, 171 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java index 2705ba52..7e3c677d 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcBlock.java @@ -30,24 +30,51 @@ public class IptcBlock { private final byte[] blockNameBytes; private final byte[] blockData; + /** + * Constructs a new IPTC block. + * + * @param blockType the block type. + * @param blockNameBytes the block name bytes. + * @param blockData the block data. + */ public IptcBlock(final int blockType, final byte[] blockNameBytes, final byte[] blockData) { this.blockData = Objects.requireNonNull(blockData, "blockData"); this.blockNameBytes = Objects.requireNonNull(blockNameBytes, "blockNameBytes"); this.blockType = blockType; } + /** + * Gets a copy of the block data. + * + * @return a copy of the block data bytes. + */ public byte[] getBlockData() { return blockData.clone(); } + /** + * Gets a copy of the block name bytes. + * + * @return a copy of the block name bytes. + */ public byte[] getBlockNameBytes() { return blockNameBytes.clone(); } + /** + * Gets the block type. + * + * @return the block type. + */ public int getBlockType() { return blockType; } + /** + * Checks if this is an IPTC data block. + * + * @return true if this is an IPTC data block, false otherwise. + */ public boolean isIptcBlock() { return blockType == IptcConstants.IMAGE_RESOURCE_BLOCK_IPTC_DATA; } diff --git a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java index 31d28466..eeb4c818 100644 --- a/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java +++ b/src/main/java/org/apache/commons/imaging/formats/jpeg/iptc/IptcRecord.java @@ -18,23 +18,41 @@ package org.apache.commons.imaging.formats.jpeg.iptc; import java.util.Comparator; -/* +/** * Represents an IPTC record, a single key-value pair of Photoshop IPTC data. */ public class IptcRecord { + /** Comparator for sorting IPTC records by type. */ public static final Comparator<IptcRecord> COMPARATOR = Comparator.comparingInt(e -> e.iptcType.getType()); + /** The IPTC type. */ public final IptcType iptcType; private final String value; + /** + * Constructs a new IPTC record. + * + * @param iptcType the IPTC type. + * @param value the value. + */ public IptcRecord(final IptcType iptcType, final String value) { this.iptcType = iptcType; this.value = value; } + /** + * Gets the IPTC type name. + * + * @return the IPTC type name. + */ public String getIptcTypeName() { return iptcType.getName(); } + /** + * Gets the value. + * + * @return the value. + */ public String getValue() { return value; } 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 8decb060..9d61974d 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 @@ -16,26 +16,131 @@ */ package org.apache.commons.imaging.formats.jpeg.iptc; +/** + * Enumeration of IPTC (International Press Telecommunications Council) metadata record types. + */ public enum IptcTypes implements IptcType { - RECORD_VERSION(0, "Record Version"), OBJECT_TYPE_REFERENCE(3, "Object Type Reference"), OBJECT_ATTRIBUTE_REFERENCE(4, "Object Attribute Reference"), - OBJECT_NAME(5, "Object Name"), EDIT_STATUS(7, "Edit Status"), EDITORIAL_UPDATE(8, "Editorial Update"), URGENCY(10, "Urgency"), - SUBJECT_REFERENCE(12, "Subject Reference"), CATEGORY(15, "Category"), SUPPLEMENTAL_CATEGORY(20, "Supplemental Category"), - FIXTURE_IDENTIFIER(22, "Fixture Identifier"), KEYWORDS(25, "Keywords"), CONTENT_LOCATION_CODE(26, "Content Location Code"), - CONTENT_LOCATION_NAME(27, "Content Location Name"), RELEASE_DATE(30, "Release Date"), RELEASE_TIME(35, "Release Time"), - EXPIRATION_DATE(37, "Expiration Date"), EXPIRATION_TIME(38, "Expiration Time"), SPECIAL_INSTRUCTIONS(40, "Special Instructions"), - ACTION_ADVISED(42, "Action Advised"), REFERENCE_SERVICE(45, "Reference Service"), REFERENCE_DATE(47, "Reference Date"), - REFERENCE_NUMBER(50, "Reference Number"), DATE_CREATED(55, "Date Created"), TIME_CREATED(60, "Time Created"), - DIGITAL_CREATION_DATE(62, "Digital Creation Date"), DIGITAL_CREATION_TIME(63, "Digital Creation Time"), ORIGINATING_PROGRAM(65, "Originating Program"), - PROGRAM_VERSION(70, "Program Version"), OBJECT_CYCLE(75, "Object Cycle"), BYLINE(80, "By-line"), BYLINE_TITLE(85, "By-line Title"), CITY(90, "City"), - SUBLOCATION(92, "Sublocation"), PROVINCE_STATE(95, "Province/State"), COUNTRY_PRIMARY_LOCATION_CODE(100, "Country/Primary Location Code"), - COUNTRY_PRIMARY_LOCATION_NAME(101, "Country/Primary Location Name"), ORIGINAL_TRANSMISSION_REFERENCE(103, "Original Transmission, Reference"), - HEADLINE(105, "Headline"), CREDIT(110, "Credit"), SOURCE(115, "Source"), COPYRIGHT_NOTICE(116, "Copyright Notice"), CONTACT(118, "Contact"), - CAPTION_ABSTRACT(120, "Caption/Abstract"), WRITER_EDITOR(122, "Writer/Editor"), RASTERIZED_CAPTION(125, "Rasterized Caption"), IMAGE_TYPE(130, "ImageType"), - IMAGE_ORIENTATION(131, "Image Orientation"), LANGUAGE_IDENTIFIER(135, "Language Identifier"), AUDIO_TYPE(150, "Audio Type"), - AUDIO_SAMPLING_RATE(151, "Audio Sampling Rate"), AUDIO_SAMPLING_RESOLUTION(152, "Audio Sampling Resolution"), AUDIO_DURATION(153, "Audio Duration"), - AUDIO_OUTCUE(154, "Audio Outcue"), OBJECT_DATA_PREVIEW_FILE_FORMAT(200, "Object Data Preview, File Format"), - OBJECT_DATA_PREVIEW_FILE_FORMAT_VERSION(201, "Object Data Preview, File Format Version"), OBJECT_DATA_PREVIEW_DATA(202, "Object Data Preview Data"); + /** Record version type. */ + RECORD_VERSION(0, "Record Version"), + /** Object type reference type. */ + OBJECT_TYPE_REFERENCE(3, "Object Type Reference"), + /** Object attribute reference type. */ + OBJECT_ATTRIBUTE_REFERENCE(4, "Object Attribute Reference"), + /** Object name type. */ + OBJECT_NAME(5, "Object Name"), + /** Edit status type. */ + EDIT_STATUS(7, "Edit Status"), + /** Editorial update type. */ + EDITORIAL_UPDATE(8, "Editorial Update"), + /** Urgency type. */ + URGENCY(10, "Urgency"), + /** Subject reference type. */ + SUBJECT_REFERENCE(12, "Subject Reference"), + /** Category type. */ + CATEGORY(15, "Category"), + /** Supplemental category type. */ + SUPPLEMENTAL_CATEGORY(20, "Supplemental Category"), + /** Fixture identifier type. */ + FIXTURE_IDENTIFIER(22, "Fixture Identifier"), + /** Keywords type. */ + KEYWORDS(25, "Keywords"), + /** Content location code type. */ + CONTENT_LOCATION_CODE(26, "Content Location Code"), + /** Content location name type. */ + CONTENT_LOCATION_NAME(27, "Content Location Name"), + /** Release date type. */ + RELEASE_DATE(30, "Release Date"), + /** Release time type. */ + RELEASE_TIME(35, "Release Time"), + /** Expiration date type. */ + EXPIRATION_DATE(37, "Expiration Date"), + /** Expiration time type. */ + EXPIRATION_TIME(38, "Expiration Time"), + /** Special instructions type. */ + SPECIAL_INSTRUCTIONS(40, "Special Instructions"), + /** Action advised type. */ + ACTION_ADVISED(42, "Action Advised"), + /** Reference service type. */ + REFERENCE_SERVICE(45, "Reference Service"), + /** Reference date type. */ + REFERENCE_DATE(47, "Reference Date"), + /** Reference number type. */ + REFERENCE_NUMBER(50, "Reference Number"), + /** Date created type. */ + DATE_CREATED(55, "Date Created"), + /** Time created type. */ + TIME_CREATED(60, "Time Created"), + /** Digital creation date type. */ + DIGITAL_CREATION_DATE(62, "Digital Creation Date"), + /** Digital creation time type. */ + DIGITAL_CREATION_TIME(63, "Digital Creation Time"), + /** Originating program type. */ + ORIGINATING_PROGRAM(65, "Originating Program"), + /** Program version type. */ + PROGRAM_VERSION(70, "Program Version"), + /** Object cycle type. */ + OBJECT_CYCLE(75, "Object Cycle"), + /** By-line type. */ + BYLINE(80, "By-line"), + /** By-line title type. */ + BYLINE_TITLE(85, "By-line Title"), + /** City type. */ + CITY(90, "City"), + /** Sublocation type. */ + SUBLOCATION(92, "Sublocation"), + /** Province/State type. */ + PROVINCE_STATE(95, "Province/State"), + /** Country/Primary location code type. */ + COUNTRY_PRIMARY_LOCATION_CODE(100, "Country/Primary Location Code"), + /** Country/Primary location name type. */ + COUNTRY_PRIMARY_LOCATION_NAME(101, "Country/Primary Location Name"), + /** Original transmission reference type. */ + ORIGINAL_TRANSMISSION_REFERENCE(103, "Original Transmission, Reference"), + /** Headline type. */ + HEADLINE(105, "Headline"), + /** Credit type. */ + CREDIT(110, "Credit"), + /** Source type. */ + SOURCE(115, "Source"), + /** Copyright notice type. */ + COPYRIGHT_NOTICE(116, "Copyright Notice"), + /** Contact type. */ + CONTACT(118, "Contact"), + /** Caption/Abstract type. */ + CAPTION_ABSTRACT(120, "Caption/Abstract"), + /** Writer/Editor type. */ + WRITER_EDITOR(122, "Writer/Editor"), + /** Rasterized caption type. */ + RASTERIZED_CAPTION(125, "Rasterized Caption"), + /** Image type. */ + IMAGE_TYPE(130, "ImageType"), + /** Image orientation type. */ + IMAGE_ORIENTATION(131, "Image Orientation"), + /** Language identifier type. */ + LANGUAGE_IDENTIFIER(135, "Language Identifier"), + /** Audio type. */ + AUDIO_TYPE(150, "Audio Type"), + /** Audio sampling rate type. */ + AUDIO_SAMPLING_RATE(151, "Audio Sampling Rate"), + /** Audio sampling resolution type. */ + AUDIO_SAMPLING_RESOLUTION(152, "Audio Sampling Resolution"), + /** Audio duration type. */ + AUDIO_DURATION(153, "Audio Duration"), + /** Audio outcue type. */ + AUDIO_OUTCUE(154, "Audio Outcue"), + /** Object data preview file format type. */ + OBJECT_DATA_PREVIEW_FILE_FORMAT(200, "Object Data Preview, File Format"), + /** Object data preview file format version type. */ + OBJECT_DATA_PREVIEW_FILE_FORMAT_VERSION(201, "Object Data Preview, File Format Version"), + /** Object data preview data type. */ + OBJECT_DATA_PREVIEW_DATA(202, "Object Data Preview Data"); + /** + * Gets an unknown IPTC type for the specified type number. + * + * @param type the type number. + * @return an unknown IPTC type. + */ public static IptcType getUnknown(final int type) { return new IptcType() { @Override @@ -55,8 +160,10 @@ public enum IptcTypes implements IptcType { }; } + /** The IPTC type number. */ public final int type; + /** The IPTC type name. */ public final String name; IptcTypes(final int type, final String name) {
