mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-03 23:53:15 -04:00
New code style. No functional changes.
This commit is contained in:
@@ -41,17 +41,17 @@ import java.util.List;
|
||||
* @version $Id: AbstractDirectory.java,v 1.0 Nov 11, 2009 5:31:04 PM haraldk Exp$
|
||||
*/
|
||||
public abstract class AbstractDirectory implements Directory {
|
||||
private final List<Entry> mEntries = new ArrayList<Entry>();
|
||||
private final List<Entry> entries = new ArrayList<Entry>();
|
||||
|
||||
protected AbstractDirectory(final Collection<? extends Entry> pEntries) {
|
||||
if (pEntries != null) {
|
||||
mEntries.addAll(pEntries);
|
||||
entries.addAll(pEntries);
|
||||
}
|
||||
}
|
||||
|
||||
public Entry getEntryById(final Object pIdentifier) {
|
||||
public Entry getEntryById(final Object identifier) {
|
||||
for (Entry entry : this) {
|
||||
if (entry.getIdentifier().equals(pIdentifier)) {
|
||||
if (entry.getIdentifier().equals(identifier)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
@@ -59,9 +59,9 @@ public abstract class AbstractDirectory implements Directory {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Entry getEntryByFieldName(final String pFieldName) {
|
||||
public Entry getEntryByFieldName(final String fieldName) {
|
||||
for (Entry entry : this) {
|
||||
if (entry.getFieldName() != null && entry.getFieldName().equals(pFieldName)) {
|
||||
if (entry.getFieldName() != null && entry.getFieldName().equals(fieldName)) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public abstract class AbstractDirectory implements Directory {
|
||||
}
|
||||
|
||||
public Iterator<Entry> iterator() {
|
||||
return mEntries.iterator();
|
||||
return entries.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,23 +85,23 @@ public abstract class AbstractDirectory implements Directory {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean add(final Entry pEntry) {
|
||||
public boolean add(final Entry entry) {
|
||||
assertMutable();
|
||||
|
||||
// TODO: Replace if entry is already present?
|
||||
// Some directories may need special ordering, or may/may not support multiple entries for certain ids...
|
||||
return mEntries.add(pEntry);
|
||||
return entries.add(entry);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public boolean remove(final Object pEntry) {
|
||||
public boolean remove(final Object entry) {
|
||||
assertMutable();
|
||||
|
||||
return mEntries.remove(pEntry);
|
||||
return entries.remove(entry);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return mEntries.size();
|
||||
return entries.size();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ public abstract class AbstractDirectory implements Directory {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mEntries.hashCode();
|
||||
return entries.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,11 +134,11 @@ public abstract class AbstractDirectory implements Directory {
|
||||
// Safe cast, as it must be a subclass for the classes to be equal
|
||||
AbstractDirectory other = (AbstractDirectory) pOther;
|
||||
|
||||
return mEntries.equals(other.mEntries);
|
||||
return entries.equals(other.entries);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s%s", getClass().getSimpleName(), mEntries.toString());
|
||||
return String.format("%s%s", getClass().getSimpleName(), entries.toString());
|
||||
}
|
||||
}
|
||||
|
@@ -42,18 +42,18 @@ import java.util.Arrays;
|
||||
*/
|
||||
public abstract class AbstractEntry implements Entry {
|
||||
|
||||
private final Object mIdentifier;
|
||||
private final Object mValue; // TODO: Might need to be mutable..
|
||||
private final Object identifier;
|
||||
private final Object value; // TODO: Might need to be mutable..
|
||||
|
||||
protected AbstractEntry(final Object pIdentifier, final Object pValue) {
|
||||
Validate.notNull(pIdentifier, "identifier");
|
||||
protected AbstractEntry(final Object identifier, final Object value) {
|
||||
Validate.notNull(identifier, "identifier");
|
||||
|
||||
mIdentifier = pIdentifier;
|
||||
mValue = pValue;
|
||||
this.identifier = identifier;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public final Object getIdentifier() {
|
||||
return mIdentifier;
|
||||
return identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,64 +66,64 @@ public abstract class AbstractEntry implements Entry {
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return mValue;
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getValueAsString() {
|
||||
if (valueCount() > 1) {
|
||||
if (valueCount() < 16) {
|
||||
Class<?> type = mValue.getClass().getComponentType();
|
||||
Class<?> type = value.getClass().getComponentType();
|
||||
|
||||
if (type.isPrimitive()) {
|
||||
if (type.equals(boolean.class)) {
|
||||
return Arrays.toString((boolean[]) mValue);
|
||||
return Arrays.toString((boolean[]) value);
|
||||
}
|
||||
else if (type.equals(byte.class)) {
|
||||
return Arrays.toString((byte[]) mValue);
|
||||
return Arrays.toString((byte[]) value);
|
||||
}
|
||||
else if (type.equals(char.class)) {
|
||||
return new String((char[]) mValue);
|
||||
return new String((char[]) value);
|
||||
}
|
||||
else if (type.equals(double.class)) {
|
||||
return Arrays.toString((double[]) mValue);
|
||||
return Arrays.toString((double[]) value);
|
||||
}
|
||||
else if (type.equals(float.class)) {
|
||||
return Arrays.toString((float[]) mValue);
|
||||
return Arrays.toString((float[]) value);
|
||||
}
|
||||
else if (type.equals(int.class)) {
|
||||
return Arrays.toString((int[]) mValue);
|
||||
return Arrays.toString((int[]) value);
|
||||
}
|
||||
else if (type.equals(long.class)) {
|
||||
return Arrays.toString((long[]) mValue);
|
||||
return Arrays.toString((long[]) value);
|
||||
}
|
||||
else if (type.equals(short.class)) {
|
||||
return Arrays.toString((short[]) mValue);
|
||||
return Arrays.toString((short[]) value);
|
||||
}
|
||||
// Fall through should never happen
|
||||
}
|
||||
else {
|
||||
return Arrays.toString((Object[]) mValue);
|
||||
return Arrays.toString((Object[]) value);
|
||||
}
|
||||
}
|
||||
|
||||
return String.valueOf(mValue) + " (" + valueCount() + ")";
|
||||
return String.valueOf(value) + " (" + valueCount() + ")";
|
||||
}
|
||||
|
||||
return String.valueOf(mValue);
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
if (mValue == null) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return mValue.getClass().getSimpleName();
|
||||
return value.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
public int valueCount() {
|
||||
// TODO: Collection support?
|
||||
if (mValue != null && mValue.getClass().isArray()) {
|
||||
return Array.getLength(mValue);
|
||||
if (value != null && value.getClass().isArray()) {
|
||||
return Array.getLength(value);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -135,7 +135,7 @@ public abstract class AbstractEntry implements Entry {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return mIdentifier.hashCode() + 31 * mValue.hashCode();
|
||||
return identifier.hashCode() + 31 * value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -149,8 +149,8 @@ public abstract class AbstractEntry implements Entry {
|
||||
|
||||
AbstractEntry other = (AbstractEntry) pOther;
|
||||
|
||||
return mIdentifier.equals(other.mIdentifier) && (
|
||||
mValue == null && other.mValue == null || mValue != null && mValue.equals(other.mValue)
|
||||
return identifier.equals(other.identifier) && (
|
||||
value == null && other.value == null || value != null && value.equals(other.value)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -38,9 +38,9 @@ package com.twelvemonkeys.imageio.metadata;
|
||||
public interface Directory extends Iterable<Entry> {
|
||||
// TODO: Spec when more entries exist? Or make Entry support multi-values!?
|
||||
// For multiple entries with same id in directory, the first entry (using the order from the stream) will be returned
|
||||
Entry getEntryById(Object pIdentifier);
|
||||
Entry getEntryById(Object identifier);
|
||||
|
||||
Entry getEntryByFieldName(String pName);
|
||||
Entry getEntryByFieldName(String fieldName);
|
||||
|
||||
// Iterator containing the entries in
|
||||
//Iterator<Entry> getBestEntries(Object pIdentifier, Object pQualifier, String pLanguage);
|
||||
@@ -51,9 +51,9 @@ public interface Directory extends Iterable<Entry> {
|
||||
// boolean replace(Entry pEntry)??
|
||||
// boolean contains(Object pIdentifier)?
|
||||
|
||||
boolean add(Entry pEntry);
|
||||
boolean add(Entry entry);
|
||||
|
||||
boolean remove(Object pEntry); // Object in case we retro-fit Collection/Map..
|
||||
boolean remove(Object entry); // Object in case we retro-fit Collection/Map..
|
||||
|
||||
int size();
|
||||
|
||||
|
@@ -39,5 +39,5 @@ import java.io.IOException;
|
||||
* @version $Id: MetadataReader.java,v 1.0 Nov 13, 2009 8:38:11 PM haraldk Exp$
|
||||
*/
|
||||
public abstract class MetadataReader {
|
||||
public abstract Directory read(ImageInputStream pInput) throws IOException;
|
||||
public abstract Directory read(ImageInputStream input) throws IOException;
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ import java.util.Collection;
|
||||
* @version $Id: EXIFDirectory.java,v 1.0 Nov 11, 2009 5:02:59 PM haraldk Exp$
|
||||
*/
|
||||
final class EXIFDirectory extends AbstractDirectory {
|
||||
EXIFDirectory(final Collection<? extends Entry> pEntries) {
|
||||
super(pEntries);
|
||||
EXIFDirectory(final Collection<? extends Entry> entries) {
|
||||
super(entries);
|
||||
}
|
||||
}
|
||||
|
@@ -38,20 +38,20 @@ import com.twelvemonkeys.imageio.metadata.AbstractEntry;
|
||||
* @version $Id: EXIFEntry.java,v 1.0 Nov 13, 2009 5:47:35 PM haraldk Exp$
|
||||
*/
|
||||
final class EXIFEntry extends AbstractEntry {
|
||||
final private short mType;
|
||||
final private short type;
|
||||
|
||||
EXIFEntry(final int pIdentifier, final Object pValue, final short pType) {
|
||||
super(pIdentifier, pValue);
|
||||
EXIFEntry(final int identifier, final Object value, final short type) {
|
||||
super(identifier, value);
|
||||
|
||||
// if (pType < 1 || pType > TIFF.TYPE_NAMES.length) {
|
||||
// throw new IllegalArgumentException(String.format("Illegal EXIF type: %s", pType));
|
||||
// if (type < 1 || type > TIFF.TYPE_NAMES.length) {
|
||||
// throw new IllegalArgumentException(String.format("Illegal EXIF type: %s", type));
|
||||
// }
|
||||
|
||||
mType = pType;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public short getType() {
|
||||
return mType;
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,6 +110,6 @@ final class EXIFEntry extends AbstractEntry {
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TIFF.TYPE_NAMES[mType - 1];
|
||||
return TIFF.TYPE_NAMES[type - 1];
|
||||
}
|
||||
}
|
||||
|
@@ -56,14 +56,14 @@ public final class EXIFReader extends MetadataReader {
|
||||
static final Collection<Integer> KNOWN_IFDS = Arrays.asList(TIFF.TAG_EXIF_IFD, TIFF.TAG_GPS_IFD, TIFF.TAG_INTEROP_IFD);
|
||||
|
||||
@Override
|
||||
public Directory read(final ImageInputStream pInput) throws IOException {
|
||||
public Directory read(final ImageInputStream input) throws IOException {
|
||||
byte[] bom = new byte[2];
|
||||
pInput.readFully(bom);
|
||||
input.readFully(bom);
|
||||
if (bom[0] == 'I' && bom[1] == 'I') {
|
||||
pInput.setByteOrder(ByteOrder.LITTLE_ENDIAN);
|
||||
input.setByteOrder(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
else if (bom[0] == 'M' && bom[1] == 'M') {
|
||||
pInput.setByteOrder(ByteOrder.BIG_ENDIAN);
|
||||
input.setByteOrder(ByteOrder.BIG_ENDIAN);
|
||||
}
|
||||
else {
|
||||
throw new IIOException(String.format("Invalid TIFF byte order mark '%s', expected: 'II' or 'MM'", StringUtil.decode(bom, 0, bom.length, "ASCII")));
|
||||
@@ -71,14 +71,14 @@ public final class EXIFReader extends MetadataReader {
|
||||
|
||||
// TODO: BigTiff uses version 43 instead of TIFF's 42, and header is slightly different, see
|
||||
// http://www.awaresystems.be/imaging/tiff/bigtiff.html
|
||||
int magic = pInput.readUnsignedShort();
|
||||
int magic = input.readUnsignedShort();
|
||||
if (magic != TIFF.TIFF_MAGIC) {
|
||||
throw new IIOException(String.format("Wrong TIFF magic in EXIF data: %04x, expected: %04x", magic, TIFF.TIFF_MAGIC));
|
||||
}
|
||||
|
||||
long directoryOffset = pInput.readUnsignedInt();
|
||||
long directoryOffset = input.readUnsignedInt();
|
||||
|
||||
return readDirectory(pInput, directoryOffset);
|
||||
return readDirectory(input, directoryOffset);
|
||||
}
|
||||
|
||||
private EXIFDirectory readDirectory(final ImageInputStream pInput, final long pOffset) throws IOException {
|
||||
|
@@ -54,8 +54,8 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
// Inspired by http://www.cs.princeton.edu/introcs/92symbolic/Rational.java.html and java.lang.Integer
|
||||
static final Rational ZERO = new Rational(0, 1);
|
||||
|
||||
private final long mNumerator;
|
||||
private final long mDenominator;
|
||||
private final long numerator;
|
||||
private final long denominator;
|
||||
|
||||
public Rational(final long pNumber) {
|
||||
this(pNumber, 1);
|
||||
@@ -74,8 +74,8 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
long num = pNumerator / gcd;
|
||||
long den = pDenominator / gcd;
|
||||
|
||||
mNumerator = pDenominator >= 0 ? num : -num;
|
||||
mDenominator = pDenominator >= 0 ? den : -den;
|
||||
numerator = pDenominator >= 0 ? num : -num;
|
||||
denominator = pDenominator >= 0 ? den : -den;
|
||||
}
|
||||
|
||||
private static long gcd(final long m, final long n) {
|
||||
@@ -95,11 +95,11 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
}
|
||||
|
||||
public long numerator() {
|
||||
return mNumerator;
|
||||
return numerator;
|
||||
}
|
||||
|
||||
public long denominator() {
|
||||
return mDenominator;
|
||||
return denominator;
|
||||
}
|
||||
|
||||
/// Number implementation
|
||||
@@ -121,7 +121,7 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
|
||||
@Override
|
||||
public double doubleValue() {
|
||||
return mNumerator / (double) mDenominator;
|
||||
return numerator / (double) denominator;
|
||||
}
|
||||
|
||||
/// Comparable implementation
|
||||
@@ -147,7 +147,7 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return mDenominator == 1 ? Long.toString(mNumerator) : String.format("%s/%s", mNumerator, mDenominator);
|
||||
return denominator == 1 ? Long.toString(numerator) : String.format("%s/%s", numerator, denominator);
|
||||
}
|
||||
|
||||
/// Operations (adapted from http://www.cs.princeton.edu/introcs/92symbolic/Rational.java.html)
|
||||
@@ -161,10 +161,10 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
}
|
||||
|
||||
// reduce p1/q2 and p2/q1, then multiply, where a = p1/q1 and b = p2/q2
|
||||
Rational c = new Rational(mNumerator, pOther.mDenominator);
|
||||
Rational d = new Rational(pOther.mNumerator, mDenominator);
|
||||
Rational c = new Rational(numerator, pOther.denominator);
|
||||
Rational d = new Rational(pOther.numerator, denominator);
|
||||
|
||||
return new Rational(c.mNumerator * d.mNumerator, c.mDenominator * d.mDenominator);
|
||||
return new Rational(c.numerator * d.numerator, c.denominator * d.denominator);
|
||||
}
|
||||
|
||||
// return a + b, staving off overflow
|
||||
@@ -178,20 +178,20 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
}
|
||||
|
||||
// Find gcd of numerators and denominators
|
||||
long f = gcd(mNumerator, pOther.mNumerator);
|
||||
long g = gcd(mDenominator, pOther.mDenominator);
|
||||
long f = gcd(numerator, pOther.numerator);
|
||||
long g = gcd(denominator, pOther.denominator);
|
||||
|
||||
// add cross-product terms for numerator
|
||||
// multiply back in
|
||||
return new Rational(
|
||||
((mNumerator / f) * (pOther.mDenominator / g) + (pOther.mNumerator / f) * (mDenominator / g)) * f,
|
||||
lcm(mDenominator, pOther.mDenominator)
|
||||
((numerator / f) * (pOther.denominator / g) + (pOther.numerator / f) * (denominator / g)) * f,
|
||||
lcm(denominator, pOther.denominator)
|
||||
);
|
||||
}
|
||||
|
||||
// return -a
|
||||
public Rational negate() {
|
||||
return new Rational(-mNumerator, mDenominator);
|
||||
return new Rational(-numerator, denominator);
|
||||
}
|
||||
|
||||
// return a - b
|
||||
@@ -200,7 +200,7 @@ public final class Rational extends Number implements Comparable<Rational> {
|
||||
}
|
||||
|
||||
public Rational reciprocal() {
|
||||
return new Rational(mDenominator, mNumerator);
|
||||
return new Rational(denominator, numerator);
|
||||
}
|
||||
|
||||
// return a / b
|
||||
|
@@ -41,7 +41,7 @@ import java.util.Collection;
|
||||
* @version $Id: IPTCDirectory.java,v 1.0 Nov 11, 2009 5:02:59 PM haraldk Exp$
|
||||
*/
|
||||
final class IPTCDirectory extends AbstractDirectory {
|
||||
IPTCDirectory(final Collection<? extends Entry> pEntries) {
|
||||
super(pEntries);
|
||||
IPTCDirectory(final Collection<? extends Entry> entries) {
|
||||
super(entries);
|
||||
}
|
||||
}
|
@@ -38,8 +38,8 @@ import com.twelvemonkeys.imageio.metadata.AbstractEntry;
|
||||
* @version $Id: IPTCEntry.java,v 1.0 Nov 13, 2009 8:57:04 PM haraldk Exp$
|
||||
*/
|
||||
class IPTCEntry extends AbstractEntry {
|
||||
public IPTCEntry(final int pTagId, final Object pValue) {
|
||||
super(pTagId, pValue);
|
||||
public IPTCEntry(final int tagId, final Object value) {
|
||||
super(tagId, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -57,18 +57,18 @@ public final class IPTCReader extends MetadataReader {
|
||||
private static final int ENCODING_UNSPECIFIED = 0;
|
||||
private static final int ENCODING_UTF_8 = 0x1b2547;
|
||||
|
||||
private int mEncoding = ENCODING_UNSPECIFIED;
|
||||
private int encoding = ENCODING_UNSPECIFIED;
|
||||
|
||||
|
||||
@Override
|
||||
public Directory read(final ImageInputStream pInput) throws IOException {
|
||||
public Directory read(final ImageInputStream input) throws IOException {
|
||||
final List<Entry> entries = new ArrayList<Entry>();
|
||||
|
||||
// 0x1c identifies start of a tag
|
||||
while (pInput.read() == 0x1c) {
|
||||
short tagId = pInput.readShort();
|
||||
int tagByteCount = pInput.readUnsignedShort();
|
||||
Entry entry = readEntry(pInput, tagId, tagByteCount);
|
||||
while (input.read() == 0x1c) {
|
||||
short tagId = input.readShort();
|
||||
int tagByteCount = input.readUnsignedShort();
|
||||
Entry entry = readEntry(input, tagId, tagByteCount);
|
||||
|
||||
if (entry != null) {
|
||||
entries.add(entry);
|
||||
@@ -85,7 +85,7 @@ public final class IPTCReader extends MetadataReader {
|
||||
case IPTC.TAG_CODED_CHARACTER_SET:
|
||||
// TODO: Mapping from ISO 646 to Java supported character sets?
|
||||
// TODO: Move somewhere else?
|
||||
mEncoding = parseEncoding(pInput, pLength);
|
||||
encoding = parseEncoding(pInput, pLength);
|
||||
return null;
|
||||
case IPTC.TAG_RECORD_VERSION:
|
||||
// A single unsigned short value
|
||||
@@ -140,7 +140,7 @@ public final class IPTCReader extends MetadataReader {
|
||||
return chars.toString();
|
||||
}
|
||||
catch (CharacterCodingException notUTF8) {
|
||||
if (mEncoding == ENCODING_UTF_8) {
|
||||
if (encoding == ENCODING_UTF_8) {
|
||||
throw new IIOException("Wrong encoding of IPTC data, explicitly set to UTF-8 in DataSet 1:90", notUTF8);
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,7 @@ final class XMPDirectory extends AbstractDirectory {
|
||||
// TODO: XMPDirectory, maybe not even an AbstractDirectory
|
||||
// - Keeping the Document would allow for easier serialization
|
||||
// TODO: Or use direct SAX parsing
|
||||
public XMPDirectory(List<Entry> pEntries) {
|
||||
super(pEntries);
|
||||
public XMPDirectory(List<Entry> entries) {
|
||||
super(entries);
|
||||
}
|
||||
}
|
||||
|
@@ -38,20 +38,20 @@ import com.twelvemonkeys.imageio.metadata.AbstractEntry;
|
||||
* @version $Id: XMPEntry.java,v 1.0 Nov 17, 2009 9:38:39 PM haraldk Exp$
|
||||
*/
|
||||
final class XMPEntry extends AbstractEntry {
|
||||
private final String mFieldName;
|
||||
private final String fieldName;
|
||||
|
||||
public XMPEntry(final String pIdentifier, final Object pValue) {
|
||||
this(pIdentifier, null, pValue);
|
||||
public XMPEntry(final String identifier, final Object pValue) {
|
||||
this(identifier, null, pValue);
|
||||
}
|
||||
|
||||
public XMPEntry(final String pIdentifier, final String pFieldName, final Object pValue) {
|
||||
super(pIdentifier, pValue);
|
||||
mFieldName = pFieldName;
|
||||
public XMPEntry(final String identifier, final String fieldName, final Object value) {
|
||||
super(identifier, value);
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
@Override
|
||||
public String getFieldName() {
|
||||
return mFieldName != null ? mFieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier());
|
||||
return fieldName != null ? fieldName : XMP.DEFAULT_NS_MAPPING.get(getIdentifier());
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ import java.util.*;
|
||||
*/
|
||||
public final class XMPReader extends MetadataReader {
|
||||
@Override
|
||||
public Directory read(final ImageInputStream pInput) throws IOException {
|
||||
public Directory read(final ImageInputStream input) throws IOException {
|
||||
// pInput.mark();
|
||||
//
|
||||
// BufferedReader reader = new BufferedReader(new InputStreamReader(IIOUtil.createStreamAdapter(pInput), Charset.forName("UTF-8")));
|
||||
@@ -75,7 +75,7 @@ public final class XMPReader extends MetadataReader {
|
||||
// TODO: Determine encoding and parse using a Reader...
|
||||
// TODO: Refactor scanner to return inputstream?
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document document = builder.parse(new InputSource(IIOUtil.createStreamAdapter(pInput)));
|
||||
Document document = builder.parse(new InputSource(IIOUtil.createStreamAdapter(input)));
|
||||
|
||||
// XMLSerializer serializer = new XMLSerializer(System.err, System.getProperty("file.encoding"));
|
||||
// serializer.serialize(document);
|
||||
|
Reference in New Issue
Block a user