Package org.bouncycastle.bcpg
Class ArmoredInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.bouncycastle.bcpg.ArmoredInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ArmoredInputStream extends java.io.InputStream
reader for Base64 armored objects - read the headers and then start returning bytes when the data is reached. An IOException is thrown if the CRC check fails.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Constructor Detail
-
ArmoredInputStream
public ArmoredInputStream(java.io.InputStream in) throws java.io.IOException
Create a stream for reading a PGP armoured message, parsing up to a header and then reading the data that follows.- Parameters:
in
-- Throws:
java.io.IOException
-
ArmoredInputStream
public ArmoredInputStream(java.io.InputStream in, boolean hasHeaders) throws java.io.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.- Parameters:
in
-hasHeaders
- true if headers are to be looked for, false otherwise.- Throws:
java.io.IOException
-
-
Method Detail
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
isClearText
public boolean isClearText()
- Returns:
- true if we are inside the clear text section of a PGP signed message.
-
isEndOfStream
public boolean isEndOfStream()
- Returns:
- true if the stream is actually at end of file.
-
getArmorHeaderLine
public java.lang.String getArmorHeaderLine()
Return the armor header line (if there is one)- Returns:
- the armor header line, null if none present.
-
getArmorHeaders
public java.lang.String[] getArmorHeaders()
Return the armor headers (the lines after the armor header line),- Returns:
- an array of armor headers, null if there aren't any.
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
-