Package org.pgpainless.decryption_verification.cleartext_signatures

# Class WriteToFileMultiPassStrategy

java.lang.Object
org.pgpainless.decryption_verification.cleartext_signatures.WriteToFileMultiPassStrategy

All Implemented Interfaces:
  `MultiPassStrategy`

public class WriteToFileMultiPassStrategy extends Object implements MultiPassStrategy
Implementation of the `MultiPassStrategy`. When processing signed data the first time, the data is being written out into a file. For the second pass, that file is being read again. This strategy is recommended when larger amounts of data need to be processed. For smaller files, `InMemoryMultiPassStrategy` yields higher efficiency.

## Constructor Summary

Constructors
Constructor
Description
`WriteToFileMultiPassStrategy(File file)`
Create a `MultiPassStrategy` which writes data to a file.

## Method Summary

Modifier and Type
Method
Description
`InputStream`
`getMessageInputStream()`
Provide an `InputStream` which contains the data that was previously written away in `MultiPassStrategy.getMessageOutputStream()`.
`OutputStream`
`getMessageOutputStream()`
Provide an `OutputStream` into which the signed data can be read into.

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

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

## Constructor Details

### WriteToFileMultiPassStrategy

public WriteToFileMultiPassStrategy(File file)
Create a `MultiPassStrategy` which writes data to a file. Note that `getMessageOutputStream()` will create the file if necessary.

Parameters:
  `file` - file to write the data to and read from

## Method Details

### getMessageOutputStream

public OutputStream getMessageOutputStream() throws IOException
Description copied from interface: `MultiPassStrategy`
Provide an `OutputStream` into which the signed data can be read into.

Specified by:
  `getMessageOutputStream` in interface `MultiPassStrategy`
Returns:
  output stream
Throws:
  `IOException` - io error

### getMessageInputStream

public InputStream getMessageInputStream() throws IOException
Description copied from interface: `MultiPassStrategy`
Provide an `InputStream` which contains the data that was previously written away in `MultiPassStrategy.getMessageOutputStream()`. As there may be multiple signatures that need to be processed, each call of this method MUST return a new `InputStream`.

Specified by:
  `getMessageInputStream` in interface `MultiPassStrategy`
Returns:
  input stream
Throws:
  `IOException` - io error