Package com.io7m.montarre.io.internal
Class MPackageReader
java.lang.Object
com.io7m.montarre.io.internal.MPackageReader
- All Implemented Interfaces:
MPackageReaderType,AutoCloseable
A package reader.
-
Constructor Summary
ConstructorsConstructorDescriptionMPackageReader(Path file, org.apache.commons.compress.archivers.zip.ZipFile inZipFile, MPackageDeclarationParserFactoryType inParsers) A package reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidCheck the digest of the given file, raising an exception if it does not match what is in the package declaration.voidclose()voidstart()Open the package declaration and parse it.voidunpackInto(Path output) Unpack all files into the given output directory.
-
Constructor Details
-
MPackageReader
public MPackageReader(Path file, org.apache.commons.compress.archivers.zip.ZipFile inZipFile, MPackageDeclarationParserFactoryType inParsers) A package reader.- Parameters:
file- The fileinZipFile- The zip fileinParsers- The parsers
-
-
Method Details
-
start
Open the package declaration and parse it.- Throws:
MException- On errors
-
packageDeclaration
- Specified by:
packageDeclarationin interfaceMPackageReaderType- Returns:
- The package declaration
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceMPackageReaderType- Throws:
MException
-
readFile
- Specified by:
readFilein interfaceMPackageReaderType- Parameters:
file- The file- Returns:
- A stream for the given file
- Throws:
MException
-
checkHash
Description copied from interface:MPackageReaderTypeCheck the digest of the given file, raising an exception if it does not match what is in the package declaration.- Specified by:
checkHashin interfaceMPackageReaderType- Parameters:
file- The file- Throws:
MException- On errors
-
unpackInto
Description copied from interface:MPackageReaderTypeUnpack all files into the given output directory.- Specified by:
unpackIntoin interfaceMPackageReaderType- Parameters:
output- The output directory- Throws:
MException- On errors
-