Package com.mindee.parsing
Class BaseLocalResponse
- java.lang.Object
-
- com.mindee.parsing.BaseLocalResponse
-
- Direct Known Subclasses:
LocalResponse,LocalResponse
public abstract class BaseLocalResponse extends Object
A Mindee response saved locally.
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]file
-
Constructor Summary
Constructors Constructor Description BaseLocalResponse(File input)Load from aFile.BaseLocalResponse(InputStream input)Load from anInputStream.BaseLocalResponse(String input)Load from aString.BaseLocalResponse(Path input)Load from aPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getFile()StringgetHmacSignature(String secretKey)Get the HMAC signature of the payload.booleanisValidHmacSignature(String secretKey, String signature)Verify that the payload's signature matches the one received from the server.
-
-
-
Constructor Detail
-
BaseLocalResponse
public BaseLocalResponse(InputStream input)
Load from anInputStream.- Parameters:
input- will be decoded as UTF-8.
-
BaseLocalResponse
public BaseLocalResponse(String input)
Load from aString.- Parameters:
input- will be decoded as UTF-8.
-
BaseLocalResponse
public BaseLocalResponse(File input) throws IOException
Load from aFile.- Parameters:
input- will be decoded as UTF-8.- Throws:
IOException
-
BaseLocalResponse
public BaseLocalResponse(Path input) throws IOException
Load from aPath.- Parameters:
input- will be decoded as UTF-8.- Throws:
IOException
-
-
Method Detail
-
getHmacSignature
public String getHmacSignature(String secretKey)
Get the HMAC signature of the payload.- Parameters:
secretKey- Your secret key from the Mindee platform.- Returns:
- The generated HMAC signature.
-
isValidHmacSignature
public boolean isValidHmacSignature(String secretKey, String signature)
Verify that the payload's signature matches the one received from the server.- Parameters:
secretKey- Your secret key from the Mindee platform.signature- The signature from the "X-Mindee-Hmac-Signature" HTTP header.- Returns:
- true if the signatures match.
-
getFile
public byte[] getFile()
-
-