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

MockAttachmentStorage

class MockAttachmentStorage : AttachmentStorage


Constructors

<init> MockAttachmentStorage()

Properties

files val files: HashMap<SecureHash, ByteArray>

Functions

importAttachment fun importAttachment(jar: InputStream): SecureHash

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.

openAttachment fun openAttachment(id: SecureHash): Attachment?

Returns a newly opened stream for the given locally stored attachment, or null if no such attachment is known. The returned stream must be closed when you are done with it to avoid resource leaks. You should probably wrap the result in a JarInputStream unless youre sending it somewhere, there is a convenience helper for this on Attachment.