Skip to content

Commit d34dbbb

Browse files
BezrukovMiText-CI
authored andcommitted
Fix javadoc for TIFFDirectory and TIFFField
DEVSIX-4193
1 parent 5122a85 commit d34dbbb

File tree

2 files changed

+44
-13
lines changed

2 files changed

+44
-13
lines changed

io/src/main/java/com/itextpdf/io/codec/TIFFDirectory.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static boolean isValidEndianTag(int endian) {
129129
*
130130
* @param stream a SeekableStream to read from.
131131
* @param directory the index of the directory to read.
132-
* @throws java.io.IOException
132+
* @throws java.io.IOException in case of any I/O error.
133133
*/
134134
public TIFFDirectory(RandomAccessFileOrArray stream, int directory)
135135
throws java.io.IOException {
@@ -182,7 +182,7 @@ public TIFFDirectory(RandomAccessFileOrArray stream, int directory)
182182
* @param directory the index of the directory to read beyond the
183183
* one at the current stream offset; zero indicates the IFD
184184
* at the current offset.
185-
* @throws java.io.IOException
185+
* @throws java.io.IOException in case of any I/O error.
186186
*/
187187
public TIFFDirectory(RandomAccessFileOrArray stream, long ifd_offset, int directory)
188188
throws java.io.IOException {
@@ -689,7 +689,7 @@ private static long readUnsignedInt(RandomAccessFileOrArray stream,
689689
* @param stream RandomAccessFileOrArray
690690
* @return The number of image directories (subimages) stored
691691
* in a given TIFF file
692-
* @throws java.io.IOException
692+
* @throws java.io.IOException in case of any I/O error.
693693
*/
694694
public static int getNumDirectories(RandomAccessFileOrArray stream)
695695
throws java.io.IOException {
@@ -734,16 +734,19 @@ public static int getNumDirectories(RandomAccessFileOrArray stream)
734734

735735
/**
736736
* Returns a boolean indicating whether the byte order used in the
737-
* the TIFF file is big-endian (i.e. whether the byte order is from
737+
* TIFF file is big-endian (i.e. whether the byte order is from
738738
* the most significant to the least significant)
739+
*
740+
* @return {@code true} if the byte order used in the TIFF file is big-endian
739741
*/
740742
public boolean isBigEndian() {
741743
return isBigEndian;
742744
}
743745

744746
/**
745-
* Returns the offset of the IFD corresponding to this
746-
* <code>TIFFDirectory</code>.
747+
* Returns the offset of the IFD corresponding to this <code>TIFFDirectory</code>.
748+
*
749+
* @return the offset of the IFD corresponding to this <code>TIFFDirectory</code>.
747750
*/
748751
public long getIFDOffset() {
749752
return IFDOffset;
@@ -752,6 +755,9 @@ public long getIFDOffset() {
752755
/**
753756
* Returns the offset of the next IFD after the IFD corresponding to this
754757
* <code>TIFFDirectory</code>.
758+
*
759+
* @return the offset of the next IFD after the IFD corresponding to this
760+
* <code>TIFFDirectory</code>.
755761
*/
756762
public long getNextIFDOffset() {
757763
return nextIFDOffset;

io/src/main/java/com/itextpdf/io/codec/TIFFField.java

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ public class TIFFField implements Comparable<TIFFField>, Serializable {
167167
* </tr>
168168
* </table>
169169
*
170-
* @param tag The tag
171-
* @param type
172-
* @param count
173-
* @param data
170+
* @param tag the tag number
171+
* @param type the tag type
172+
* @param count the number of data items present in the field
173+
* @param data the field data
174174
*/
175175
public TIFFField(int tag, int type, int count, Object data) {
176176
this.tag = tag;
@@ -246,6 +246,8 @@ public char[] getAsChars() {
246246
*
247247
* <p> A ClassCastException will be thrown if the field is not
248248
* of type TIFF_SSHORT.
249+
*
250+
* @return TIFF_SSHORT data as an array of shorts (signed 16-bit integers).
249251
*/
250252
public short[] getAsShorts() {
251253
return (short[])data;
@@ -257,6 +259,8 @@ public short[] getAsShorts() {
257259
*
258260
* <p> A ClassCastException will be thrown if the field is not
259261
* of type TIFF_SLONG.
262+
*
263+
* @return TIFF_SLONG data as an array of ints (signed 32-bit integers).
260264
*/
261265
public int[] getAsInts() {
262266
return (int[])data;
@@ -268,6 +272,8 @@ public int[] getAsInts() {
268272
*
269273
* <p> A ClassCastException will be thrown if the field is not
270274
* of type TIFF_LONG.
275+
*
276+
* @return TIFF_LONG data as an array of longs (signed 64-bit integers).
271277
*/
272278
public long[] getAsLongs() {
273279
return (long[])data;
@@ -278,6 +284,8 @@ public long[] getAsLongs() {
278284
*
279285
* <p> A ClassCastException will be thrown if the field is not
280286
* of type TIFF_FLOAT.
287+
*
288+
* @return TIFF_FLOAT data as an array of floats.
281289
*/
282290
public float[] getAsFloats() {
283291
return (float[])data;
@@ -288,6 +296,8 @@ public float[] getAsFloats() {
288296
*
289297
* <p> A ClassCastException will be thrown if the field is not
290298
* of type TIFF_DOUBLE.
299+
*
300+
* @return TIFF_DOUBLE data as an array of doubles.
291301
*/
292302
public double[] getAsDoubles() {
293303
return (double[])data;
@@ -298,6 +308,8 @@ public double[] getAsDoubles() {
298308
*
299309
* <p> A ClassCastException will be thrown if the field is not
300310
* of type TIFF_ASCII.
311+
*
312+
* @return TIFF_ASCII data as an array of strings.
301313
*/
302314
public String[] getAsStrings() {
303315
return (String[]) data;
@@ -308,6 +320,8 @@ public String[] getAsStrings() {
308320
*
309321
* <p> A ClassCastException will be thrown if the field is not
310322
* of type TIFF_SRATIONAL.
323+
*
324+
* @return TIFF_SRATIONAL data as an array of 2-element arrays of ints.
311325
*/
312326
public int[][] getAsSRationals() {
313327
return (int[][])data;
@@ -318,6 +332,8 @@ public int[][] getAsSRationals() {
318332
*
319333
* <p> A ClassCastException will be thrown if the field is not
320334
* of type TIFF_RATTIONAL.
335+
*
336+
* @return TIFF_RATIONAL data as an array of 2-element arrays of longs.
321337
*/
322338
public long[][] getAsRationals() {
323339
return (long[][])data;
@@ -337,6 +353,8 @@ public long[][] getAsRationals() {
337353
* TIFF_SSHORT, or TIFF_SLONG.
338354
*
339355
* @param index The index
356+
* @return data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT, TIFF_SSHORT,
357+
* or TIFF_SLONG format as an int.
340358
*/
341359
public int getAsInt(int index) {
342360
switch (type) {
@@ -369,6 +387,8 @@ public int getAsInt(int index) {
369387
* TIFF_SSHORT, TIFF_SLONG, or TIFF_LONG.
370388
*
371389
* @param index The index
390+
* @return data in TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG,
391+
* or TIFF_LONG format as a long.
372392
*/
373393
public long getAsLong(int index) {
374394
switch (type) {
@@ -390,17 +410,18 @@ public long getAsLong(int index) {
390410
}
391411

392412
/**
393-
* Returns data in any numerical format as a float. Data in
413+
* Returns data in any numerical format as a float. Data in
394414
* TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
395415
* dividing the numerator into the denominator using
396416
* double-precision arithmetic and then truncating to single
397-
* precision. Data in TIFF_SLONG, TIFF_LONG, or TIFF_DOUBLE
417+
* precision. Data in TIFF_SLONG, TIFF_LONG, or TIFF_DOUBLE
398418
* format may suffer from truncation.
399419
*
400420
* <p> A ClassCastException will be thrown if the field is
401421
* of type TIFF_UNDEFINED or TIFF_ASCII.
402422
*
403423
* @param index The index
424+
* @return data in any numerical format as a float.
404425
*/
405426
public float getAsFloat(int index) {
406427
switch (type) {
@@ -432,7 +453,7 @@ public float getAsFloat(int index) {
432453
}
433454

434455
/**
435-
* Returns data in any numerical format as a float. Data in
456+
* Returns data in any numerical format as a double. Data in
436457
* TIFF_SRATIONAL or TIFF_RATIONAL format are evaluated by
437458
* dividing the numerator into the denominator using
438459
* double-precision arithmetic.
@@ -441,6 +462,7 @@ public float getAsFloat(int index) {
441462
* type TIFF_UNDEFINED or TIFF_ASCII.
442463
*
443464
* @param index The index
465+
* @return data in any numerical format as a double.
444466
*/
445467
public double getAsDouble(int index) {
446468
switch (type) {
@@ -478,6 +500,7 @@ public double getAsDouble(int index) {
478500
* of type TIFF_ASCII.
479501
*
480502
* @param index The index
503+
* @return a TIFF_ASCII data item as a String.
481504
*/
482505
public String getAsString(int index) {
483506
return ((String[])data)[index];
@@ -491,6 +514,7 @@ public String getAsString(int index) {
491514
* of type TIFF_SRATIONAL.
492515
*
493516
* @param index The index
517+
* @return a TIFF_SRATIONAL data item as a two-element array of ints.
494518
*/
495519
public int[] getAsSRational(int index) {
496520
return ((int[][])data)[index];
@@ -504,6 +528,7 @@ public int[] getAsSRational(int index) {
504528
* of type TIFF_RATIONAL.
505529
*
506530
* @param index The index
531+
* @return a TIFF_RATIONAL data item as a two-element array of ints
507532
*/
508533
public long[] getAsRational(int index) {
509534
if (type == TIFF_LONG)

0 commit comments

Comments
 (0)