| 1 | /*
|
|---|
| 2 | * Copyright 2002-2015 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 |
|
|---|
| 27 | import java.io.IOException;
|
|---|
| 28 | import java.util.Set;
|
|---|
| 29 |
|
|---|
| 30 | /**
|
|---|
| 31 | * Interface of an class capable of handling events raised during the reading of a TIFF file
|
|---|
| 32 | * via {@link TiffReader}.
|
|---|
| 33 | *
|
|---|
| 34 | * @author Drew Noakes https://drewnoakes.com
|
|---|
| 35 | */
|
|---|
| 36 | public interface TiffHandler
|
|---|
| 37 | {
|
|---|
| 38 | /**
|
|---|
| 39 | * Receives the 2-byte marker found in the TIFF header.
|
|---|
| 40 | * <p>
|
|---|
| 41 | * Implementations are not obligated to use this information for any purpose, though it may be useful for
|
|---|
| 42 | * validation or perhaps differentiating the type of mapping to use for observed tags and IFDs.
|
|---|
| 43 | *
|
|---|
| 44 | * @param marker the 2-byte value found at position 2 of the TIFF header
|
|---|
| 45 | */
|
|---|
| 46 | void setTiffMarker(int marker) throws TiffProcessingException;
|
|---|
| 47 |
|
|---|
| 48 | boolean isTagIfdPointer(int tagType);
|
|---|
| 49 | boolean hasFollowerIfd();
|
|---|
| 50 |
|
|---|
| 51 | void endingIFD();
|
|---|
| 52 |
|
|---|
| 53 | void completed(@NotNull final RandomAccessReader reader, final int tiffHeaderOffset);
|
|---|
| 54 |
|
|---|
| 55 | boolean customProcessTag(int tagOffset,
|
|---|
| 56 | @NotNull Set<Integer> processedIfdOffsets,
|
|---|
| 57 | int tiffHeaderOffset,
|
|---|
| 58 | @NotNull RandomAccessReader reader,
|
|---|
| 59 | int tagId,
|
|---|
| 60 | int byteCount) throws IOException;
|
|---|
| 61 |
|
|---|
| 62 | void warn(@NotNull String message);
|
|---|
| 63 | void error(@NotNull String message);
|
|---|
| 64 |
|
|---|
| 65 | void setByteArray(int tagId, @NotNull byte[] bytes);
|
|---|
| 66 | void setString(int tagId, @NotNull String string);
|
|---|
| 67 | void setRational(int tagId, @NotNull Rational rational);
|
|---|
| 68 | void setRationalArray(int tagId, @NotNull Rational[] array);
|
|---|
| 69 | void setFloat(int tagId, float float32);
|
|---|
| 70 | void setFloatArray(int tagId, @NotNull float[] array);
|
|---|
| 71 | void setDouble(int tagId, double double64);
|
|---|
| 72 | void setDoubleArray(int tagId, @NotNull double[] array);
|
|---|
| 73 | void setInt8s(int tagId, byte int8s);
|
|---|
| 74 | void setInt8sArray(int tagId, @NotNull byte[] array);
|
|---|
| 75 | void setInt8u(int tagId, short int8u);
|
|---|
| 76 | void setInt8uArray(int tagId, @NotNull short[] array);
|
|---|
| 77 | void setInt16s(int tagId, int int16s);
|
|---|
| 78 | void setInt16sArray(int tagId, @NotNull short[] array);
|
|---|
| 79 | void setInt16u(int tagId, int int16u);
|
|---|
| 80 | void setInt16uArray(int tagId, @NotNull int[] array);
|
|---|
| 81 | void setInt32s(int tagId, int int32s);
|
|---|
| 82 | void setInt32sArray(int tagId, @NotNull int[] array);
|
|---|
| 83 | void setInt32u(int tagId, long int32u);
|
|---|
| 84 | void setInt32uArray(int tagId, @NotNull long[] array);
|
|---|
| 85 | }
|
|---|