corda / net.corda.core.node.services / AttachmentStorage / importAttachment

importAttachment

abstract fun importAttachment(jar: InputStream): AttachmentId
Deprecated: More attachment information is required

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 java.util.jar.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 java.util.jar.JarInputStream.

IOException - if something went wrong.

abstract fun importAttachment(jar: InputStream, uploader: String, filename: String?): AttachmentId

Inserts the given attachment with additional metadata, see importAttachment for input stream handling Extra parameters:

Parameters

uploader - Uploader name

filename - Name of the file