public class ArmoredInputStream
extends java.io.InputStream
By default a missing CRC will not cause an exception. To force CRC detection use: ArmoredInputStream aIn = [] aIn.setDetectMissingCRC(true);
| Constructor and Description |
|---|
ArmoredInputStream(java.io.InputStream in)
Create a stream for reading a PGP armoured message, parsing up to a header
and then reading the data that follows.
|
ArmoredInputStream(java.io.InputStream in,
boolean hasHeaders)
Create an armoured input stream which will assume the data starts
straight away, or parse for headers first depending on the value of
hasHeaders.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
java.lang.String |
getArmorHeaderLine()
Return the armor header line (if there is one)
|
java.lang.String[] |
getArmorHeaders()
Return the armor headers (the lines after the armor header line),
|
boolean |
isClearText() |
boolean |
isEndOfStream() |
int |
read() |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from the input stream into
an array of bytes.
|
void |
setDetectMissingCRC(boolean detectMissing)
Change how the stream should react if it encounters missing CRC checksum.
|
public ArmoredInputStream(java.io.InputStream in)
throws java.io.IOException
in - java.io.IOExceptionpublic ArmoredInputStream(java.io.InputStream in,
boolean hasHeaders)
throws java.io.IOException
in - hasHeaders - true if headers are to be looked for, false otherwise.java.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic boolean isClearText()
public boolean isEndOfStream()
public java.lang.String getArmorHeaderLine()
public java.lang.String[] getArmorHeaders()
public int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
InputStream.read(byte[], int, int),
as the upstream method silently swallows IOExceptions.
This would cause CRC checksum errors to go unnoticed.read in class java.io.InputStreamb - byte arrayoff - offset at which we start writing data to the arraylen - number of bytes we write into the arrayjava.io.IOException - if an exception happens AT ANY POINTpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic void setDetectMissingCRC(boolean detectMissing)
IOException will be thrown if a missing CRC checksum is encountered.detectMissing - ignore missing CRC sums