public class TraceabilityFile extends Object implements AutoCloseable
Constructor and Description |
---|
TraceabilityFile(File file) |
Modifier and Type | Method and Description |
---|---|
void |
close()
flush the stream and close it.
|
void |
closeStoreLog()
Close the extracted data file
|
void |
initStoreLog()
Create a new file for extracted data.
Should be directly followed by one or multiple storeLog Must be close with closeStoreLog |
void |
storeAdditionalInformation(long numberOfLine,
String startDate,
String endDate)
Add an additionalInformation file with the given data in the zipFile
|
void |
storeComputedInformation(String currentHash,
String previousHash,
String currentHashMinusOneMonth,
String currentHashMinusOneYear)
Add an computedInformation file with the traceability data in the zipFile
|
void |
storeLog(byte[] line)
Add a line of extracted data in the recently created file.
Must be directly preceded by a call of initStoreLog or storeLog |
void |
storeMerkleTree(MerkleTree merkleTree)
Add a merkleTree file with the computed merkleTree in the zipFile
|
void |
storeTimeStampToken(byte[] timestampToken)
Add a timestampToken file with the computed token of the traceability operation in the zipFile
|
public TraceabilityFile(File file) throws FileNotFoundException, org.apache.commons.compress.archivers.ArchiveException
file
- the targeted file to store tmp zip fileFileNotFoundException
- if the given file is missingorg.apache.commons.compress.archivers.ArchiveException
- if any error occurs while creating ZipArchiveOutputStrampublic void storeMerkleTree(MerkleTree merkleTree) throws IOException
merkleTree
- the tree that should be store in zipIOException
- if any error occurs while attempting to write in zippublic void storeTimeStampToken(byte[] timestampToken) throws IOException
timestampToken
- of the traceability operationIOException
- if any error occurs while attempting to write in zippublic void initStoreLog() throws IOException
IOException
- if any error occurs while attempting to write in zippublic void storeLog(byte[] line) throws IOException
IOException
- if any error occurs while attempting to write in zippublic void closeStoreLog() throws IOException
IOException
- if error on closing streampublic void storeAdditionalInformation(long numberOfLine, String startDate, String endDate) throws IOException
numberOfLine
- of the extracted data secured by the traceability processstartDate
- of the traceability processendDate
- of the traceability processIOException
- if any error occurs while attempting to write in zippublic void storeComputedInformation(String currentHash, String previousHash, String currentHashMinusOneMonth, String currentHashMinusOneYear) throws IOException
currentHash
- hash of the new merkleTree rootpreviousHash
- hash of the last traceability operation merkleTree rootcurrentHashMinusOneMonth
- hash of the (Month - 1) traceability operation merkleTree rootcurrentHashMinusOneYear
- hash of the (Year - 1) traceability operation merkleTree rootIOException
- if any error occurs while attempting to write in zippublic void close() throws IOException
close
in interface AutoCloseable
IOException
- if error on closing streamCopyright © 2018 Vitam. All rights reserved.