1 | /*
|
---|
2 | * Copyright 2002-2016 Drew Noakes
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | * More information about this project is available at:
|
---|
17 | *
|
---|
18 | * https://drewnoakes.com/code/exif/
|
---|
19 | * https://github.com/drewnoakes/metadata-extractor
|
---|
20 | */
|
---|
21 | package com.drew.imaging.tiff;
|
---|
22 |
|
---|
23 | import com.drew.lang.RandomAccessReader;
|
---|
24 | import com.drew.lang.Rational;
|
---|
25 | import com.drew.lang.annotations.NotNull;
|
---|
26 | import com.drew.lang.annotations.Nullable;
|
---|
27 |
|
---|
28 | import java.io.IOException;
|
---|
29 | import java.util.Set;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Interface of an class capable of handling events raised during the reading of a TIFF file
|
---|
33 | * via {@link TiffReader}.
|
---|
34 | *
|
---|
35 | * @author Drew Noakes https://drewnoakes.com
|
---|
36 | */
|
---|
37 | public interface TiffHandler
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Receives the 2-byte marker found in the TIFF header.
|
---|
41 | * <p>
|
---|
42 | * Implementations are not obligated to use this information for any purpose, though it may be useful for
|
---|
43 | * validation or perhaps differentiating the type of mapping to use for observed tags and IFDs.
|
---|
44 | *
|
---|
45 | * @param marker the 2-byte value found at position 2 of the TIFF header
|
---|
46 | */
|
---|
47 | void setTiffMarker(int marker) throws TiffProcessingException;
|
---|
48 |
|
---|
49 | boolean tryEnterSubIfd(int tagId);
|
---|
50 | boolean hasFollowerIfd();
|
---|
51 |
|
---|
52 | void endingIFD();
|
---|
53 |
|
---|
54 | void completed(@NotNull final RandomAccessReader reader, final int tiffHeaderOffset);
|
---|
55 |
|
---|
56 | @Nullable
|
---|
57 | Long tryCustomProcessFormat(int tagId, int formatCode, long componentCount);
|
---|
58 |
|
---|
59 | boolean customProcessTag(int tagOffset,
|
---|
60 | @NotNull Set<Integer> processedIfdOffsets,
|
---|
61 | int tiffHeaderOffset,
|
---|
62 | @NotNull RandomAccessReader reader,
|
---|
63 | int tagId,
|
---|
64 | int byteCount) throws IOException;
|
---|
65 |
|
---|
66 | void warn(@NotNull String message);
|
---|
67 | void error(@NotNull String message);
|
---|
68 |
|
---|
69 | void setByteArray(int tagId, @NotNull byte[] bytes);
|
---|
70 | void setString(int tagId, @NotNull String string);
|
---|
71 | void setRational(int tagId, @NotNull Rational rational);
|
---|
72 | void setRationalArray(int tagId, @NotNull Rational[] array);
|
---|
73 | void setFloat(int tagId, float float32);
|
---|
74 | void setFloatArray(int tagId, @NotNull float[] array);
|
---|
75 | void setDouble(int tagId, double double64);
|
---|
76 | void setDoubleArray(int tagId, @NotNull double[] array);
|
---|
77 | void setInt8s(int tagId, byte int8s);
|
---|
78 | void setInt8sArray(int tagId, @NotNull byte[] array);
|
---|
79 | void setInt8u(int tagId, short int8u);
|
---|
80 | void setInt8uArray(int tagId, @NotNull short[] array);
|
---|
81 | void setInt16s(int tagId, int int16s);
|
---|
82 | void setInt16sArray(int tagId, @NotNull short[] array);
|
---|
83 | void setInt16u(int tagId, int int16u);
|
---|
84 | void setInt16uArray(int tagId, @NotNull int[] array);
|
---|
85 | void setInt32s(int tagId, int int32s);
|
---|
86 | void setInt32sArray(int tagId, @NotNull int[] array);
|
---|
87 | void setInt32u(int tagId, long int32u);
|
---|
88 | void setInt32uArray(int tagId, @NotNull long[] array);
|
---|
89 | }
|
---|