- All Implemented Interfaces:
public abstract class FingerprintTransparency extends Object implements AutoCloseableAlgorithm transparency API that can capture all intermediate data structures produced by SourceAFIS algorithm. See algorithm transparency pages on SourceAFIS website for more information and a tutorial on how to use this class. Applications can subclass
capture(String, Map)method to define new transparency data logger. One default implementation of
FingerprintTransparencyis returned by
FingerprintTransparencyinstance should be created in try-with-resource construct. It will be capturing transparency data from all operations on current thread between invocation of the constructor and invocation of
close()method, which happens automatically in try-with-resource construct.
- See Also:
- Algorithm transparency in SourceAFIS
Constructors Modifier Constructor and Description
FingerprintTransparency()Creates an instance of
FingerprintTransparencyand activates it.
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description
capture(String keyword, Map<String,Supplier<byte>> data)Record transparency data.
close()Deactivate transparency logging and release system resources held by this instance if any.
log(String keyword, Map<String,Supplier<ByteBuffer>> data)Deprecated.
zip(OutputStream stream)Write all transparency data to a ZIP file.
protected FingerprintTransparency()Creates an instance of
FingerprintTransparencyand activates it. Activation places the new
FingerprintTransparencyinstance in thread-local storage, which causes all operations executed by current thread to log data to this
FingerprintTransparencyinstance. If activations are nested, data is only logged to the currently innermost
FingerprintTransparency. Deactivation happens in
close()method. Instances of
FingerprintTransparencyshould be created in try-with-resources construct to ensure that
close()is always called.
FingerprintTransparencyis an abstract class. This constructor is only called by subclasses.
- See Also:
captureRecord transparency data. Subclasses must override this method, because the default implementation does nothing. While this
FingerprintTransparencyobject is active (between call to the constructor and call to
close()), this method is called with transparency data in its parameters. Parameter
keywordspecifies the kind of transparency data being logged, usually corresponding to some stage in the algorithm. For convenience, several related pieces of transparency data are reported together. All pieces are available via map in parameter
data, keyed by file suffix identifying the kind of data, usually
.datfor JSON and binary data respectively. See algorithm transparency on SourceAFIS website for documentation of the structure of the transparency data. Transparency data is offered indirectly via
Supplier. If this
Supplieris not evaluated, the data is never serialized. This allows applications to efficiently collect only transparency data that is actually needed. If this method throws, exception is propagated through SourceAFIS code.
@Deprecated protected void log(String keyword, Map<String,Supplier<ByteBuffer>> data)Deprecated.Record transparency data in buffers. This is a deprecated variant of
capture(String, Map)that uses
ByteBufferinstead of plain byte arrays. This method is only called if
capture(String, Map)is not overridden.
public void close()Deactivate transparency logging and release system resources held by this instance if any. This method is normally called automatically when
FingerprintTransparencyis used in try-with-resources construct. Deactivation stops transparency data logging to this instance of
FingerprintTransparency, which was started by the constructor (
FingerprintTransparency()). If activations were nested, this method reactivates the outer
FingerprintTransparency. Subclasses can override this method to perform cleanup. Default implementation of this method performs deactivation. It must be called by overriding methods for deactivation to work correctly. This method doesn't declare any checked exceptions in order to spare callers of mandatory exception checking. If your code needs to throw a checked exception, wrap it in an unchecked exception.
public static FingerprintTransparency zip(OutputStream stream)Write all transparency data to a ZIP file. This is a convenience method to enable easy exploration of the available data. Programmatic processing of transparency data should be done by subclassing
capture(String, Map)method. The returned
FingerprintTransparencyobject holds system resources and callers are responsible for calling
close()method, perhaps using try-with-resources construct. Failure to close the returned
FingerprintTransparencyinstance may result in damaged ZIP file. If the provided
IOException, the exception will be wrapped in an unchecked exception and propagated.