# Class MPackageWriter

java.lang.Object
com.io7m.montarre.io.internal.MPackageWriter

All Implemented Interfaces:
  `MPackageWriterType`, `AutoCloseable`

public final class MPackageWriter extends Object implements MPackageWriterType
A package writer.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MPackageWriter(MPackageDeclarationSerializerFactoryType inSerializers, HashMap<String,Object> inAttributes, OutputStream inStream, BufferedOutputStream inBuffered, Path inFile, Path inFileTmp, MPackageDeclaration inPackageV)`
  A package writer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addFile(MFileName name, Path file)`
  Add a file to the package.
  `void`
  `close()`
  `void`
  `packFrom(Path inputDirectory)`
  Pack all files in the given directory hierarchy.
  `void`
  `start()`
  Start the file.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### MPackageWriter

    public MPackageWriter(MPackageDeclarationSerializerFactoryType inSerializers, HashMap<String,Object> inAttributes, OutputStream inStream, BufferedOutputStream inBuffered, Path inFile, Path inFileTmp, MPackageDeclaration inPackageV)
    A package writer.
    Parameters:
      `inSerializers` - The serializer factory
      `inAttributes` - The error attributes
      `inStream` - The output stream
      `inBuffered` - The buffered output
      `inFile` - The file
      `inFileTmp` - The temporary file
      `inPackageV` - The package declaration

- ## Method Details

  - ### start

    public void start() throws MException
    Start the file.
    Throws:
      `MException` - On errors

  - ### addFile

    public void addFile(MFileName name, Path file) throws MException
    Description copied from interface: `MPackageWriterType`
    Add a file to the package.
    Specified by:
      `addFile` in interface `MPackageWriterType`
    Parameters:
      `name` - The file name
      `file` - The file
    Throws:
      `MException` - On errors

  - ### close

    public void close() throws MException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `MPackageWriterType`
    Throws:
      `MException`

  - ### packFrom

    public void packFrom(Path inputDirectory) throws MException
    Description copied from interface: `MPackageWriterType`
    Pack all files in the given directory hierarchy.
    Specified by:
      `packFrom` in interface `MPackageWriterType`
    Parameters:
      `inputDirectory` - The input directory
    Throws:
      `MException`