You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by da...@apache.org on 2016/09/14 23:25:48 UTC
svn commit: r1760815 [3/3] - in /commons/proper/imaging/trunk/src:
main/java/org/apache/commons/imaging/formats/tiff/
main/java/org/apache/commons/imaging/formats/tiff/constants/
main/java/org/apache/commons/imaging/formats/tiff/taginfos/ main/java/org...
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/constants/WangTagConstants.java Wed Sep 14 23:25:47 2016
@@ -21,7 +21,7 @@ import java.util.Collections;
import java.util.List;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfo;
-import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoBytes;
/**
* Wang/Eastman Software/Kodac/eiStream/Imaging for Windows tags,
@@ -29,7 +29,7 @@ import org.apache.commons.imaging.format
*/
public final class WangTagConstants {
- public static final TagInfoByte EXIF_TAG_WANG_ANNOTATION = new TagInfoByte(
+ public static final TagInfoBytes EXIF_TAG_WANG_ANNOTATION = new TagInfoBytes(
"WangAnnotation", 0x80a4, -1,
TiffDirectoryType.EXIF_DIRECTORY_UNKNOWN);
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoByte.java Wed Sep 14 23:25:47 2016
@@ -23,21 +23,21 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoByte extends TagInfo {
- public TagInfoByte(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.BYTE, length, directoryType);
+ public TagInfoByte(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.BYTE, 1, directoryType);
}
public TagInfoByte(final String name, final int tag, final List<FieldType> fieldTypes,
- final int length, final TiffDirectoryType directoryType) {
- super(name, tag, fieldTypes, length, directoryType);
+ final TiffDirectoryType directoryType) {
+ super(name, tag, fieldTypes, 1, directoryType);
}
public TagInfoByte(final String name, final int tag, final FieldType fieldType,
- final int length, final TiffDirectoryType directoryType) {
- super(name, tag, fieldType, length, directoryType);
+ final TiffDirectoryType directoryType) {
+ super(name, tag, fieldType, 1, directoryType);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {
- return values;
+ public byte[] encodeValue(final ByteOrder byteOrder, final byte value) {
+ return new byte[] { value };
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoBytes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoBytes.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoBytes.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoBytes.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+import java.util.List;
+
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoBytes extends TagInfo {
+ public TagInfoBytes(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.BYTE, length, directoryType);
+ }
+
+ public TagInfoBytes(final String name, final int tag, final List<FieldType> fieldTypes,
+ final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, fieldTypes, length, directoryType);
+ }
+
+ public TagInfoBytes(final String name, final int tag, final FieldType fieldType,
+ final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, fieldType, length, directoryType);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {
+ return values;
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoBytes.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDirectory.java Wed Sep 14 23:25:47 2016
@@ -22,8 +22,8 @@ import org.apache.commons.imaging.format
* A LONG representing an offset to a TIFF directory.
*/
public class TagInfoDirectory extends TagInfoLong {
- public TagInfoDirectory(final String name, final int tag, final int length,
+ public TagInfoDirectory(final String name, final int tag,
final TiffDirectoryType directoryType) {
- super(name, tag, length, directoryType, true);
+ super(name, tag, directoryType, true);
}
}
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDouble.java Wed Sep 14 23:25:47 2016
@@ -23,15 +23,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoDouble extends TagInfo {
- public TagInfoDouble(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.DOUBLE, length, directoryType);
+ public TagInfoDouble(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.DOUBLE, 1, directoryType);
}
- public double[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toDoubles(bytes, byteOrder);
+ public double getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toDouble(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final double... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final double value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDoubles.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDoubles.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDoubles.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDoubles.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoDoubles extends TagInfo {
+ public TagInfoDoubles(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.DOUBLE, length, directoryType);
+ }
+
+ public double[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toDoubles(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final double... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoDoubles.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloat.java Wed Sep 14 23:25:47 2016
@@ -23,15 +23,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoFloat extends TagInfo {
- public TagInfoFloat(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.FLOAT, length, directoryType);
+ public TagInfoFloat(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.FLOAT, 1, directoryType);
}
- public float[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toFloats(bytes, byteOrder);
+ public float getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toFloat(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final float... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final float value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloats.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloats.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloats.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloats.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoFloats extends TagInfo {
+ public TagInfoFloats(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.FLOAT, length, directoryType);
+ }
+
+ public float[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toFloats(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final float... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoFloats.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java Wed Sep 14 23:25:47 2016
@@ -58,9 +58,9 @@ public final class TagInfoGpsText extend
TEXT_ENCODING_UNDEFINED, //
};
- public TagInfoGpsText(final String name, final int tag, final int length,
+ public TagInfoGpsText(final String name, final int tag,
final TiffDirectoryType exifDirectory) {
- super(name, tag, FieldType.UNDEFINED, length, exifDirectory);
+ super(name, tag, FieldType.UNDEFINED, LENGTH_UNKNOWN, exifDirectory);
}
@Override
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLong.java Wed Sep 14 23:25:47 2016
@@ -24,19 +24,19 @@ import org.apache.commons.imaging.format
public class TagInfoLong extends TagInfo {
- public TagInfoLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.LONG, length, directoryType);
+ public TagInfoLong(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.LONG, 1, directoryType);
}
- public TagInfoLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
- super(name, tag, FieldType.LONG, length, directoryType, isOffset);
+ public TagInfoLong(final String name, final int tag, final TiffDirectoryType directoryType, final boolean isOffset) {
+ super(name, tag, FieldType.LONG, 1, directoryType, isOffset);
}
- public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toInts(bytes, byteOrder);
+ public int getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toInt(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final int value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongs.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongs.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongs.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongs.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoLongs extends TagInfo {
+ public TagInfoLongs(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.LONG, length, directoryType);
+ }
+
+ public TagInfoLongs(final String name, final int tag, final int length, final TiffDirectoryType directoryType, final boolean isOffset) {
+ super(name, tag, FieldType.LONG, length, directoryType, isOffset);
+ }
+
+ public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toInts(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoLongs.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRational.java Wed Sep 14 23:25:47 2016
@@ -24,15 +24,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoRational extends TagInfo {
- public TagInfoRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.RATIONAL, length, directoryType);
+ public TagInfoRational(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.RATIONAL, 1, directoryType);
}
- public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toRationals(bytes, byteOrder);
+ public RationalNumber getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toRational(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRationals.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRationals.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRationals.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRationals.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.common.RationalNumber;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoRationals extends TagInfo {
+ public TagInfoRationals(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.RATIONAL, length, directoryType);
+ }
+
+ public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toRationals(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoRationals.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSByte.java Wed Sep 14 23:25:47 2016
@@ -22,11 +22,11 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoSByte extends TagInfo {
- public TagInfoSByte(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.SBYTE, length, directoryType);
+ public TagInfoSByte(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SBYTE, 1, directoryType);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {
- return values;
+ public byte[] encodeValue(final ByteOrder byteOrder, final byte value) {
+ return new byte[] { value };
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSBytes.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSBytes.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSBytes.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSBytes.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoSBytes extends TagInfo {
+ public TagInfoSBytes(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SBYTE, length, directoryType);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final byte... values) {
+ return values;
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSBytes.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLong.java Wed Sep 14 23:25:47 2016
@@ -23,15 +23,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoSLong extends TagInfo {
- public TagInfoSLong(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.SLONG, length, directoryType);
+ public TagInfoSLong(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SLONG, 1, directoryType);
}
- public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toInts(bytes, byteOrder);
+ public int getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toInt(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final int value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLongs.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLongs.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLongs.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLongs.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoSLongs extends TagInfo {
+ public TagInfoSLongs(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SLONG, length, directoryType);
+ }
+
+ public int[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toInts(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final int... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSLongs.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRational.java Wed Sep 14 23:25:47 2016
@@ -24,15 +24,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoSRational extends TagInfo {
- public TagInfoSRational(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.SRATIONAL, length, directoryType);
+ public TagInfoSRational(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SRATIONAL, 1, directoryType);
}
- public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toRationals(bytes, byteOrder);
+ public RationalNumber getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toRational(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.common.RationalNumber;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoSRationals extends TagInfo {
+ public TagInfoSRationals(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SRATIONAL, length, directoryType);
+ }
+
+ public RationalNumber[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toRationals(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final RationalNumber... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSRationals.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShort.java Wed Sep 14 23:25:47 2016
@@ -23,15 +23,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoSShort extends TagInfo {
- public TagInfoSShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.SSHORT, length, directoryType);
+ public TagInfoSShort(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SSHORT, 1, directoryType);
}
- public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toShorts(bytes, byteOrder);
+ public short getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toShort(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final short value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoSShorts extends TagInfo {
+ public TagInfoSShorts(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SSHORT, length, directoryType);
+ }
+
+ public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toShorts(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoSShorts.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShort.java Wed Sep 14 23:25:47 2016
@@ -23,15 +23,15 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoShort extends TagInfo {
- public TagInfoShort(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.SHORT, length, directoryType);
+ public TagInfoShort(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SHORT, 1, directoryType);
}
- public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
- return ByteConversions.toShorts(bytes, byteOrder);
+ public short getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toShort(bytes, byteOrder);
}
- public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
- return ByteConversions.toBytes(values, byteOrder);
+ public byte[] encodeValue(final ByteOrder byteOrder, final short value) {
+ return ByteConversions.toBytes(value, byteOrder);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShorts.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShorts.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShorts.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShorts.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import java.nio.ByteOrder;
+
+import org.apache.commons.imaging.common.ByteConversions;
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoShorts extends TagInfo {
+ public TagInfoShorts(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.SHORT, length, directoryType);
+ }
+
+ public short[] getValue(final ByteOrder byteOrder, final byte[] bytes) {
+ return ByteConversions.toShorts(bytes, byteOrder);
+ }
+
+ public byte[] encodeValue(final ByteOrder byteOrder, final short... values) {
+ return ByteConversions.toBytes(values, byteOrder);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoShorts.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefined.java Wed Sep 14 23:25:47 2016
@@ -20,7 +20,7 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
public class TagInfoUndefined extends TagInfoByte {
- public TagInfoUndefined(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.UNDEFINED, length, directoryType);
+ public TagInfoUndefined(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.UNDEFINED, directoryType);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoUndefineds extends TagInfoBytes {
+ public TagInfoUndefineds(final String name, final int tag, final int length, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.UNDEFINED, length, directoryType);
+ }
+}
\ No newline at end of file
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUndefineds.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknown.java Wed Sep 14 23:25:47 2016
@@ -23,7 +23,7 @@ import org.apache.commons.imaging.format
* A TIFF tag whose definition isn't known.
*/
public final class TagInfoUnknown extends TagInfoByte {
- public TagInfoUnknown(final String name, final int tag, final int length, final TiffDirectoryType exifDirectory) {
- super(name, tag, FieldType.ANY, length, exifDirectory);
+ public TagInfoUnknown(final String name, final int tag, final TiffDirectoryType exifDirectory) {
+ super(name, tag, FieldType.ANY, exifDirectory);
}
}
Added: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java?rev=1760815&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java (added)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java Wed Sep 14 23:25:47 2016
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.imaging.formats.tiff.taginfos;
+
+import org.apache.commons.imaging.formats.tiff.constants.TiffDirectoryType;
+import org.apache.commons.imaging.formats.tiff.fieldtypes.FieldType;
+
+public class TagInfoUnknowns extends TagInfoBytes {
+ public TagInfoUnknowns(final String name, final int tag, final int length, final TiffDirectoryType exifDirectory) {
+ super(name, tag, FieldType.ANY, length, exifDirectory);
+ }
+}
Propchange: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoUnknowns.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoXpString.java Wed Sep 14 23:25:47 2016
@@ -30,9 +30,8 @@ import org.apache.commons.imaging.format
* - here we deal with this.
*/
public class TagInfoXpString extends TagInfo {
- public TagInfoXpString(final String name, final int tag, final int length,
- final TiffDirectoryType directoryType) {
- super(name, tag, FieldType.BYTE, length, directoryType);
+ public TagInfoXpString(final String name, final int tag, final TiffDirectoryType directoryType) {
+ super(name, tag, FieldType.BYTE, LENGTH_UNKNOWN, directoryType);
}
@Override
Modified: commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java (original)
+++ commons/proper/imaging/trunk/src/main/java/org/apache/commons/imaging/formats/tiff/write/TiffOutputDirectory.java Wed Sep 14 23:25:47 2016
@@ -16,6 +16,11 @@
*/
package org.apache.commons.imaging.formats.tiff.write;
+import static org.apache.commons.imaging.formats.tiff.constants.TiffConstants.TIFF_DIRECTORY_FOOTER_LENGTH;
+import static org.apache.commons.imaging.formats.tiff.constants.TiffConstants.TIFF_DIRECTORY_HEADER_LENGTH;
+import static org.apache.commons.imaging.formats.tiff.constants.TiffConstants.TIFF_ENTRY_LENGTH;
+import static org.apache.commons.imaging.formats.tiff.constants.TiffConstants.TIFF_ENTRY_MAX_VALUE_LENGTH;
+
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
@@ -39,23 +44,31 @@ import org.apache.commons.imaging.format
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoAsciiOrRational;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByte;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoByteOrShort;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoBytes;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDouble;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoDoubles;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoFloat;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoFloats;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoGpsText;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLong;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoLongs;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRational;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoRationals;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSByte;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSBytes;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSLong;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSLongs;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSRational;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSRationals;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSShort;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoSShorts;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShort;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShortOrLong;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShortOrLongOrRational;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShortOrRational;
+import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoShorts;
import org.apache.commons.imaging.formats.tiff.taginfos.TagInfoXpString;
-import static org.apache.commons.imaging.formats.tiff.constants.TiffConstants.*;
-
public final class TiffOutputDirectory extends TiffOutputItem {
public final int type;
private final List<TiffOutputField> fields = new ArrayList<>();
@@ -85,7 +98,19 @@ public final class TiffOutputDirectory e
this.byteOrder = byteOrder;
}
- public void add(final TagInfoByte tagInfo, final byte... values)
+ public void add(final TagInfoByte tagInfo, final byte value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.BYTE, bytes.length, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoBytes tagInfo, final byte... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -111,7 +136,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoShort tagInfo, final short... values)
+ public void add(final TagInfoShort tagInfo, final short value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.SHORT, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoShorts tagInfo, final short... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -124,7 +161,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoLong tagInfo, final int... values)
+ public void add(final TagInfoLong tagInfo, final int value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.LONG, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoLongs tagInfo, final int... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -137,7 +186,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoRational tagInfo, final RationalNumber... values)
+ public void add(final TagInfoRational tagInfo, final RationalNumber value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.RATIONAL, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoRationals tagInfo, final RationalNumber... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -150,7 +211,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoSByte tagInfo, final byte... values)
+ public void add(final TagInfoSByte tagInfo, final byte value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.SBYTE, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoSBytes tagInfo, final byte... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -163,7 +236,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoSShort tagInfo, final short... values)
+ public void add(final TagInfoSShort tagInfo, final short value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.SSHORT, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoSShorts tagInfo, final short... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -176,7 +261,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoSLong tagInfo, final int... values)
+ public void add(final TagInfoSLong tagInfo, final int value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.SLONG, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoSLongs tagInfo, final int... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -189,7 +286,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoSRational tagInfo, final RationalNumber... values)
+ public void add(final TagInfoSRational tagInfo, final RationalNumber value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.SRATIONAL, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoSRationals tagInfo, final RationalNumber... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -202,7 +311,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoFloat tagInfo, final float... values)
+ public void add(final TagInfoFloat tagInfo, final float value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.FLOAT, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoFloats tagInfo, final float... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
@@ -215,7 +336,19 @@ public final class TiffOutputDirectory e
add(tiffOutputField);
}
- public void add(final TagInfoDouble tagInfo, final double... values)
+ public void add(final TagInfoDouble tagInfo, final double value)
+ throws ImageWriteException {
+ if (tagInfo.length != 1) {
+ throw new ImageWriteException("Tag expects " + tagInfo.length
+ + " value(s), not 1");
+ }
+ final byte[] bytes = tagInfo.encodeValue(byteOrder, value);
+ final TiffOutputField tiffOutputField = new TiffOutputField(tagInfo.tag,
+ tagInfo, FieldType.DOUBLE, 1, bytes);
+ add(tiffOutputField);
+ }
+
+ public void add(final TagInfoDoubles tagInfo, final double... values)
throws ImageWriteException {
if (tagInfo.length > 0 && tagInfo.length != values.length) {
throw new ImageWriteException("Tag expects " + tagInfo.length
Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java?rev=1760815&r1=1760814&r2=1760815&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/tiff/TiffReadWriteTagsTest.java Wed Sep 14 23:25:47 2016
@@ -74,14 +74,14 @@ public class TiffReadWriteTagsTest exten
TiffDirectory rootDir = contents.directories.get(0);
assertEquals(description, rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_DESCRIPTION));
assertEquals(page, rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_PAGE_NUMBER, true)[0]);
- RationalNumber yRes = rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
+ RationalNumber yRes = rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_YRESOLUTION);
assertEquals(twoThirds.numerator, yRes.numerator);
assertEquals(twoThirds.divisor, yRes.divisor);
- assertEquals(t4Options, rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_T4_OPTIONS));
+ assertEquals(t4Options, rootDir.getFieldValue(TiffTagConstants.TIFF_TAG_T4_OPTIONS));
assertEquals(width, rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_WIDTH));
assertEquals(width, rootDir.getSingleFieldValue(TiffTagConstants.TIFF_TAG_IMAGE_LENGTH));
assertEquals(area, rootDir.getFieldValue(GpsTagConstants.GPS_TAG_GPS_AREA_INFORMATION, true));
- assertEquals(widthRes, rootDir.getSingleFieldValue(MicrosoftHdPhotoTagConstants.EXIF_TAG_WIDTH_RESOLUTION), 0.0);
- assertEquals(geoDoubleParams, rootDir.getSingleFieldValue(GeoTiffTagConstants.EXIF_TAG_GEO_DOUBLE_PARAMS_TAG), 0.0);
+ assertEquals(widthRes, rootDir.getFieldValue(MicrosoftHdPhotoTagConstants.EXIF_TAG_WIDTH_RESOLUTION), 0.0);
+ assertEquals(geoDoubleParams, rootDir.getFieldValue(GeoTiffTagConstants.EXIF_TAG_GEO_DOUBLE_PARAMS_TAG, true)[0], 0.0);
}
}