com.r3corda.core.node.services.testing / MockAttachmentStorage / importAttachment

# importAttachment

`fun importAttachment(jar: InputStream): SecureHash`
Overrides AttachmentStorage.importAttachment

Inserts the given attachment into the store, does not close the input stream. This can be an intensive operation due to the need to copy the bytes to disk and hash them along the way.

Note that you should not pass a JarInputStream into this method and it will throw if you do, because access to the raw byte stream is required.

### Exceptions

`FileAlreadyExistsException` - if the given byte stream has already been inserted.
`IllegalArgumentException` - if the given byte stream is empty or a JarInputStream
`IOException` - if something went wrong.