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