Class MPackageReader
java.lang.Object
com.io7m.montarre.io.internal.MPackageReader
- All Implemented Interfaces:
MPackageReaderType, AutoCloseable
A package reader.
-
Nested Class Summary
Nested classes/interfaces inherited from interface MPackageReaderType
MPackageReaderType.PlatformDependentModulePolicy -
Constructor Summary
ConstructorsConstructorDescriptionMPackageReader(Path inFile, 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()static byte[]extractManifest(Path file) Extract a manifest from the file.voidstart()Open the package declaration and parse it.voidunpackInto(Path output, Function<MPlatformDependentModule, MPackageReaderType.PlatformDependentModulePolicy> filterPlatform) Unpack all files into the given output directory.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MPackageReaderType
unpackInto
-
Constructor Details
-
MPackageReader
public MPackageReader(Path inFile, MPackageDeclarationParserFactoryType inParsers) throws IOException, com.io7m.entomos.core.EoException A package reader.- Parameters:
inFile- The fileinParsers- The parsers- Throws:
IOExceptioncom.io7m.entomos.core.EoException
-
-
Method Details
-
extractManifest
Extract a manifest from the file.- Parameters:
file- The file- Returns:
- The manifest bytes
- Throws:
MException- On errors
-
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:
fileName- The file- Returns:
- A stream for the given file
- Throws:
MException- On errors
-
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:
fileName- The file- Throws:
MException- On errors
-
unpackInto
public void unpackInto(Path output, Function<MPlatformDependentModule, MPackageReaderType.PlatformDependentModulePolicy> filterPlatform) throws MException Description copied from interface:MPackageReaderTypeUnpack all files into the given output directory.- Specified by:
unpackIntoin interfaceMPackageReaderType- Parameters:
output- The output directoryfilterPlatform- The filter for platform-dependent modules- Throws:
MException- On errors
-