Package com.logicaldoc.util.io
Class P7M
- java.lang.Object
-
- com.logicaldoc.util.io.P7M
-
public class P7M extends Object
Use this class to read data from a .p7m file that a signed file- Since:
- 4.5
- Author:
- Matteo Caruso - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description P7M(byte[] content)
P7M(File file)
P7M(InputStream is)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
extractOriginalFile(File outFile)
Extracts the original file content into the given fileInputStream
extractOriginalFileStream()
Extracts the original file content as streamorg.bouncycastle.cms.CMSSignedData
getCms()
File
getFile()
void
read()
Reads a p7m file from a file.void
read(byte[] content)
void
read(InputStream is)
Reads a p7m file from a stream.void
setFile(File file)
-
-
-
Constructor Detail
-
P7M
public P7M(File file)
-
P7M
public P7M(InputStream is) throws IOException
- Throws:
IOException
-
P7M
public P7M(byte[] content)
-
-
Method Detail
-
read
public void read(byte[] content)
-
read
public void read(InputStream is) throws IOException
Reads a p7m file from a stream. Sets the signed data with the stream as content.- Parameters:
is
- The inputStream- Throws:
IOException
- I/O error
-
read
public void read() throws IOException
Reads a p7m file from a file.- Throws:
IOException
- I/O error
-
extractOriginalFileStream
public InputStream extractOriginalFileStream() throws IOException, org.bouncycastle.cms.CMSException
Extracts the original file content as stream- Returns:
- the stream representing the enclosed file
- Throws:
org.bouncycastle.cms.CMSException
- in case the enclosed file cannot be extractedIOException
- I/O error
-
extractOriginalFile
public void extractOriginalFile(File outFile) throws FileNotFoundException, IOException, org.bouncycastle.cms.CMSException
Extracts the original file content into the given file- Parameters:
outFile
- The file in which will contained the original file content.- Throws:
IOException
- I/O exceptionFileNotFoundException
- file not foundorg.bouncycastle.cms.CMSException
- in case the embedded file cannot be extracted
-
getFile
public File getFile()
-
setFile
public void setFile(File file)
-
getCms
public org.bouncycastle.cms.CMSSignedData getCms()
-
-