public final class IptcRecordSet extends CustomPackage
Represents a collection of IPTC records.
Learn more
This code sample shows hot to update basic IPTC metadata properties.
try (Metadata metadata = new Metadata(Constants.InputJpeg)) { IIptc root = (IIptc) metadata.getRootPackage(); // Set the IPTC package if it's missing if (root.getIptcPackage() == null) { root.setIptcPackage(new IptcRecordSet()); } if (root.getIptcPackage().getEnvelopeRecord() == null) { root.getIptcPackage().setEnvelopeRecord(new IptcEnvelopeRecord()); } root.getIptcPackage().getEnvelopeRecord().setDateSent(new Date()); root.getIptcPackage().getEnvelopeRecord().setProductID("test project id"); // ... if (root.getIptcPackage().getApplicationRecord() == null) { root.getIptcPackage().setApplicationRecord(new IptcApplicationRecord()); } root.getIptcPackage().getApplicationRecord().setByLine("GroupDocs"); root.getIptcPackage().getApplicationRecord().setHeadline("test"); root.getIptcPackage().getApplicationRecord().setByLineTitle("code sample"); root.getIptcPackage().getApplicationRecord().setReleaseDate(new Date()); // ... metadata.save(Constants.OutputJpeg); }
Constructor and Description |
---|
IptcRecordSet()
Initializes a new instance of the
IptcRecordSet class. |
IptcRecordSet(IptcDataSet[] dataSets)
Initializes a new instance of the
IptcRecordSet class. |
Modifier and Type | Method and Description |
---|---|
void |
add(IptcDataSet dataSet)
Adds the specified dataSet to the appropriate record.
|
void |
clear()
Removes all records from the collection.
|
IptcRecord |
get_Item(byte recordNumber)
Gets the
IptcRecord with the specified number. |
IptcDataSet |
get_Item(byte recordNumber,
byte dataSetNumber)
Gets the
IptcDataSet with the specified record and dataSet number. |
IptcApplicationRecord |
getApplicationRecord()
Gets the Application Record.
|
IptcEnvelopeRecord |
getEnvelopeRecord()
Gets the Envelope Record.
|
boolean |
remove(byte recordNumber)
Removes the record with the specified record number.
|
boolean |
remove(byte recordNumber,
byte dataSetNumber)
Removes the dataSet with the specified record and dataSet number.
|
void |
set(IptcDataSet dataSet)
Adds or updates the specified dataSet in the appropriate record.
|
void |
setApplicationRecord(IptcApplicationRecord value)
Sets the Application Record.
|
void |
setEnvelopeRecord(IptcEnvelopeRecord value)
Sets the Envelope Record.
|
IReadOnlyList<IptcDataSet> |
toDataSetList()
Creates a list of dataSets from the package.
|
IReadOnlyList<IptcRecord> |
toList()
Creates a list from the package.
|
addProperties, contains, findProperties, get_Item, getCount, getKeys, getKnowPropertyDescriptors, getMetadataType, getPropertyDescriptors, iterator, removeProperties, sanitize, setProperties, updateProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public IptcRecordSet()
Initializes a new instance of the IptcRecordSet
class.
public IptcRecordSet(IptcDataSet[] dataSets)
Initializes a new instance of the IptcRecordSet
class.
dataSets
- An array of IPTC dataSets.public final IptcEnvelopeRecord getEnvelopeRecord()
Gets the Envelope Record.
public final void setEnvelopeRecord(IptcEnvelopeRecord value)
Sets the Envelope Record.
value
- The Envelope Record.public final IptcApplicationRecord getApplicationRecord()
Gets the Application Record.
public final void setApplicationRecord(IptcApplicationRecord value)
Sets the Application Record.
value
- The Application Record.public final IptcRecord get_Item(byte recordNumber)
Gets the IptcRecord
with the specified number.
recordNumber
- The record number.IptcRecord
with the specified number, if found; otherwise null.public final IptcDataSet get_Item(byte recordNumber, byte dataSetNumber)
Gets the IptcDataSet
with the specified record and dataSet number.
recordNumber
- The record number.dataSetNumber
- The dataSet number.IptcDataSet
with the specified record and dataSet number.public final void set(IptcDataSet dataSet)
Adds or updates the specified dataSet in the appropriate record.
dataSet
- The IPTC dataSet to add/update.public final void add(IptcDataSet dataSet)
Adds the specified dataSet to the appropriate record. The dataSet is considered as repeatable if a dataSet with the specified number already exists.
dataSet
- The IPTC dataSet to add.public final boolean remove(byte recordNumber, byte dataSetNumber)
Removes the dataSet with the specified record and dataSet number.
recordNumber
- The record number.dataSetNumber
- The dataSet number.public final void clear()
Removes all records from the collection.
public final boolean remove(byte recordNumber)
Removes the record with the specified record number.
recordNumber
- The record number.public final IReadOnlyList<IptcDataSet> toDataSetList()
Creates a list of dataSets from the package.
public final IReadOnlyList<IptcRecord> toList()
Creates a list from the package.