mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-22 15:12:06 +01:00
Add Dearmor.data(String) default method
This commit is contained in:
parent
7ab65f63a4
commit
bfaba69222
1 changed files with 18 additions and 2 deletions
|
@ -10,6 +10,7 @@ import java.io.InputStream;
|
|||
|
||||
import sop.Ready;
|
||||
import sop.exception.SOPGPException;
|
||||
import sop.util.UTF8Util;
|
||||
|
||||
public interface Dearmor {
|
||||
|
||||
|
@ -19,7 +20,7 @@ public interface Dearmor {
|
|||
* @param data armored OpenPGP data
|
||||
* @return input stream of unarmored data
|
||||
*
|
||||
* @throws sop.exception.SOPGPException.BadData in case of non-OpenPGP data
|
||||
* @throws SOPGPException.BadData in case of non-OpenPGP data
|
||||
* @throws IOException in case of an IO error
|
||||
*/
|
||||
Ready data(InputStream data)
|
||||
|
@ -32,7 +33,7 @@ public interface Dearmor {
|
|||
* @param data armored OpenPGP data
|
||||
* @return input stream of unarmored data
|
||||
*
|
||||
* @throws sop.exception.SOPGPException.BadData in case of non-OpenPGP data
|
||||
* @throws SOPGPException.BadData in case of non-OpenPGP data
|
||||
* @throws IOException in case of an IO error
|
||||
*/
|
||||
default Ready data(byte[] data)
|
||||
|
@ -40,4 +41,19 @@ public interface Dearmor {
|
|||
IOException {
|
||||
return data(new ByteArrayInputStream(data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dearmor amored OpenPGP data.
|
||||
*
|
||||
* @param data armored OpenPGP data
|
||||
* @return input stream of unarmored data
|
||||
*
|
||||
* @throws SOPGPException.BadData in case of non-OpenPGP data
|
||||
* @throws IOException in case of an IO error
|
||||
*/
|
||||
default Ready data(String data)
|
||||
throws SOPGPException.BadData,
|
||||
IOException {
|
||||
return data(data.getBytes(UTF8Util.UTF8));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue