By default a missing CRC will not cause an exception. To force CRC detection use:
ArmoredInputStream aIn = ...
aIn.setDetectMissingCRC(true);
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv boolean | |
| private final CRC24 | |
| pack-priv boolean | |
| private static final byte[] | decodingTable
set up the decoding table. |
| private boolean | |
| pack-priv boolean | |
| pack-priv String | |
| pack-priv StringList | |
| pack-priv InputStream | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv byte[] | |
| pack-priv boolean | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public | ArmoredInputStream(InputStream in)
Create a stream for reading a PGP armoured message, parsing up to a header and then reading the data that follows. |
| public | ArmoredInputStream(InputStream in, boolean
true if headers are to be looked for, false otherwise. 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. |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | available()
Overrides java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. |
| public static ArmoredInputStream. | |
| private void | |
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| private static int | Returns: the offset the data starts in out.decode the base 64 encoded input data. |
| public String | Returns: the armor header line, null if none present.Return the armor header line (if there is one) |
| public String[] | Returns: an array of armor headers, null if there aren't any.Return the armor headers (the lines after the armor header line), |
| public boolean | |
| public boolean | |
| private boolean | |
| public int | read()
Implements abstract java. Reads the next byte of data from the input stream. |
| public int | Returns: total number of bytes read into the bufferbyte array b, int offset at which we start writing data to the array off, int number of bytes we write into the array len)Overrides java. Reads up to |
| private int | |
| public void | setDetectMissingCRC(boolean
false if ignore missing CRC sums, true for exception detectMissing)
Deprecated
use Builder class for configuring this.
Change how the stream should react if it encounters missing CRC checksum. |
| bufPtr | back to summary |
|---|---|
| pack-priv int bufPtr | |
| clearText | back to summary |
|---|---|
| pack-priv boolean clearText | |
| crc | back to summary |
|---|---|
| private final CRC24 crc | |
| crcFound | back to summary |
|---|---|
| pack-priv boolean crcFound | |
| decodingTable | back to summary |
|---|---|
| private static final byte[] decodingTable set up the decoding table. | |
| detectMissingChecksum | back to summary |
|---|---|
| private boolean detectMissingChecksum | |
| hasHeaders | back to summary |
|---|---|
| pack-priv boolean hasHeaders | |
| header | back to summary |
|---|---|
| pack-priv String header | |
| headerList | back to summary |
|---|---|
| pack-priv StringList headerList | |
| in | back to summary |
|---|---|
| pack-priv InputStream in | |
| isEndOfStream | back to summary |
|---|---|
| pack-priv boolean isEndOfStream | |
| lastC | back to summary |
|---|---|
| pack-priv int lastC | |
| newLineFound | back to summary |
|---|---|
| pack-priv boolean newLineFound | |
| outBuf | back to summary |
|---|---|
| pack-priv byte[] outBuf | |
| restart | back to summary |
|---|---|
| pack-priv boolean restart | |
| start | back to summary |
|---|---|
| pack-priv boolean start | |
| ArmoredInputStream | back to summary |
|---|---|
| public ArmoredInputStream(InputStream in) throws IOException Create a stream for reading a PGP armoured message, parsing up to a header and then reading the data that follows. | |
| ArmoredInputStream | back to summary |
|---|---|
| public ArmoredInputStream(InputStream in, boolean hasHeaders) throws IOException Create an armoured input stream which will assume the data starts straight away, or parse for headers first depending on the value of hasHeaders.
| |
| ArmoredInputStream | back to summary |
|---|---|
| private ArmoredInputStream(InputStream in, ArmoredInputStream. | |
| available | back to summary |
|---|---|
| public int available() throws IOException Overrides java. Doc from java. Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected. The read might be on the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes. Note that while some implementations of A subclass's implementation of this method may choose to throw an
| |
| builder | back to summary |
|---|---|
| public static ArmoredInputStream. | |
| checkIndexSize | back to summary |
|---|---|
| private void checkIndexSize(int size, int off, int len) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| decode | back to summary |
|---|---|
| private static int decode(int in0, int in1, int in2, int in3, byte[] out) throws IOException decode the base 64 encoded input data.
| |
| getArmorHeaderLine | back to summary |
|---|---|
| public String getArmorHeaderLine() Return the armor header line (if there is one)
| |
| getArmorHeaders | back to summary |
|---|---|
| public String[] getArmorHeaders() Return the armor headers (the lines after the armor header line),
| |
| isClearText | back to summary |
|---|---|
public boolean isClearText()
| |
| isEndOfStream | back to summary |
|---|---|
public boolean isEndOfStream()
| |
| parseHeaders | back to summary |
|---|---|
| private boolean parseHeaders() throws IOException | |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Reads up to Note We need to override the custom behavior of Java's
| |
| readIgnoreSpace | back to summary |
|---|---|
| private int readIgnoreSpace() throws IOException | |
| setDetectMissingCRC | back to summary |
|---|---|
| public void setDetectMissingCRC(boolean detectMissing)
Deprecated use Builder class for configuring this. Change how the stream should react if it encounters missing CRC checksum.
The default value is false (ignore missing CRC checksums). If the behavior is set to true,
an
| |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ArmoredInputStream | |
| public ArmoredInputStream. | setDetectMissingCRC(boolean
false if ignore missing CRC sums, true for exception detectMissingCRC)Change how the stream should react if it encounters missing CRC checksum. |
| public ArmoredInputStream. | Returns: the current builder instance.true if CRC should be ignored, false otherwise. ignoreCRC)Specifically ignore the CRC if in place (this will also avoid the cost of calculation). |
| public ArmoredInputStream. | Returns: the current builder instance.true if headers should be expected, false otherwise. hasHeaders)Enable or disable header parsing (default value true). |
| detectMissingCRC | back to summary |
|---|---|
| private boolean detectMissingCRC | |
| hasHeaders | back to summary |
|---|---|
| private boolean hasHeaders | |
| ignoreCRC | back to summary |
|---|---|
| private boolean ignoreCRC | |
| Builder | back to summary |
|---|---|
| private Builder() | |
| build | back to summary |
|---|---|
| public ArmoredInputStream build(InputStream inputStream) throws IOException | |
| setDetectMissingCRC | back to summary |
|---|---|
| public ArmoredInputStream. Change how the stream should react if it encounters missing CRC checksum.
The default value is false (ignore missing CRC checksums). If the behavior is set to true,
an
| |
| setIgnoreCRC | back to summary |
|---|---|
| public ArmoredInputStream. Specifically ignore the CRC if in place (this will also avoid the cost of calculation).
| |
| setParseForHeaders | back to summary |
|---|---|
| public ArmoredInputStream. Enable or disable header parsing (default value true).
| |