Package com.mindee.input
Class LocalResponse
- java.lang.Object
-
- com.mindee.input.LocalResponse
-
public class LocalResponse extends Object
A Mindee response saved locally.
-
-
Constructor Summary
Constructors Constructor Description LocalResponse(File input)
Load from aFile
.LocalResponse(InputStream input)
Load from anInputStream
.LocalResponse(String input)
Load from aString
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getFile()
String
getHmacSignature(String secretKey)
Get the HMAC signature of the payload.boolean
isValidHmacSignature(String secretKey, String signature)
Verify that the payload's signature matches the one received from the server.
-
-
-
Constructor Detail
-
LocalResponse
public LocalResponse(InputStream input) throws IOException
Load from anInputStream
.- Parameters:
input
- will be decoded as UTF-8.- Throws:
IOException
-
LocalResponse
public LocalResponse(String input)
Load from aString
.- Parameters:
input
- will be decoded as UTF-8.
-
LocalResponse
public LocalResponse(File input) throws IOException
Load from aFile
.- 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()
-
-